Ignore:
Timestamp:
05/17/17 18:30:38 (7 years ago)
Author:
mhnguyen
Message:

Reading for two-level server

+) Update reading with the changes of grid distribution
+) Correct a minor bug on modification grid mask
+) Do some code cleaning

Test
+) On Curie
+) Work in both mode: classical and two-level
+) Push some *.nc for test_remap

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/node/grid.cpp

    r1132 r1136  
    409409      using namespace std; 
    410410      std::vector<CDomain*> domainP = this->getDomains(); 
    411       std::vector<CAxis*> axisP = this->getAxis(); 
     411      std::vector<CAxis*> axisP = this->getAxis();       
    412412      int dim = domainP.size() * 2 + axisP.size(); 
    413413 
     
    442442   {       
    443443      std::vector<CDomain*> domainP = this->getDomains(); 
    444       std::vector<CAxis*> axisP = this->getAxis(); 
     444      std::vector<CAxis*> axisP = this->getAxis();             
    445445      int dim = domainP.size() * 2 + axisP.size(); 
    446446 
     
    591591     { 
    592592       CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) : context->client; 
    593        // CContextClient* client = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    594        // CContextServer* server = (context->hasServer) ? context->server : 0 ; 
    595        // int rank = (server && !client) ? server->intraCommRank : client->clientRank; 
    596593       int rank = client->clientRank; 
    597594 
    598        // First of all, compute distribution on client side 
    599        // if (0 != serverDistribution_) 
    600        // { 
    601        //   // clientDistribution_ = new CDistributionClient(rank, this, serverDistribution_->getGlobalLocalIndex()); 
    602        //   clientDistribution_ = new CDistributionClient(rank, this); 
    603        //   storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size()); 
    604        //   // storeIndex_client.resize(serverDistribution_->getGridSize()); 
    605        //   int nbStoreIndex = storeIndex_client.numElements(); 
    606        //   for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = idx; 
    607        // } 
    608        // else 
    609        // { 
    610595         clientDistribution_ = new CDistributionClient(rank, this); 
    611596         // Get local data index on client 
     
    665650   } 
    666651 
     652   /*! 
     653     Compute the connected clients and index to send to these clients. 
     654     Each client can connect to a pool of other clients, each of which can have a piece of information of a grid 
     655 
     656   */ 
    667657   void CGrid::computeConnectedClients() 
    668658   { 
    669659     CContext* context = CContext::getCurrent(); 
    670      // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    671660     int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    672661     connectedServerRank_.resize(nbSrvPools); 
     
    747736   { 
    748737     CContext* context = CContext::getCurrent(); 
    749 //     CContextClient* client = context->client; 
    750      // CContextClient* client = (context->hasServer) ? context->clientPrimServer : context->client; 
    751       
    752  
    753      // // First of all, compute distribution on client side 
    754      // if (0 != serverDistribution_) 
    755      //   clientDistribution_ = new CDistributionClient(client->clientRank, this, serverDistribution_->getGlobalLocalIndex()); 
    756      // else 
    757      //   clientDistribution_ = new CDistributionClient(client->clientRank, this); 
    758  
    759      // // Get local data index on client 
    760      // int tmp = clientDistribution_->getLocalDataIndexOnClient().size(); 
    761      // storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size()); 
    762      // int nbStoreIndex = storeIndex_client.numElements(); 
    763      // for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 
    764      // isDataDistributed_= clientDistribution_->isDataDistributed(); 
    765  
    766  
    767      // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    768  
    769738     computeClientIndex(); 
    770739     if (context->hasClient) 
     
    772741       computeConnectedClients(); 
    773742     } 
    774  
    775      // connectedServerRank_.clear(); 
    776  
    777      // if (!doGridHaveDataDistributed()) 
    778      // { 
    779      //    if (client->isServerLeader()) 
    780      //    { 
    781      //      size_t ssize = clientDistribution_->getLocalDataIndexOnClient().size(); 
    782      //      const std::list<int>& ranks = client->getRanksServerLeader(); 
    783      //      for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    784      //      { 
    785      //        connectedServerRank_.push_back(*itRank); 
    786      //        connectedDataSize_[*itRank] = ssize; 
    787      //      } 
    788      //    } 
    789      //    return; 
    790      // } 
    791  
    792      // // Compute mapping between client and server 
    793      // std::vector<boost::unordered_map<size_t,std::vector<int> > > indexServerOnElement; 
    794      // CServerDistributionDescription serverDistributionDescription(globalDim_, client->serverSize); 
    795      // serverDistributionDescription.computeServerGlobalByElement(indexServerOnElement, 
    796      //                                                            client->clientRank, 
    797      //                                                            client->clientSize, 
    798      //                                                            axis_domain_order, 
    799      //                                                            positionDimensionDistributed_); 
    800      // computeIndexByElement(indexServerOnElement, globalIndexOnServer_); 
    801  
    802      // const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer(); 
    803      // CDistributionClient::GlobalLocalDataMap::const_iterator iteGlobalLocalIndexMap = globalLocalIndexSendToServer.end(), itGlobalLocalIndexMap; 
    804      // CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap; 
    805      // itGlobalMap  = itbGlobalMap = globalIndexOnServer_.begin(); 
    806      // iteGlobalMap = globalIndexOnServer_.end(); 
    807  
    808      // for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) 
    809      // { 
    810      //   int serverRank = itGlobalMap->first; 
    811      //   int indexSize = itGlobalMap->second.size(); 
    812      //   const std::vector<size_t>& indexVec = itGlobalMap->second; 
    813      //   for (int idx = 0; idx < indexSize; ++idx) 
    814      //   { 
    815      //      itGlobalLocalIndexMap = globalLocalIndexSendToServer.find(indexVec[idx]); 
    816      //      if (iteGlobalLocalIndexMap != itGlobalLocalIndexMap) 
    817      //      { 
    818      //         if (connectedDataSize_.end() == connectedDataSize_.find(serverRank)) 
    819      //           connectedDataSize_[serverRank] = 1; 
    820      //         else 
    821      //           ++connectedDataSize_[serverRank]; 
    822      //      } 
    823      //   } 
    824      // } 
    825  
    826      // for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) { 
    827      //   connectedServerRank_.push_back(itGlobalMap->first); 
    828      // } 
    829  
    830      // nbSenders = clientServerMap_->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 
    831743   } 
    832744 
     
    950862 
    951863       nbIndexOnServer = 0; 
    952 //       for (it = itb; it != ite; ++it) 
    953864       for (size_t j = 0; j < globalIndexElementOnServerMap.size(); ++j) 
    954865       { 
     
    15851496    nbSrvPools = 1; 
    15861497    // connectedServerRank_.resize(nbSrvPools); 
    1587     // nbSenders.resize(nbSrvPools); 
     1498    nbReadSenders.resize(nbSrvPools); 
    15881499    for (int p = 0; p < nbSrvPools; ++p) 
    15891500    { 
    15901501      CContextServer* server = (!context->hasClient) ? context->server : context->serverPrimServer[p]; 
    15911502      CContextClient* client = (!context->hasClient) ? context->client : context->clientPrimServer[p]; 
     1503       
    15921504//      CContextServer* server = (context->hasServer) ? context->server : context->serverPrimServer[p]; 
    15931505//      CContextClient* client = (context->hasServer) ? context->client : context->clientPrimServer[p]; 
     
    16991611        std::vector<CDomain*> domainList = getDomains(); 
    17001612        std::vector<CAxis*> axisList = getAxis(); 
    1701         std::vector<int> nBegin(ssize), nSize(ssize), nGlob(ssize), nBeginGlobal(ssize);         
     1613        int dimSize = 2 * domainList.size() + axisList.size(); 
     1614        std::vector<int> nBegin(dimSize), nSize(dimSize), nGlob(dimSize), nBeginGlobal(dimSize);         
    17021615        for (int i = 0; i < numElement; ++i) 
    17031616        {           
     
    17261639          else // scalar 
    17271640          {  
    1728             nBegin[indexMap[i]] = 0; 
    1729             nSize[indexMap[i]]  = 1; 
    1730             nBeginGlobal[indexMap[i]] = 0;               
    1731             nGlob[indexMap[i]] = 1; 
    1732  
    1733             ++scalarId; 
    17341641          } 
    17351642        } 
     
    17821689        totalNumberWrittenIndexes_ = numberWrittenIndexes_; 
    17831690 
    1784       // nbSenders[p] = CClientServerMappingDistributed::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, ranks); 
     1691      nbReadSenders[p] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); 
    17851692    } 
    17861693  } 
Note: See TracChangeset for help on using the changeset viewer.