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/domain.cpp

    r569 r584  
    2323   CDomain::CDomain(void) 
    2424      : CObjectTemplate<CDomain>(), CDomainAttributes() 
    25       , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_() 
     25      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 
    2626   { /* Ne rien faire de plus */ } 
    2727 
    2828   CDomain::CDomain(const StdString & id) 
    2929      : CObjectTemplate<CDomain>(id), CDomainAttributes() 
    30       , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_() 
     30      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 
    3131         { /* Ne rien faire de plus */ } 
    3232 
     
    449449      StdSize dm = zoom_ni_client * zoom_nj_client; 
    450450 
    451       lonvalue.resize(dm); 
    452       latvalue.resize(dm); 
     451      // Make sure that this attribute is non-empty for every client. 
     452      if (0 != dm) 
     453      { 
     454        lonvalue.resize(dm); 
     455        latvalue.resize(dm); 
     456      } 
     457 
    453458 
    454459      for (int i = 0; i < zoom_ni_client; i++) 
     
    668673    int zoom_jend=zoom_jbegin+zoom_nj-1 ; 
    669674 
    670  
    671675    // Precompute number of index 
    672     int globalIndexCount = 0; 
     676    int globalIndexCountZoom = 0; 
    673677    for(j=0;j<nj;j++) 
    674678      for(i=0;i<ni;i++) 
     
    679683        if (i_ind >= zoom_ibegin && i_ind <= zoom_iend && j_ind >= zoom_jbegin && j_ind <= zoom_jend) 
    680684        { 
    681           ++globalIndexCount; 
     685          ++globalIndexCountZoom; 
    682686        } 
    683687      } 
    684688 
    685689    // Fill in index 
    686     CArray<size_t,1> globalIndexDomain(globalIndexCount); 
     690    CArray<size_t,1> globalIndexDomainZoom(globalIndexCountZoom); 
     691    CArray<size_t,1> globalIndexDomain(ni*nj); 
    687692    size_t globalIndex; 
    688     globalIndexCount = 0; 
     693    int globalIndexCount = 0; 
     694    globalIndexCountZoom = 0; 
    689695 
    690696    for(j=0;j<nj;j++) 
     
    694700        j_ind=jbegin+j_index(i,j) ; 
    695701 
     702        globalIndex = i_ind + j_ind * ni_glo; 
     703        globalIndexDomain(globalIndexCount) = globalIndex; 
     704        ++globalIndexCount; 
    696705        if (i_ind >= zoom_ibegin && i_ind <= zoom_iend && j_ind >= zoom_jbegin && j_ind <= zoom_jend) 
    697706        { 
    698           globalIndex = i_ind + j_ind * ni_glo; 
    699           globalIndexDomain(globalIndexCount) = globalIndex; 
    700           ++globalIndexCount; 
     707          globalIndexDomainZoom(globalIndexCountZoom) = globalIndex; 
     708          ++globalIndexCountZoom; 
    701709        } 
    702710      } 
     
    724732    clientServerMap->computeServerIndexMapping(globalIndexDomain); 
    725733    const std::map<int, std::vector<size_t> >& globalIndexDomainOnServer = clientServerMap->getGlobalIndexOnServer(); 
    726     std::vector<int> connectedServerRank; 
    727     for (std::map<int, std::vector<size_t> >::const_iterator it = globalIndexDomainOnServer.begin(); it != globalIndexDomainOnServer.end(); ++it) { 
    728       connectedServerRank.push_back(it->first); 
     734 
     735    std::map<int, std::vector<size_t> >::const_iterator it = globalIndexDomainOnServer.begin(), 
     736                                                       ite = globalIndexDomainOnServer.end(); 
     737    indSrv_.clear(); 
     738    for (; it != ite; ++it) 
     739    { 
     740      int rank = it->first; 
     741      std::vector<size_t>::const_iterator itbVec  = (it->second).begin(), 
     742                                           iteVec = (it->second).end(); 
     743      int nb = globalIndexDomainZoom.numElements(); 
     744      for (int i = 0; i < nb; ++i) 
     745      { 
     746        if (std::binary_search(itbVec, iteVec, globalIndexDomainZoom(i))) 
     747        { 
     748          indSrv_[rank].push_back(globalIndexDomainZoom(i)); 
     749        } 
     750      } 
    729751    } 
    730     nbConnectedClients_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank); 
    731     indSrv_ = globalIndexDomainOnServer; 
     752 
     753    connectedServerRank_.clear(); 
     754    for (it = globalIndexDomainOnServer.begin(); it != ite; ++it) { 
     755      connectedServerRank_.push_back(it->first); 
     756    } 
     757 
     758    if (!indSrv_.empty()) 
     759    { 
     760      connectedServerRank_.clear(); 
     761      for (it = indSrv_.begin(); it != indSrv_.end(); ++it) 
     762        connectedServerRank_.push_back(it->first); 
     763    } 
     764    nbConnectedClients_ = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 
    732765 
    733766    delete clientServerMap; 
     
    753786    itbMap = indSrv_.begin(); 
    754787    iteMap = indSrv_.end(); 
    755     for (it = itbMap; it != iteMap; ++it) 
     788    for (int k = 0; k < connectedServerRank_.size(); ++k) 
    756789    { 
    757       int rank = it->first; 
    758       int nbData = (it->second).size(); 
     790      int nbData = 0; 
     791      int rank = connectedServerRank_[k]; 
     792      it = indSrv_.find(rank); 
     793      if (iteMap != it) 
     794        nbData = (it->second).size(); 
     795 
    759796      CArray<int,1> indi(nbData) ; 
    760797      CArray<int,1> indj(nbData) ; 
     
    807844        *list_msgLat.back()<<*list_boundslat.back(); 
    808845      } 
     846 
    809847      eventLon.push(rank,nbConnectedClients_[rank],*list_msgLon.back()) ; 
    810848      eventLat.push(rank,nbConnectedClients_[rank],*list_msgLat.back()) ; 
Note: See TracChangeset for help on using the changeset viewer.