Ignore:
Timestamp:
02/11/15 16:23:12 (9 years ago)
Author:
mhnguyen
Message:

Seperating global index computation on client and server side

+) Create a class which do mapping in general manner, between client and server index global
+) Remove some redundant functions and variables
+) Add some comments to code

Test
+) On Curie. Only test_new_features.f90
+) Test passes and results are correct.
+) Need to change index from 1 to 0

File:
1 edited

Legend:

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

    r552 r553  
    2323      , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1), isDomConServerComputed_(false) 
    2424      , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 
    25       , serverDistribution_(0) 
     25      , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_() 
    2626   { 
    2727     setVirtualDomainGroup(); 
     
    3434      , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1), isDomConServerComputed_(false) 
    3535      , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 
    36       , serverDistribution_(0) 
     36      , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_() 
    3737   { 
    3838     setVirtualDomainGroup(); 
     
    5959    if (0 != clientDistribution_) delete clientDistribution_; 
    6060    if (0 != serverDistribution_) delete serverDistribution_; 
     61    if (0 != serverDistributionDescription_) delete serverDistributionDescription_; 
    6162 
    6263   } 
     
    187188     StdSize retVal; 
    188189     std::map<int, StdSize> ret; 
    189      const std::map<int, std::vector<int> >& distribution = clientDistribution_->getLocalIndexSendToServer(); 
     190     const std::map<int, std::vector<int> >& distribution = clientServerMap_.getLocalIndexSendToServer(); 
    190191     std::map<int, std::vector<int> >::const_iterator it = distribution.begin(), itE = distribution.end(); 
    191192     for (; it != itE; ++it) 
     
    405406     CContext* context = CContext::getCurrent() ; 
    406407     CContextClient* client=context->client ; 
     408 
     409     // First of all, compute distribution on client side 
    407410     clientDistribution_ = new CDistributionClient(client->clientRank, this); 
    408      clientDistribution_->computeServerIndexMapping(client->serverSize); 
    409      nbSenders = clientDistribution_->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm); 
    410  
     411 
     412     // Then compute distribution on server side 
     413     serverDistributionDescription_ = new CServerDistributionDescription(clientDistribution_->getNGlob()); 
     414     serverDistributionDescription_->computeServerDistribution(client->serverSize, true); 
     415 
     416     // Finally, compute index mapping between client(s) and server(s) 
     417     clientServerMap_.computeServerIndexMapping(clientDistribution_->getGlobalIndex(),serverDistributionDescription_->getGlobalIndex()); 
     418     const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientServerMap_.getGlobalIndexOnServer(); 
     419     std::vector<int> connectedServerRank; 
     420     for (std::map<int, std::vector<size_t> >::const_iterator it = globalIndexOnServer.begin(); it != globalIndexOnServer.end(); ++it) { 
     421       connectedServerRank.push_back(it->first); 
     422     } 
     423     nbSenders = clientServerMap_.computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank); 
     424 
     425     // Get local data index on client 
    411426     storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().numElements()); 
    412427     storeIndex_client = (clientDistribution_->getLocalDataIndexOnClient()); 
     
    715730    list<shared_ptr<CMessage> > list_msg ; 
    716731    list< CArray<size_t,1>* > listOutIndex; 
    717  
    718     const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientDistribution_->getGlobalIndexOnServer(); 
    719     const std::map<int, std::vector<int> >& localIndexSendToServer  = clientDistribution_->getLocalIndexSendToServer(); 
     732    const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientServerMap_.getGlobalIndexOnServer(); 
     733    const std::map<int, std::vector<int> >& localIndexSendToServer  = clientServerMap_.getLocalIndexSendToServer(); 
    720734 
    721735    std::map<int, std::vector<size_t> >::const_iterator iteMap, itbMap, itGlobal; 
     
    724738    iteMap = globalIndexOnServer.end(); 
    725739    itLocal = localIndexSendToServer.begin(); 
    726  
    727740 
    728741    for (int ns = 0; itGlobal != iteMap; ++itGlobal, ++itLocal, ++ns) 
Note: See TracChangeset for help on using the changeset viewer.