Ignore:
Timestamp:
01/20/17 16:17:57 (7 years ago)
Author:
oabramkina
Message:

dev: intermediate commit.

File:
1 edited

Legend:

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

    r1027 r1030  
    273273   { 
    274274     CContext* context = CContext::getCurrent(); 
    275      int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    276  
     275     // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     276     int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1;    
     277     nbSrvPools = 1;   
    277278     for (int i = 0; i < nbSrvPools; ++i) 
    278      { 
    279        CContextClient* client= context->hasServer ? context->clientPrimServer[i] : context->client; 
     279     {        
    280280       if (isScalarGrid()) 
    281        { 
    282          // if (context->hasClient && !context->hasServer) 
    283         if (context->hasClient) 
    284           if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndexScalarGrid(); this->isIndexSent = true; } 
    285  
    286          if (this->isChecked) return; 
    287          // if (context->hasClient && !context->hasServer) 
    288          if (context->hasClient) 
    289          { 
    290           this->computeIndexScalarGrid(); 
    291          } 
    292  
    293   //         this->isChecked = true; 
    294            if (!(this->hasTransform() && !this->isTransformed())) 
    295             this->isChecked = true; 
    296          return; 
    297        } 
    298  
    299        // if (context->hasClient && !context->hasServer) 
    300       // if (context->hasClient) 
    301       //   if (doSendingIndex && !isIndexSent) 
    302         { 
    303         if (context->hasClient) 
    304         { 
    305           if (this->isChecked && doSendingIndex && !isIndexSent) 
    306             {sendIndex(); this->isIndexSent = true;} 
    307         } 
    308  
    309         if (this->isChecked) return; 
    310         this->checkAttributesAfterTransformation(); 
    311         this->checkMask(); 
    312         this->computeIndex(); 
    313     //       this->isChecked = true; 
     281       {   
     282          if (context->hasClient) 
     283            if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndexScalarGrid(); this->isIndexSent = true; } 
     284 
     285          if (this->isChecked) continue; 
     286   
     287          if (context->hasClient) 
     288          { 
     289            this->computeIndexScalarGrid(); 
     290          } 
     291   
    314292         if (!(this->hasTransform() && !this->isTransformed())) 
    315293          this->isChecked = true; 
    316  
    317          if (!(this->hasTransform() && (!this->isGenerated()))) 
    318           this->isChecked = true; 
    319  
    320  
    321         } 
    322  
    323       //  if (this->isChecked) return; 
    324  
    325       //  // if (context->hasClient && !context->hasServer) 
    326       // // if (context->hasClient) 
    327       //  { 
    328       //     this->checkAttributesAfterTransformation(); 
    329       //     this->checkMask(); 
    330       //     this->computeIndex(); 
    331       //  } 
    332       //  this->isChecked = true; 
    333       } 
     294         continue; 
     295       } 
     296 
     297       if (context->hasClient) 
     298       { 
     299         if (this->isChecked && doSendingIndex && !isIndexSent) 
     300            {sendIndex(); this->isIndexSent = true;} 
     301       } 
     302     } 
     303     
     304     if (this->isChecked) return; 
     305     this->checkAttributesAfterTransformation(); 
     306     this->checkMask(); 
     307     this->computeIndex(); 
     308 
     309     if (!(this->hasTransform() && !this->isTransformed())) 
     310      this->isChecked = true; 
     311 
     312     if (!(this->hasTransform() && (!this->isGenerated()))) 
     313      this->isChecked = true; 
    334314   } 
    335315 
     
    521501     CContext* context = CContext::getCurrent(); 
    522502 
    523      int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     503     // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     504     // int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
     505     // This needs to change one day 
     506     // It works only for the same number of procs on secondary pools 
     507     int nbSrvPools = 1;  
     508 
    524509     for (int i = 0; i < nbSrvPools; ++i) 
    525510     { 
    526        CContextClient* client = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    527        CContextServer* server = (context->hasServer) ? context->server : 0 ; 
    528        int rank = (server && !client) ? server->intraCommRank : client->clientRank; 
     511       CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[i] : context->client) : context->client; 
     512       // CContextClient* client = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
     513       // CContextServer* server = (context->hasServer) ? context->server : 0 ; 
     514       // int rank = (server && !client) ? server->intraCommRank : client->clientRank; 
     515       int rank = client->clientRank; 
    529516 
    530517       // First of all, compute distribution on client side 
     
    538525       int nbStoreIndex = storeIndex_client.numElements(); 
    539526       for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 
    540        isDataDistributed_= clientDistribution_->isDataDistributed(); 
    541      } 
     527       if (0 == serverDistribution_)  
     528        isDataDistributed_= clientDistribution_->isDataDistributed(); 
     529      } 
    542530   } 
    543531 
     
    545533   { 
    546534     CContext* context = CContext::getCurrent(); 
    547      int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     535     // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     536     int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
     537     // int nbSrvPools = 1; 
    548538     for (int i = 0; i < nbSrvPools; ++i) 
    549539     { 
     
    636626     // isDataDistributed_= clientDistribution_->isDataDistributed(); 
    637627 
    638      int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    639      for (int i = 0; i < nbSrvPools; ++i) 
    640      { 
    641        CContextClient* client = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    642        computeClientIndex(); 
    643        if (context->hasClient) 
    644         computeConnectedClients(); 
    645          } 
     628     // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     629 
     630     computeClientIndex(); 
     631     if (context->hasClient) 
     632      computeConnectedClients(); 
     633 
    646634 
    647635     // connectedServerRank_.clear(); 
     
    715703   { 
    716704     CContext* context = CContext::getCurrent(); 
    717      int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     705     // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     706     int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
     707     nbSrvPools = 1; 
    718708     for (int i = 0; i < nbSrvPools; ++i) 
    719709     { 
     
    11091099   void CGrid::restoreField_arr(const CArray<double, 1>& stored, double* const data) const 
    11101100   { 
    1111       // const StdSize size = storeIndex_client.numElements(); 
    1112  
    1113       // for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i); 
    1114        
    1115       const StdSize size = indexFromClients.numElements(); 
    1116  
    1117       for(StdSize i = 0; i < size; i++) data[indexFromClients(i)] = stored(i); 
     1101      const StdSize size = storeIndex_client.numElements(); 
     1102 
     1103      for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i); 
     1104 
     1105     // This is a solution for multilevel server       
     1106      // const StdSize size = indexFromClients.numElements(); 
     1107 
     1108      // for(StdSize i = 0; i < size; i++) data[indexFromClients(i)] = stored(i); 
    11181109 
    11191110   } 
     
    11221113  { 
    11231114    CContext* context = CContext::getCurrent(); 
    1124     int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     1115    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     1116    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    11251117    for (int i = 0; i < nbSrvPools; ++i) 
    11261118    { 
     
    11821174  { 
    11831175    CContext* context = CContext::getCurrent(); 
    1184     int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     1176    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     1177    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 
    11851178    for (int i = 0; i < nbSrvPools; ++i) 
    11861179    { 
     
    12411234    CContext* context = CContext::getCurrent(); 
    12421235//    CContextClient* client = context->client; 
    1243     int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     1236    // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     1237    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    12441238    for (int i = 0; i < nbSrvPools; ++i) 
    12451239    { 
     
    12511245      list<CArray<size_t,1> > listOutIndex; 
    12521246      const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer(); 
    1253       CDistributionClient::GlobalLocalDataMap::const_iterator itIndex = globalLocalIndexSendToServer.begin(), 
    1254                                                              iteIndex = globalLocalIndexSendToServer.end(); 
     1247      CDistributionClient::GlobalLocalDataMap::const_iterator itbIndex = globalLocalIndexSendToServer.begin(), itIndex, 
     1248                                                              iteIndex = globalLocalIndexSendToServer.end(); 
     1249      itIndex = itbIndex;                                                               
    12551250 
    12561251      if (!doGridHaveDataDistributed()) 
     
    13001295      else 
    13011296      { 
    1302         CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap; 
    1303         itGlobalMap = globalIndexOnServer_.begin(); 
     1297        CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap, itbGlobalMap; 
     1298        itbGlobalMap = globalIndexOnServer_.begin(), itGlobalMap; 
    13041299        iteGlobalMap = globalIndexOnServer_.end(); 
    1305  
    1306         std::map<int,std::vector<int> >localIndexTmp; 
    1307         std::map<int,std::vector<size_t> > globalIndexTmp; 
    1308         for (; itGlobalMap != iteGlobalMap; ++itGlobalMap) 
     1300         
     1301        std::map<int,int > nbGlobalLocalTmp; 
     1302        for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) 
    13091303        { 
    13101304          int serverRank = itGlobalMap->first; 
    1311           int indexSize = itGlobalMap->second.size(); 
     1305          nbGlobalLocalTmp[serverRank] = 0; 
    13121306          const std::vector<size_t>& indexVec = itGlobalMap->second; 
     1307          int indexSize = indexVec.size();           
    13131308          for (int idx = 0; idx < indexSize; ++idx) 
    13141309          { 
     
    13161311            if (iteIndex != itIndex) 
    13171312            { 
    1318               globalIndexTmp[serverRank].push_back(itIndex->first); 
    1319               localIndexTmp[serverRank].push_back(itIndex->second); 
     1313              ++nbGlobalLocalTmp[serverRank]; 
     1314            } 
     1315          } 
     1316        } 
     1317 
     1318        std::map<int,std::vector<int> >localIndexTmp; 
     1319        std::map<int,std::vector<size_t> > globalIndexTmp; 
     1320        for (std::map<int,int>::iterator it = nbGlobalLocalTmp.begin(); it != nbGlobalLocalTmp.end(); ++it) 
     1321        { 
     1322          localIndexTmp[it->first].resize(it->second); 
     1323          globalIndexTmp[it->first].resize(it->second); 
     1324          it->second = 0; 
     1325        } 
     1326 
     1327        for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) 
     1328        { 
     1329          int serverRank = itGlobalMap->first;           
     1330          const std::vector<size_t>& indexVec = itGlobalMap->second; 
     1331          int indexSize = indexVec.size();           
     1332          int ind = 0; 
     1333          for (int idx = 0; idx < indexSize; ++idx) 
     1334          { 
     1335            itIndex = globalLocalIndexSendToServer.find(indexVec[idx]); 
     1336            if (iteIndex != itIndex) 
     1337            {               
     1338              ind = nbGlobalLocalTmp[serverRank]; 
     1339              globalIndexTmp[serverRank][ind] = itIndex->first; 
     1340              localIndexTmp[serverRank][ind]  = itIndex->second; 
     1341              ++nbGlobalLocalTmp[serverRank]; 
    13201342            } 
    13211343          } 
     
    13731395  { 
    13741396    CContext* context = CContext::getCurrent(); 
    1375     int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     1397    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
     1398    nbSrvPools = 1; 
    13761399    for (int i = 0; i < nbSrvPools; ++i) 
    13771400    { 
Note: See TracChangeset for help on using the changeset viewer.