Ignore:
Timestamp:
04/26/16 16:04:04 (6 years ago)
Author:
mhnguyen
Message:

Several improvements

+) Replace some time-consuming operations by simpler ones

Test
+) On Curie
+) All tests pass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/distribution_client.cpp

    r834 r843  
    1717   , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_() 
    1818   , gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_() 
    19    , isDataDistributed_(true), axisNum_(0), domainNum_(0), nIndexDomain_(), nIndexAxis_() 
     19   , isDataDistributed_(true), axisNum_(0), domainNum_(0) 
    2020   , localDataIndex_(), localMaskIndex_() 
    2121   , globalLocalDataSendToServerMap_() 
     
    3030   , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_() 
    3131   , gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_() 
    32    , isDataDistributed_(true), axisNum_(0), domainNum_(0), nIndexDomain_(), nIndexAxis_() 
     32   , isDataDistributed_(true), axisNum_(0), domainNum_(0) 
    3333   , localDataIndex_(), localMaskIndex_() 
    3434   , globalLocalDataSendToServerMap_() 
     
    3737  readDistributionInfo(grid); 
    3838  createGlobalIndex(); 
    39 //  createGlobalIndexSendToServer(); 
    4039} 
    4140 
     
    8180} 
    8281 
    83 void CDistributionClient::readDomainIndex(const std::vector<CDomain*>& domList) 
    84 { 
    85   int domainSize = domList.size(); 
    86   nIndexDomain_.resize(domainSize); 
    87  
    88   for (int k = 0; k < domainSize; ++k) 
    89   { 
    90     nIndexDomain_[k].resize(2); 
    91     int ni = domList[k]->ni; 
    92     int nj = domList[k]->nj; 
    93     nIndexDomain_[k][0].resize(ni*nj); 
    94     nIndexDomain_[k][1].resize(ni*nj); 
    95     nIndexDomain_[k][0] = domList[k]->i_index; 
    96     nIndexDomain_[k][1] = domList[k]->j_index; 
    97   } 
    98 } 
    99  
    100 void CDistributionClient::readAxisIndex(const std::vector<CAxis*>& axisList) 
    101 { 
    102   int axisSize = axisList.size(); 
    103   nIndexAxis_.resize(axisSize); 
    104  
    105   for (int k = 0; k < axisSize; ++k) 
    106   { 
    107     int n = axisList[k]->n; 
    108     nIndexAxis_[k].resize(n); 
    109     for (int i = 0; i < n; ++i) 
    110       nIndexAxis_[k](i) = i; 
    111   } 
    112 } 
    113  
    11482/*! 
    11583  Read information from domain(s) and axis to generate distribution. 
     
    204172 
    205173      dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); //(2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1; 
    206 //      dataIndex_.at(indexMap_[idx]+1).resize(domList[domIndex]->data_j_index.numElements()); 
    207174      dataIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->data_j_index); 
    208 //      infoIndex_.at(indexMap_[idx]+1).resize(domList[domIndex]->j_index.numElements()); 
    209175      infoIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->j_index); 
    210176 
     
    218184 
    219185      dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); 
    220 //      dataIndex_.at(indexMap_[idx]).resize(domList[domIndex]->data_i_index.numElements()); 
    221186      dataIndex_.at(indexMap_[idx]) = &(domList[domIndex]->data_i_index); 
    222 //      infoIndex_.at(indexMap_[idx]).resize(domList[domIndex]->i_index.numElements()); 
    223187      infoIndex_.at(indexMap_[idx]) = &(domList[domIndex]->i_index); 
    224188 
     
    240204 
    241205      dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); 
    242 //      dataIndex_.at(indexMap_[idx]).resize(axisList[axisIndex]->data_index.numElements()); 
    243206      dataIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->data_index); 
    244 //      infoIndex_.at(indexMap_[idx]).resize(axisList[axisIndex]->index.numElements()); 
    245207      infoIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->index); 
    246208      dataNIndex_.at(idx) = axisList[axisIndex]->data_index.numElements(); 
     
    253215    ++idx; 
    254216  } 
    255   readDomainIndex(domList); 
    256   readAxisIndex(axisList); 
    257217} 
    258218 
     
    511471  localDataIndex_.resize(indexLocalDataOnClientCount); 
    512472  localMaskIndex_.resize(indexSend2ServerCount); 
     473  globalLocalDataSendToServerMap_.rehash(std::ceil(indexSend2ServerCount/globalLocalDataSendToServerMap_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount); 
    513474 
    514475  // We need to loop with data index 
Note: See TracChangeset for help on using the changeset viewer.