Ignore:
Timestamp:
04/01/15 17:52:53 (9 years ago)
Author:
mhnguyen
Message:

Implementing new hash algorithm and fixing bug related to zoom

+) Replace boost hash with hash algorithm of Jenkins
+) Domain, if an attribute is non-empty for one client, it should also be non-empty for others inspite of zoom
+) Replace the way to find the number of client connecting to a server to make sure every server receive a message

Test
+) On Curie
+) test_client: passed and results are same like before
+) test_complete: passed, results are partially the same, the different part comes from added working operation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/grid.cpp

    r575 r584  
    2424      , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 
    2525      , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_() 
     26      , connectedDataSize_(), connectedServerRank_() 
    2627   { 
    2728     setVirtualDomainGroup(); 
     
    3435      , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 
    3536      , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_() 
     37      , connectedDataSize_(), connectedServerRank_() 
    3638   { 
    3739     setVirtualDomainGroup(); 
     
    175177     StdSize retVal; 
    176178     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(); 
    179180     for (; it != itE; ++it) 
    180181     { 
    181         retVal = it->second.size(); 
     182        retVal = it->second; 
    182183        retVal *= secureFactor; 
    183184        ret.insert(std::make_pair<int,StdSize>(it->first, retVal)); 
     
    192193     if (this->isDomainAxisChecked) return; 
    193194 
     195     this->solveAxisRef(areAttributesChecked); 
    194196     this->solveDomainRef(areAttributesChecked); 
    195      this->solveAxisRef(areAttributesChecked); 
    196197 
    197198     this->isDomainAxisChecked = areAttributesChecked; 
     
    337338                                                            client->intraComm); 
    338339 
    339      clientServerMap_->computeServerIndexMapping(clientDistribution_->getGlobalIndex(), 
    340                                                  clientDistribution_->getLocalDataIndexSendToServerOnClient()); 
    341  
     340     clientServerMap_->computeServerIndexMapping(clientDistribution_->getGlobalIndex()); 
    342341     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_); 
    348378 
    349379     // Get local data index on client 
     
    443473    list< CArray<size_t,1>* > listOutIndex; 
    444474    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 
    452500 
    453501    if (!doGridHaveDataDistributed()) 
    454502    { 
    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); 
    479527    } 
    480528    else 
    481529    { 
    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(); 
    486536 
    487537        CArray<size_t, 1> outGlobalIndexOnServer(nb); 
     
    489539        for (int k = 0; k < nb; ++k) 
    490540        { 
    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); 
    493543        } 
    494544 
     
    498548        list_msg.push_back(shared_ptr<CMessage>(new CMessage)); 
    499549        *list_msg.back()<<getId()<<*listOutIndex.back(); 
     550 
    500551        event.push(rank, nbSenders[rank], *list_msg.back()); 
    501552      } 
     553 
    502554      client->sendEvent(event); 
    503555    } 
     
    555607  bool CGrid::doGridHaveDataToWrite() 
    556608  { 
    557     return (0 != serverDistribution_); 
     609//    return (0 != serverDistribution_); 
     610    return (0 != writtenDataSize_); 
    558611  } 
    559612 
Note: See TracChangeset for help on using the changeset viewer.