Ignore:
Timestamp:
07/10/17 15:16:17 (7 years ago)
Author:
mhnguyen
Message:

Porting non-continuous axis zoom to dev branch

+) Port axis zoom
+) Resolve some merge conflicts
+) Revert some codes

Test
+) On Curie
+) Ok

File:
1 edited

Legend:

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

    r1201 r1202  
    287287     nbSrvPools = 1;   
    288288     for (int p = 0; p < nbSrvPools; ++p) 
    289      {        
    290        if (isScalarGrid()) 
    291        {   
    292           if (context->hasClient) 
    293             if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndexScalarGrid(); this->isIndexSent = true; } 
    294  
    295           if (this->isChecked) continue; 
    296    
    297           if (context->hasClient) 
    298           { 
    299             this->computeIndexScalarGrid(); 
    300           } 
    301    
    302          if (!(this->hasTransform() && !this->isTransformed())) 
    303           this->isChecked = true; 
    304          continue; 
     289     {     
     290       if (context->hasClient && this->isChecked && doSendingIndex && !isIndexSent)  
     291       {  
     292         if (isScalarGrid()) 
     293           sendIndexScalarGrid(); 
     294         else 
     295           sendIndex(); 
     296         this->isIndexSent = true;  
    305297       } 
    306298 
    307        if (context->hasClient) 
    308        { 
    309          if (this->isChecked && doSendingIndex && !isIndexSent) 
    310             {sendIndex(); this->isIndexSent = true;} 
    311        } 
     299       // Not sure about this 
     300       //if (!(this->hasTransform() && !this->isTransformed())) 
     301       // this->isChecked = true; 
     302       //return; 
    312303     } 
    313304     
     
    546537      if (computedWrittenIndex_) return; 
    547538      computedWrittenIndex_ = true; 
     539 
     540      if (isScalarGrid()) 
     541      { 
     542        size_t nbWritten = 1; 
     543        int writtenIndex = 0; 
     544 
     545        localIndexToWriteOnClient.resize(nbWritten);   
     546        localIndexToWriteOnServer.resize(nbWritten); 
     547        localIndexToWriteOnServer(0) = writtenIndex; 
     548        localIndexToWriteOnClient(0) = writtenIndex; 
     549         
     550        return; 
     551      } 
    548552 
    549553      size_t nbWritten = 0, indGlo; 
     
    746750   { 
    747751     CContext* context = CContext::getCurrent(); 
    748      computeClientIndex(); 
    749      if (context->hasClient) 
     752     if (isScalarGrid()) 
    750753     { 
    751        computeConnectedClients(); 
     754       computeClientIndexScalarGrid(); 
     755       if (context->hasClient) 
     756       { 
     757         computeConnectedClientsScalarGrid(); 
     758       } 
     759     } 
     760     else 
     761     { 
     762       computeClientIndex(); 
     763       if (context->hasClient) 
     764       { 
     765         computeConnectedClients(); 
     766       } 
    752767     } 
    753768   } 
     
    11711186   } 
    11721187 
    1173   void CGrid::computeIndexScalarGrid() 
     1188  void CGrid::computeClientIndexScalarGrid() 
     1189  { 
     1190    CContext* context = CContext::getCurrent();     
     1191    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; // This should be changed soon 
     1192    for (int p = 0; p < nbSrvPools; ++p) 
     1193    { 
     1194      CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client)  
     1195                                                    : context->client; 
     1196 
     1197      storeIndex_client.resize(1); 
     1198      storeIndex_client(0) = 0;       
     1199 
     1200      if (0 != serverDistribution_) 
     1201      { 
     1202        map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(), 
     1203                                               ite = outGlobalIndexFromClient.end(), it; 
     1204        for (it = itb; it != ite; ++it) 
     1205        { 
     1206          int rank = it->first; 
     1207          CArray<size_t,1>& globalIndex = outGlobalIndexFromClient[rank]; 
     1208          outLocalIndexStoreOnClient.insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements()))); 
     1209          CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient[rank]; 
     1210          if (1 != globalIndex.numElements()) 
     1211            ERROR("void CGrid::computeClientIndexScalarGrid()", 
     1212              << "Something wrong happened. " 
     1213              << "Number of received global index on scalar grid should equal to 1"  
     1214              << "Number of received global index " << globalIndex.numElements() << "."); 
     1215 
     1216          localIndex(0) = globalIndex(0); 
     1217        } 
     1218      } 
     1219    } 
     1220  } 
     1221 
     1222  void CGrid::computeConnectedClientsScalarGrid() 
    11741223  { 
    11751224    CContext* context = CContext::getCurrent();     
     
    11811230    for (int p = 0; p < nbSrvPools; ++p) 
    11821231    { 
    1183       CContextClient* client = context->hasServer ? context->clientPrimServer[p] : context->client; 
    1184  
    1185       storeIndex_client.resize(1); 
    1186       storeIndex_client(0) = 0; 
     1232      CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client)  
     1233                                                    : context->client; 
    11871234 
    11881235      connectedServerRank_[p].clear(); 
    11891236 
    1190       if (0 == client->clientRank) 
    1191       { 
    1192         for (int rank = 0; rank < client->serverSize; ++rank) 
    1193         { 
     1237      if (client->isServerLeader()) 
     1238      { 
     1239        const std::list<int>& ranks = client->getRanksServerLeader(); 
     1240        for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     1241        { 
     1242          int rank = *itRank; 
     1243          int nb = 1; 
    11941244          connectedServerRank_[p].push_back(rank); 
    1195           connectedDataSize_[p][rank] = 1; 
    1196           nbSenders[p][rank] = 1; 
    1197         } 
    1198       } 
     1245          connectedDataSize_[p][rank] = nb; 
     1246          nbSenders[p][rank] = nb; 
     1247        } 
     1248      } 
     1249      else 
     1250      { 
     1251        const std::list<int>& ranks = client->getRanksServerNotLeader(); 
     1252        for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     1253        { 
     1254          int rank = *itRank; 
     1255          int nb = 1; 
     1256          connectedServerRank_[p].push_back(rank); 
     1257          connectedDataSize_[p][rank] = nb; 
     1258          nbSenders[p][rank] = nb; 
     1259        }         
     1260      } 
     1261 
    11991262      isDataDistributed_ = false; 
    12001263    } 
     
    14331496          std::vector<CAxis*> axisList = getAxis(); 
    14341497          std::vector<int> nZoomBegin(ssize), nZoomSize(ssize), nGlob(ssize), nZoomBeginGlobal(ssize), nGlobElement(numElement); 
    1435           std::vector<CArray<int,1> > zoomIndex; 
     1498          std::vector<CArray<int,1> > globalZoomIndex(numElement); 
    14361499          for (int i = 0; i < numElement; ++i) 
    14371500          { 
     
    14491512              nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; 
    14501513 
     1514              { 
     1515                int count = 0; 
     1516                globalZoomIndex[i].resize(nZoomSize[indexMap[i]]*nZoomSize[indexMap[i]+1]); 
     1517                for (int jdx = 0; jdx < nZoomSize[indexMap[i]+1]; ++jdx) 
     1518                  for (int idx = 0; idx < nZoomSize[indexMap[i]]; ++idx)                 
     1519                  { 
     1520                    globalZoomIndex[i](count) = (nZoomBegin[indexMap[i]] + idx) + (nZoomBegin[indexMap[i]+1] + jdx) * nGlob[indexMap[i]]; 
     1521                    ++count; 
     1522                  } 
     1523              } 
     1524 
    14511525              ++domainId; 
    14521526            } 
     
    14561530              nZoomSize[indexMap[i]]  = axisList[axisId]->zoom_n; 
    14571531              nZoomBeginGlobal[indexMap[i]] = axisList[axisId]->global_zoom_begin;               
    1458               nGlob[indexMap[i]] = axisList[axisId]->n_glo;               
     1532              nGlob[indexMap[i]] = axisList[axisId]->n_glo;      
     1533              if (axisList[axisId]->zoomByIndex()) 
     1534              { 
     1535                globalZoomIndex[i].reference(axisList[axisId]->zoom_index);                 
     1536              } 
     1537              else 
     1538              { 
     1539                globalZoomIndex[i].resize(nZoomSize[indexMap[i]]); 
     1540                for (int idx = 0; idx < nZoomSize[indexMap[i]]; ++idx) 
     1541                  globalZoomIndex[i](idx) = nZoomBegin[indexMap[i]] + idx; 
     1542              } 
     1543 
    14591544              ++axisId; 
    14601545            } 
     
    14651550              nZoomBeginGlobal[indexMap[i]] = 0;               
    14661551              nGlob[indexMap[i]] = 1; 
    1467  
     1552              globalZoomIndex[i].resize(1); 
     1553              globalZoomIndex[i](0) = 0; 
    14681554              ++scalarId; 
    14691555            } 
     
    14731559          for (int i = 0; i < nZoomSize.size(); ++i) 
    14741560            dataSize *= nZoomSize[i]; 
    1475           serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 
    1476                                                         nZoomBeginGlobal, nGlob); 
     1561          // serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 
     1562          //                                               nZoomBeginGlobal, nGlob); 
     1563          serverDistribution_ = new CDistributionServer(server->intraCommRank,  
     1564                                                        globalZoomIndex, axis_domain_order, 
     1565                                                        nZoomBegin, nZoomSize, nZoomBeginGlobal, nGlob); 
    14771566        } 
    14781567 
Note: See TracChangeset for help on using the changeset viewer.