Changeset 584 for XIOS/trunk/src/node/grid.cpp
- Timestamp:
- 04/01/15 17:52:53 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/grid.cpp
r575 r584 24 24 , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 25 25 , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_() 26 , connectedDataSize_(), connectedServerRank_() 26 27 { 27 28 setVirtualDomainGroup(); … … 34 35 , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 35 36 , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_() 37 , connectedDataSize_(), connectedServerRank_() 36 38 { 37 39 setVirtualDomainGroup(); … … 175 177 StdSize retVal; 176 178 std::map<int, StdSize> ret; 177 const std::map<int, std::vector<int> >& distribution = clientServerMap_->getLocalIndexSendToServer(); 178 std::map<int, std::vector<int> >::const_iterator it = distribution.begin(), itE = distribution.end(); 179 std::map<int, size_t >::const_iterator it = connectedDataSize_.begin(), itE = connectedDataSize_.end(); 179 180 for (; it != itE; ++it) 180 181 { 181 retVal = it->second .size();182 retVal = it->second; 182 183 retVal *= secureFactor; 183 184 ret.insert(std::make_pair<int,StdSize>(it->first, retVal)); … … 192 193 if (this->isDomainAxisChecked) return; 193 194 195 this->solveAxisRef(areAttributesChecked); 194 196 this->solveDomainRef(areAttributesChecked); 195 this->solveAxisRef(areAttributesChecked);196 197 197 198 this->isDomainAxisChecked = areAttributesChecked; … … 337 338 client->intraComm); 338 339 339 clientServerMap_->computeServerIndexMapping(clientDistribution_->getGlobalIndex(), 340 clientDistribution_->getLocalDataIndexSendToServerOnClient()); 341 340 clientServerMap_->computeServerIndexMapping(clientDistribution_->getGlobalIndex()); 342 341 const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer(); 343 std::vector<int> connectedServerRank; 344 for (std::map<int, std::vector<size_t> >::const_iterator it = globalIndexOnServer.begin(); it != globalIndexOnServer.end(); ++it) { 345 connectedServerRank.push_back(it->first); 346 } 347 nbSenders = clientServerMap_->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank); 342 const CArray<size_t,1>& globalIndexSendToServer = clientDistribution_->getGlobalDataIndexSendToServer(); 343 344 std::map<int, std::vector<size_t> >::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap; 345 itbGlobalMap = itGlobalMap = globalIndexOnServer.begin(); 346 iteGlobalMap = globalIndexOnServer.end(); 347 348 int nbGlobalIndex = globalIndexSendToServer.numElements(); 349 for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) 350 { 351 int serverRank = itGlobalMap->first; 352 std::vector<size_t>::const_iterator itbVecGlobal = (itGlobalMap->second).begin(), itVecGlobal, 353 iteVecGlobal = (itGlobalMap->second).end(); 354 for (int i = 0; i < nbGlobalIndex; ++i) 355 { 356 if (iteVecGlobal != std::find(itbVecGlobal, iteVecGlobal, globalIndexSendToServer(i))) 357 { 358 if (connectedDataSize_.end() == connectedDataSize_.find(serverRank)) 359 connectedDataSize_[serverRank] = 0; 360 else 361 ++connectedDataSize_[serverRank]; 362 } 363 } 364 } 365 366 connectedServerRank_.clear(); 367 for (std::map<int, std::vector<size_t> >::const_iterator it = globalIndexOnServer.begin(); it != globalIndexOnServer.end(); ++it) { 368 connectedServerRank_.push_back(it->first); 369 } 370 if (!connectedDataSize_.empty()) 371 { 372 connectedServerRank_.clear(); 373 for (std::map<int,size_t>::const_iterator it = connectedDataSize_.begin(); it != connectedDataSize_.end(); ++it) 374 connectedServerRank_.push_back(it->first); 375 } 376 377 nbSenders = clientServerMap_->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 348 378 349 379 // Get local data index on client … … 443 473 list< CArray<size_t,1>* > listOutIndex; 444 474 const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer(); 445 const std::map<int, std::vector<int> >& localIndexSendToServer = clientServerMap_->getLocalIndexSendToServer(); 446 447 std::map<int, std::vector<size_t> >::const_iterator iteMap, itbMap, itGlobal; 448 std::map<int, std::vector<int> >::const_iterator itLocal; 449 itbMap = itGlobal = globalIndexOnServer.begin(); 450 iteMap = globalIndexOnServer.end(); 451 itLocal = localIndexSendToServer.begin(); 475 const CArray<int,1>& localIndexSendToServer = clientDistribution_->getLocalDataIndexSendToServer(); 476 const CArray<size_t,1>& globalIndexSendToServer = clientDistribution_->getGlobalDataIndexSendToServer(); 477 478 std::map<int, std::vector<size_t> >::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap; 479 itbGlobalMap = itGlobalMap = globalIndexOnServer.begin(); 480 iteGlobalMap = globalIndexOnServer.end(); 481 482 int nbGlobalIndex = globalIndexSendToServer.numElements(); 483 std::map<int,std::vector<int> >localIndexTmp; 484 std::map<int,std::vector<size_t> > globalIndexTmp; 485 for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) 486 { 487 int serverRank = itGlobalMap->first; 488 std::vector<size_t>::const_iterator itbVecGlobal = (itGlobalMap->second).begin(), 489 iteVecGlobal = (itGlobalMap->second).end(); 490 for (int i = 0; i < nbGlobalIndex; ++i) 491 { 492 if (iteVecGlobal != std::find(itbVecGlobal, iteVecGlobal, globalIndexSendToServer(i))) 493 { 494 globalIndexTmp[serverRank].push_back(globalIndexSendToServer(i)); 495 localIndexTmp[serverRank].push_back(localIndexSendToServer(i)); 496 } 497 } 498 } 499 452 500 453 501 if (!doGridHaveDataDistributed()) 454 502 { 455 if (0 == client->clientRank)456 {457 for (int ns = 0; itGlobal != iteMap; ++itGlobal, ++itLocal, ++ns)458 {459 rank = itGlobal->first;460 int nb = (itGlobal->second).size();461 462 CArray<size_t, 1> outGlobalIndexOnServer(nb);463 CArray<int, 1> outLocalIndexToServer(nb);464 for (int k = 0; k < nb; ++k)465 {466 outGlobalIndexOnServer(k) = itGlobal->second.at(k);467 outLocalIndexToServer(k) = itLocal->second.at(k);468 }469 470 storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(outLocalIndexToServer) ));471 listOutIndex.push_back(new CArray<size_t,1>(outGlobalIndexOnServer));472 473 list_msg.push_back(shared_ptr<CMessage>(new CMessage));474 *list_msg.back()<<getId()<<*listOutIndex.back();475 event.push(rank, 1, *list_msg.back());476 }477 client->sendEvent(event);478 } else client->sendEvent(event);503 // if (0 == client->clientRank) 504 // { 505 // for (int ns = 0; itGlobal != iteMap; ++itGlobal, ++itLocal, ++ns) 506 // { 507 // rank = itGlobal->first; 508 // int nb = (itGlobal->second).size(); 509 // 510 // CArray<size_t, 1> outGlobalIndexOnServer(nb); 511 // CArray<int, 1> outLocalIndexToServer(nb); 512 // for (int k = 0; k < nb; ++k) 513 // { 514 // outGlobalIndexOnServer(k) = itGlobal->second.at(k); 515 // outLocalIndexToServer(k) = itLocal->second.at(k); 516 // } 517 // 518 // storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(outLocalIndexToServer) )); 519 // listOutIndex.push_back(new CArray<size_t,1>(outGlobalIndexOnServer)); 520 // 521 // list_msg.push_back(shared_ptr<CMessage>(new CMessage)); 522 // *list_msg.back()<<getId()<<*listOutIndex.back(); 523 // event.push(rank, 1, *list_msg.back()); 524 // } 525 // client->sendEvent(event); 526 // } else client->sendEvent(event); 479 527 } 480 528 else 481 529 { 482 for (int ns = 0; itGlobal != iteMap; ++itGlobal, ++itLocal, ++ns) 483 { 484 rank = itGlobal->first; 485 int nb = (itGlobal->second).size(); 530 for (int ns = 0; ns < connectedServerRank_.size(); ++ns) 531 { 532 rank = connectedServerRank_[ns]; 533 int nb = 0; 534 if (globalIndexTmp.end() != globalIndexTmp.find(rank)) 535 nb = globalIndexTmp[rank].size(); 486 536 487 537 CArray<size_t, 1> outGlobalIndexOnServer(nb); … … 489 539 for (int k = 0; k < nb; ++k) 490 540 { 491 outGlobalIndexOnServer(k) = itGlobal->second.at(k);492 outLocalIndexToServer(k) = itLocal->second.at(k);541 outGlobalIndexOnServer(k) = globalIndexTmp[rank].at(k); 542 outLocalIndexToServer(k) = localIndexTmp[rank].at(k); 493 543 } 494 544 … … 498 548 list_msg.push_back(shared_ptr<CMessage>(new CMessage)); 499 549 *list_msg.back()<<getId()<<*listOutIndex.back(); 550 500 551 event.push(rank, nbSenders[rank], *list_msg.back()); 501 552 } 553 502 554 client->sendEvent(event); 503 555 } … … 555 607 bool CGrid::doGridHaveDataToWrite() 556 608 { 557 return (0 != serverDistribution_); 609 // return (0 != serverDistribution_); 610 return (0 != writtenDataSize_); 558 611 } 559 612
Note: See TracChangeset
for help on using the changeset viewer.