Changeset 1030 for XIOS/dev/dev_olga/src/node/grid.cpp
- Timestamp:
- 01/20/17 16:17:57 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/grid.cpp
r1027 r1030 273 273 { 274 274 CContext* context = CContext::getCurrent(); 275 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 276 275 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 276 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 277 nbSrvPools = 1; 277 278 for (int i = 0; i < nbSrvPools; ++i) 278 { 279 CContextClient* client= context->hasServer ? context->clientPrimServer[i] : context->client; 279 { 280 280 if (isScalarGrid()) 281 { 282 // if (context->hasClient && !context->hasServer) 283 if (context->hasClient) 284 if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndexScalarGrid(); this->isIndexSent = true; } 285 286 if (this->isChecked) return; 287 // if (context->hasClient && !context->hasServer) 288 if (context->hasClient) 289 { 290 this->computeIndexScalarGrid(); 291 } 292 293 // this->isChecked = true; 294 if (!(this->hasTransform() && !this->isTransformed())) 295 this->isChecked = true; 296 return; 297 } 298 299 // if (context->hasClient && !context->hasServer) 300 // if (context->hasClient) 301 // if (doSendingIndex && !isIndexSent) 302 { 303 if (context->hasClient) 304 { 305 if (this->isChecked && doSendingIndex && !isIndexSent) 306 {sendIndex(); this->isIndexSent = true;} 307 } 308 309 if (this->isChecked) return; 310 this->checkAttributesAfterTransformation(); 311 this->checkMask(); 312 this->computeIndex(); 313 // this->isChecked = true; 281 { 282 if (context->hasClient) 283 if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndexScalarGrid(); this->isIndexSent = true; } 284 285 if (this->isChecked) continue; 286 287 if (context->hasClient) 288 { 289 this->computeIndexScalarGrid(); 290 } 291 314 292 if (!(this->hasTransform() && !this->isTransformed())) 315 293 this->isChecked = true; 316 317 if (!(this->hasTransform() && (!this->isGenerated()))) 318 this->isChecked = true; 319 320 321 } 322 323 // if (this->isChecked) return; 324 325 // // if (context->hasClient && !context->hasServer) 326 // // if (context->hasClient) 327 // { 328 // this->checkAttributesAfterTransformation(); 329 // this->checkMask(); 330 // this->computeIndex(); 331 // } 332 // this->isChecked = true; 333 } 294 continue; 295 } 296 297 if (context->hasClient) 298 { 299 if (this->isChecked && doSendingIndex && !isIndexSent) 300 {sendIndex(); this->isIndexSent = true;} 301 } 302 } 303 304 if (this->isChecked) return; 305 this->checkAttributesAfterTransformation(); 306 this->checkMask(); 307 this->computeIndex(); 308 309 if (!(this->hasTransform() && !this->isTransformed())) 310 this->isChecked = true; 311 312 if (!(this->hasTransform() && (!this->isGenerated()))) 313 this->isChecked = true; 334 314 } 335 315 … … 521 501 CContext* context = CContext::getCurrent(); 522 502 523 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 503 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 504 // int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 505 // This needs to change one day 506 // It works only for the same number of procs on secondary pools 507 int nbSrvPools = 1; 508 524 509 for (int i = 0; i < nbSrvPools; ++i) 525 510 { 526 CContextClient* client = (context->hasServer) ? context->clientPrimServer[i] : context->client; 527 CContextServer* server = (context->hasServer) ? context->server : 0 ; 528 int rank = (server && !client) ? server->intraCommRank : client->clientRank; 511 CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[i] : context->client) : context->client; 512 // CContextClient* client = (context->hasServer) ? context->clientPrimServer[i] : context->client; 513 // CContextServer* server = (context->hasServer) ? context->server : 0 ; 514 // int rank = (server && !client) ? server->intraCommRank : client->clientRank; 515 int rank = client->clientRank; 529 516 530 517 // First of all, compute distribution on client side … … 538 525 int nbStoreIndex = storeIndex_client.numElements(); 539 526 for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 540 isDataDistributed_= clientDistribution_->isDataDistributed(); 541 } 527 if (0 == serverDistribution_) 528 isDataDistributed_= clientDistribution_->isDataDistributed(); 529 } 542 530 } 543 531 … … 545 533 { 546 534 CContext* context = CContext::getCurrent(); 547 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 535 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 536 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 537 // int nbSrvPools = 1; 548 538 for (int i = 0; i < nbSrvPools; ++i) 549 539 { … … 636 626 // isDataDistributed_= clientDistribution_->isDataDistributed(); 637 627 638 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 639 for (int i = 0; i < nbSrvPools; ++i) 640 { 641 CContextClient* client = (context->hasServer) ? context->clientPrimServer[i] : context->client; 642 computeClientIndex(); 643 if (context->hasClient) 644 computeConnectedClients(); 645 } 628 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 629 630 computeClientIndex(); 631 if (context->hasClient) 632 computeConnectedClients(); 633 646 634 647 635 // connectedServerRank_.clear(); … … 715 703 { 716 704 CContext* context = CContext::getCurrent(); 717 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 705 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 706 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 707 nbSrvPools = 1; 718 708 for (int i = 0; i < nbSrvPools; ++i) 719 709 { … … 1109 1099 void CGrid::restoreField_arr(const CArray<double, 1>& stored, double* const data) const 1110 1100 { 1111 // const StdSize size = storeIndex_client.numElements(); 1112 1113 // for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i); 1114 1115 const StdSize size = indexFromClients.numElements(); 1116 1117 for(StdSize i = 0; i < size; i++) data[indexFromClients(i)] = stored(i); 1101 const StdSize size = storeIndex_client.numElements(); 1102 1103 for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i); 1104 1105 // This is a solution for multilevel server 1106 // const StdSize size = indexFromClients.numElements(); 1107 1108 // for(StdSize i = 0; i < size; i++) data[indexFromClients(i)] = stored(i); 1118 1109 1119 1110 } … … 1122 1113 { 1123 1114 CContext* context = CContext::getCurrent(); 1124 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1115 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1116 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 1125 1117 for (int i = 0; i < nbSrvPools; ++i) 1126 1118 { … … 1182 1174 { 1183 1175 CContext* context = CContext::getCurrent(); 1184 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1176 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1177 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 1185 1178 for (int i = 0; i < nbSrvPools; ++i) 1186 1179 { … … 1241 1234 CContext* context = CContext::getCurrent(); 1242 1235 // CContextClient* client = context->client; 1243 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1236 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1237 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 1244 1238 for (int i = 0; i < nbSrvPools; ++i) 1245 1239 { … … 1251 1245 list<CArray<size_t,1> > listOutIndex; 1252 1246 const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer(); 1253 CDistributionClient::GlobalLocalDataMap::const_iterator itIndex = globalLocalIndexSendToServer.begin(), 1254 iteIndex = globalLocalIndexSendToServer.end(); 1247 CDistributionClient::GlobalLocalDataMap::const_iterator itbIndex = globalLocalIndexSendToServer.begin(), itIndex, 1248 iteIndex = globalLocalIndexSendToServer.end(); 1249 itIndex = itbIndex; 1255 1250 1256 1251 if (!doGridHaveDataDistributed()) … … 1300 1295 else 1301 1296 { 1302 CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap ;1303 it GlobalMap = globalIndexOnServer_.begin();1297 CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap, itbGlobalMap; 1298 itbGlobalMap = globalIndexOnServer_.begin(), itGlobalMap; 1304 1299 iteGlobalMap = globalIndexOnServer_.end(); 1305 1306 std::map<int,std::vector<int> >localIndexTmp; 1307 std::map<int,std::vector<size_t> > globalIndexTmp; 1308 for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) 1300 1301 std::map<int,int > nbGlobalLocalTmp; 1302 for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) 1309 1303 { 1310 1304 int serverRank = itGlobalMap->first; 1311 int indexSize = itGlobalMap->second.size();1305 nbGlobalLocalTmp[serverRank] = 0; 1312 1306 const std::vector<size_t>& indexVec = itGlobalMap->second; 1307 int indexSize = indexVec.size(); 1313 1308 for (int idx = 0; idx < indexSize; ++idx) 1314 1309 { … … 1316 1311 if (iteIndex != itIndex) 1317 1312 { 1318 globalIndexTmp[serverRank].push_back(itIndex->first); 1319 localIndexTmp[serverRank].push_back(itIndex->second); 1313 ++nbGlobalLocalTmp[serverRank]; 1314 } 1315 } 1316 } 1317 1318 std::map<int,std::vector<int> >localIndexTmp; 1319 std::map<int,std::vector<size_t> > globalIndexTmp; 1320 for (std::map<int,int>::iterator it = nbGlobalLocalTmp.begin(); it != nbGlobalLocalTmp.end(); ++it) 1321 { 1322 localIndexTmp[it->first].resize(it->second); 1323 globalIndexTmp[it->first].resize(it->second); 1324 it->second = 0; 1325 } 1326 1327 for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) 1328 { 1329 int serverRank = itGlobalMap->first; 1330 const std::vector<size_t>& indexVec = itGlobalMap->second; 1331 int indexSize = indexVec.size(); 1332 int ind = 0; 1333 for (int idx = 0; idx < indexSize; ++idx) 1334 { 1335 itIndex = globalLocalIndexSendToServer.find(indexVec[idx]); 1336 if (iteIndex != itIndex) 1337 { 1338 ind = nbGlobalLocalTmp[serverRank]; 1339 globalIndexTmp[serverRank][ind] = itIndex->first; 1340 localIndexTmp[serverRank][ind] = itIndex->second; 1341 ++nbGlobalLocalTmp[serverRank]; 1320 1342 } 1321 1343 } … … 1373 1395 { 1374 1396 CContext* context = CContext::getCurrent(); 1375 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1397 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 1398 nbSrvPools = 1; 1376 1399 for (int i = 0; i < nbSrvPools; ++i) 1377 1400 {
Note: See TracChangeset
for help on using the changeset viewer.