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

    r862 r866  
    3333 
    3434void CAxisAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex, 
    35                                                               boost::unordered_map<int,std::vector<size_t> >& globalAxisIndexOnProc) 
     35                                                              CClientClientDHTInt::Index2VectorInfoTypeMap& globalAxisIndexOnProc) 
    3636{ 
    3737  CContext* context = CContext::getCurrent(); 
     
    4747  { 
    4848    globalIndex = axisSrc_->index(idx); 
    49     globalIndex2ProcRank[globalIndex].push_back(clientRank); 
     49    globalIndex2ProcRank[globalIndex].resize(1); 
     50    globalIndex2ProcRank[globalIndex][0] = clientRank; 
     51//    globalIndex2ProcRank[globalIndex].push_back(clientRank); 
    5052  } 
    5153 
     
    5355  dhtIndexProcRank.computeIndexInfoMapping(globalAxisIndex); 
    5456 
    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   } 
     57//  std::vector<int> countIndex(clientSize,0); 
     58//  const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     59  globalAxisIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     60// 
     61//  CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it, 
     62//                                                               ite = computedGlobalIndexOnProc.end(); 
     63//  for (it = itb; it != ite; ++it) 
     64//  { 
     65//    const std::vector<int>& procList = it->second; 
     66//    for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]]; 
     67//  } 
     68// 
     69//  globalAxisIndexOnProc.rehash(std::ceil(clientSize/globalAxisIndexOnProc.max_load_factor())); 
     70//  for (int idx = 0; idx < clientSize; ++idx) 
     71//  { 
     72//    if (0 != countIndex[idx]) 
     73//    { 
     74//      globalAxisIndexOnProc[idx].resize(countIndex[idx]); 
     75//      countIndex[idx] = 0; 
     76//    } 
     77//  } 
     78// 
     79//  for (it = itb; it != ite; ++it) 
     80//  { 
     81//    const std::vector<int>& procList = it->second; 
     82//    for (int idx = 0; idx < procList.size(); ++idx) 
     83//    { 
     84//      globalAxisIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first; 
     85//      ++countIndex[procList[idx]]; 
     86//    } 
     87//  } 
    8488} 
    8589 
Note: See TracChangeset for help on using the changeset viewer.