Ignore:
Timestamp:
05/22/17 18:11:12 (7 years ago)
Author:
mhnguyen
Message:

Updating compressed index output on using 2-level server

+) Update compressed index output with new grid distribution

Test
+) On Curie
+) test_complete:

  • Mode: classical and 2 level server
  • config: 4 clients + 4 servers
  • passed
File:
1 edited

Legend:

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

    r1129 r1143  
    2525      , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) 
    2626      , isClientAfterTransformationChecked(false) 
    27       , isDistributed_(false), hasBounds_(false), isCompressible_(false) 
     27      , hasBounds_(false), isCompressible_(false) 
    2828      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    2929      , transformationMap_(), hasValue(false), doZoomByIndex_(false) 
     
    3636      , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) 
    3737      , isClientAfterTransformationChecked(false) 
    38       , isDistributed_(false), hasBounds_(false), isCompressible_(false) 
     38      , hasBounds_(false), isCompressible_(false) 
    3939      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    4040      , transformationMap_(), hasValue(false), doZoomByIndex_(false) 
     
    7676   bool CAxis::isDistributed(void) const 
    7777   { 
    78       return isDistributed_; 
     78      return (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 
     79             (!this->n.isEmpty() && (this->n != this->n_glo));; 
    7980   } 
    8081 
     
    266267      this->checkZoom(); 
    267268      this->checkMask(); 
    268       this->checkBounds(); 
    269  
    270       isDistributed_ = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 
    271                        (!this->n.isEmpty() && (this->n != this->n_glo)); 
     269      this->checkBounds();       
    272270   } 
    273271 
     
    613611      computedWrittenIndex_ = true; 
    614612 
    615       CContext* context=CContext::getCurrent() ; 
    616       CContextClient* client = context->client;  
     613      CContext* context=CContext::getCurrent();       
     614      CContextServer* server = context->server;  
    617615 
    618616      std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1); 
     
    621619      nBeginGlobal[0] = 0;  
    622620      nGlob[0]        = n_glo; 
    623       CDistributionServer srvDist(client->clientSize, nBegin, nSize, nBeginGlobal, nGlob);  
     621      CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob);  
    624622      const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex(); 
    625623 
     
    628626                                                          ite = globalLocalIndexMap_.end(), it;           
    629627      CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 
    630                                        itSrve = writtenGlobalIndex.end(), itSrv; 
    631       localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
     628                                       itSrve = writtenGlobalIndex.end(), itSrv;       
     629 
     630      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     631      { 
     632        indGlo = *itSrv; 
     633        if (ite != globalLocalIndexMap_.find(indGlo)) 
     634        {           
     635          ++nbWritten; 
     636        }                  
     637      } 
     638 
     639      localIndexToWriteOnServer.resize(nbWritten); 
     640 
     641      nbWritten = 0; 
    632642      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    633643      { 
     
    638648          ++nbWritten; 
    639649        }                  
     650      } 
     651 
     652      if (isCompressible()) 
     653      { 
     654        nbWritten = 0; 
     655        boost::unordered_map<size_t,size_t> localGlobalIndexMap; 
     656        for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     657        { 
     658          indGlo = *itSrv; 
     659          if (ite != globalLocalIndexMap_.find(indGlo)) 
     660          { 
     661            localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; 
     662            ++nbWritten; 
     663          }                  
     664        } 
     665 
     666        nbWritten = 0; 
     667        for (int idx = 0; idx < data_index.numElements(); ++idx) 
     668        { 
     669          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) 
     670          { 
     671            ++nbWritten; 
     672          } 
     673        } 
     674 
     675        compressedIndexToWriteOnServer.resize(nbWritten); 
     676        nbWritten = 0; 
     677        for (int idx = 0; idx < data_index.numElements(); ++idx) 
     678        { 
     679          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) 
     680          { 
     681            compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_index(idx)]; 
     682            ++nbWritten; 
     683          } 
     684        } 
     685 
     686        numberWrittenIndexes_ = nbWritten; 
     687        if (isDistributed()) 
     688        { 
     689                
     690          MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
     691          MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
     692          offsetWrittenIndexes_ -= numberWrittenIndexes_; 
     693        } 
     694        else 
     695          totalNumberWrittenIndexes_ = numberWrittenIndexes_; 
    640696      } 
    641697 
Note: See TracChangeset for help on using the changeset viewer.