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/axis_algorithm_transformation.cpp

    r829 r862  
    1111#include "axis_algorithm_inverse.hpp" 
    1212#include "axis_algorithm_zoom.hpp" 
     13#include "context.hpp" 
     14#include "context_client.hpp" 
     15#include "client_client_dht_template.hpp" 
    1316 
    1417namespace xios { 
     
    2730CAxisAlgorithmTransformation::~CAxisAlgorithmTransformation() 
    2831{ 
     32} 
     33 
     34void CAxisAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex, 
     35                                                              boost::unordered_map<int,std::vector<size_t> >& globalAxisIndexOnProc) 
     36{ 
     37  CContext* context = CContext::getCurrent(); 
     38  CContextClient* client=context->client; 
     39  int clientRank = client->clientRank; 
     40  int clientSize = client->clientSize; 
     41 
     42  size_t globalIndex; 
     43  int nIndexSize = axisSrc_->index.numElements(); 
     44  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank; 
     45  globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor())); 
     46  for (int idx = 0; idx < nIndexSize; ++idx) 
     47  { 
     48    globalIndex = axisSrc_->index(idx); 
     49    globalIndex2ProcRank[globalIndex].push_back(clientRank); 
     50  } 
     51 
     52  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     53  dhtIndexProcRank.computeIndexInfoMapping(globalAxisIndex); 
     54 
     55  std::vector<int> countIndex(clientSize,0); 
     56  const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     57  CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it, 
     58                                                               ite = computedGlobalIndexOnProc.end(); 
     59  for (it = itb; it != ite; ++it) 
     60  { 
     61    const std::vector<int>& procList = it->second; 
     62    for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]]; 
     63  } 
     64 
     65  globalAxisIndexOnProc.rehash(std::ceil(clientSize/globalAxisIndexOnProc.max_load_factor())); 
     66  for (int idx = 0; idx < clientSize; ++idx) 
     67  { 
     68    if (0 != countIndex[idx]) 
     69    { 
     70      globalAxisIndexOnProc[idx].resize(countIndex[idx]); 
     71      countIndex[idx] = 0; 
     72    } 
     73  } 
     74 
     75  for (it = itb; it != ite; ++it) 
     76  { 
     77    const std::vector<int>& procList = it->second; 
     78    for (int idx = 0; idx < procList.size(); ++idx) 
     79    { 
     80      globalAxisIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first; 
     81      ++countIndex[procList[idx]]; 
     82    } 
     83  } 
    2984} 
    3085 
Note: See TracChangeset for help on using the changeset viewer.