Ignore:
Timestamp:
06/09/16 11:32:27 (8 years ago)
Author:
mhnguyen
Message:

Chaning the way to process transformation to improve the performance.
Instead of exchanging global index and weights on full GRID, each process only
sends and receives the global index and weights on each ELEMENT, which can reduce
the message size of DHT.

+) Domain and axis now have their own exchange function to transfer global index and weight
+) Generic transformation now plays the role of "synthesizer" for all elements
+) Grid transformation now plays the role of transformation mapping, e.x: exchange final global index and weight
among processes.

Test
+) On Curie
+) Pass on all basic tests
+) Dynamic interpolation on axis hasn't been tested (and it seems to need more change to make it rework)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/domain_algorithm_transformation.cpp

    r829 r862  
    99 
    1010#include "domain_algorithm_transformation.hpp" 
     11#include "context.hpp" 
     12#include "context_client.hpp" 
     13#include "client_client_dht_template.hpp" 
    1114 
    1215namespace xios { 
     
    2326void CDomainAlgorithmTransformation::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    2427{ 
     28} 
     29 
     30void CDomainAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex, 
     31                                                                boost::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc) 
     32{ 
     33  CContext* context = CContext::getCurrent(); 
     34  CContextClient* client=context->client; 
     35  int clientRank = client->clientRank; 
     36  int clientSize = client->clientSize; 
     37 
     38  int niGlob = domainSrc_->ni_glo.getValue(); 
     39  int njGlob = domainSrc_->nj_glo.getValue(); 
     40  size_t globalIndex; 
     41  int nIndexSize = domainSrc_->i_index.numElements(), i_ind, j_ind; 
     42  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank; 
     43  globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor())); 
     44  for (int idx = 0; idx < nIndexSize; ++idx) 
     45  { 
     46    i_ind=domainSrc_->i_index(idx) ; 
     47    j_ind=domainSrc_->j_index(idx) ; 
     48 
     49    globalIndex = i_ind + j_ind * niGlob; 
     50    globalIndex2ProcRank[globalIndex].push_back(clientRank); 
     51  } 
     52 
     53  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     54  dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex); 
     55 
     56  std::vector<int> countIndex(clientSize,0); 
     57  const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     58  CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it, 
     59                                                               ite = computedGlobalIndexOnProc.end(); 
     60  for (it = itb; it != ite; ++it) 
     61  { 
     62    const std::vector<int>& procList = it->second; 
     63    for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]]; 
     64  } 
     65 
     66  globalDomainIndexOnProc.rehash(std::ceil(clientSize/globalDomainIndexOnProc.max_load_factor())); 
     67  for (int idx = 0; idx < clientSize; ++idx) 
     68  { 
     69    if (0 != countIndex[idx]) 
     70    { 
     71      globalDomainIndexOnProc[idx].resize(countIndex[idx]); 
     72      countIndex[idx] = 0; 
     73    } 
     74  } 
     75 
     76  for (it = itb; it != ite; ++it) 
     77  { 
     78    const std::vector<int>& procList = it->second; 
     79    for (int idx = 0; idx < procList.size(); ++idx) 
     80    { 
     81      globalDomainIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first; 
     82      ++countIndex[procList[idx]]; 
     83    } 
     84  } 
    2585} 
    2686 
Note: See TracChangeset for help on using the changeset viewer.