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

Reorganizing codes

+) Reorganize some structures to make them more performant

Test:
+) On Curie
+) All tests pass

File:
1 edited

Legend:

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

    r862 r866  
    1111#include "context.hpp" 
    1212#include "context_client.hpp" 
    13 #include "client_client_dht_template.hpp" 
     13#include "domain.hpp" 
    1414 
    1515namespace xios { 
     
    2929 
    3030void CDomainAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex, 
    31                                                                 boost::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc) 
     31                                                                CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc) 
    3232{ 
    3333  CContext* context = CContext::getCurrent(); 
     
    5353  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
    5454  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   } 
     55  globalDomainIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     56 
     57 
     58//  std::vector<int> countIndex(clientSize,0); 
     59//  const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     60//  CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it, 
     61//                                                               ite = computedGlobalIndexOnProc.end(); 
     62//  for (it = itb; it != ite; ++it) 
     63//  { 
     64//    const std::vector<int>& procList = it->second; 
     65//    for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]]; 
     66//  } 
     67// 
     68//  globalDomainIndexOnProc.rehash(std::ceil(clientSize/globalDomainIndexOnProc.max_load_factor())); 
     69//  for (int idx = 0; idx < clientSize; ++idx) 
     70//  { 
     71//    if (0 != countIndex[idx]) 
     72//    { 
     73//      globalDomainIndexOnProc[idx].resize(countIndex[idx]); 
     74//      countIndex[idx] = 0; 
     75//    } 
     76//  } 
     77// 
     78//  for (it = itb; it != ite; ++it) 
     79//  { 
     80//    const std::vector<int>& procList = it->second; 
     81//    for (int idx = 0; idx < procList.size(); ++idx) 
     82//    { 
     83//      globalDomainIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first; 
     84//      ++countIndex[procList[idx]]; 
     85//    } 
     86//  } 
    8587} 
    8688 
Note: See TracChangeset for help on using the changeset viewer.