Changeset 1201 for XIOS/dev/dev_olga/src/node/grid.cpp
- Timestamp:
- 07/07/17 18:17:49 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/grid.cpp
r1178 r1201 287 287 nbSrvPools = 1; 288 288 for (int p = 0; p < nbSrvPools; ++p) 289 { 290 if (context->hasClient && this->isChecked && doSendingIndex && !isIndexSent) 291 { 292 if (isScalarGrid()) 293 sendIndexScalarGrid(); 294 else 295 sendIndex(); 296 this->isIndexSent = true; 289 { 290 if (isScalarGrid()) 291 { 292 if (context->hasClient) 293 if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndexScalarGrid(); this->isIndexSent = true; } 294 295 if (this->isChecked) continue; 296 297 if (context->hasClient) 298 { 299 this->computeIndexScalarGrid(); 300 } 301 302 if (!(this->hasTransform() && !this->isTransformed())) 303 this->isChecked = true; 304 continue; 297 305 } 298 306 299 // Not sure about this 300 //if (!(this->hasTransform() && !this->isTransformed())) 301 // this->isChecked = true; 302 //return; 307 if (context->hasClient) 308 { 309 if (this->isChecked && doSendingIndex && !isIndexSent) 310 {sendIndex(); this->isIndexSent = true;} 311 } 303 312 } 304 313 … … 537 546 if (computedWrittenIndex_) return; 538 547 computedWrittenIndex_ = true; 539 540 if (isScalarGrid())541 {542 size_t nbWritten = 1;543 int writtenIndex = 0;544 545 localIndexToWriteOnClient.resize(nbWritten);546 localIndexToWriteOnServer.resize(nbWritten);547 localIndexToWriteOnServer(0) = writtenIndex;548 localIndexToWriteOnClient(0) = writtenIndex;549 550 return;551 }552 548 553 549 size_t nbWritten = 0, indGlo; … … 750 746 { 751 747 CContext* context = CContext::getCurrent(); 752 if (isScalarGrid()) 748 computeClientIndex(); 749 if (context->hasClient) 753 750 { 754 computeClientIndexScalarGrid(); 755 if (context->hasClient) 756 { 757 computeConnectedClientsScalarGrid(); 758 } 759 } 760 else 761 { 762 computeClientIndex(); 763 if (context->hasClient) 764 { 765 computeConnectedClients(); 766 } 751 computeConnectedClients(); 767 752 } 768 753 } … … 1186 1171 } 1187 1172 1188 void CGrid::computeClientIndexScalarGrid() 1189 { 1190 CContext* context = CContext::getCurrent(); 1191 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; // This should be changed soon 1192 for (int p = 0; p < nbSrvPools; ++p) 1193 { 1194 CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 1195 : context->client; 1196 1197 storeIndex_client.resize(1); 1198 storeIndex_client(0) = 0; 1199 1200 if (0 != serverDistribution_) 1201 { 1202 map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(), 1203 ite = outGlobalIndexFromClient.end(), it; 1204 for (it = itb; it != ite; ++it) 1205 { 1206 int rank = it->first; 1207 CArray<size_t,1>& globalIndex = outGlobalIndexFromClient[rank]; 1208 outLocalIndexStoreOnClient.insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements()))); 1209 CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient[rank]; 1210 if (1 != globalIndex.numElements()) 1211 ERROR("void CGrid::computeClientIndexScalarGrid()", 1212 << "Something wrong happened. " 1213 << "Number of received global index on scalar grid should equal to 1" 1214 << "Number of received global index " << globalIndex.numElements() << "."); 1215 1216 localIndex(0) = globalIndex(0); 1217 } 1218 } 1219 } 1220 } 1221 1222 void CGrid::computeConnectedClientsScalarGrid() 1173 void CGrid::computeIndexScalarGrid() 1223 1174 { 1224 1175 CContext* context = CContext::getCurrent(); … … 1230 1181 for (int p = 0; p < nbSrvPools; ++p) 1231 1182 { 1232 CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 1233 : context->client; 1183 CContextClient* client = context->hasServer ? context->clientPrimServer[p] : context->client; 1184 1185 storeIndex_client.resize(1); 1186 storeIndex_client(0) = 0; 1234 1187 1235 1188 connectedServerRank_[p].clear(); 1236 1189 1237 if (client->isServerLeader()) 1238 { 1239 const std::list<int>& ranks = client->getRanksServerLeader(); 1240 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1241 { 1242 int rank = *itRank; 1243 int nb = 1; 1190 if (0 == client->clientRank) 1191 { 1192 for (int rank = 0; rank < client->serverSize; ++rank) 1193 { 1244 1194 connectedServerRank_[p].push_back(rank); 1245 connectedDataSize_[p][rank] = nb; 1246 nbSenders[p][rank] = nb; 1247 } 1248 } 1249 else 1250 { 1251 const std::list<int>& ranks = client->getRanksServerNotLeader(); 1252 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1253 { 1254 int rank = *itRank; 1255 int nb = 1; 1256 connectedServerRank_[p].push_back(rank); 1257 connectedDataSize_[p][rank] = nb; 1258 nbSenders[p][rank] = nb; 1259 } 1260 } 1261 1195 connectedDataSize_[p][rank] = 1; 1196 nbSenders[p][rank] = 1; 1197 } 1198 } 1262 1199 isDataDistributed_ = false; 1263 1200 }
Note: See TracChangeset
for help on using the changeset viewer.