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/generic_algorithm_transformation.hpp

    r843 r862  
    1515 
    1616namespace xios { 
     17  class CGrid; 
     18  class CDomain; 
     19  class CAxis; 
     20 
    1721  /*! 
    1822  \class CGenericAlgorithmTransformation 
     
    2731  // Mapping between global index map of DESTINATION and its local index with pair of global index of SOURCE and weights 
    2832  typedef boost::unordered_map<size_t, DestinationGlobalIndex> DestinationIndexMap; 
     33  // 
     34  typedef boost::unordered_map<int, boost::unordered_map<size_t, std::vector<std::pair<size_t,double> > > > SourceDestinationIndexMap; 
    2935 
    3036protected: 
    3137  typedef boost::unordered_map<size_t,int> GlobalLocalMap; 
     38protected: 
     39  typedef boost::unordered_map<int, std::vector<int> > TransformationIndexMap; 
     40  typedef boost::unordered_map<int, std::vector<double> > TransformationWeightMap; 
     41  typedef boost::unordered_map<int, std::vector<int> > TransformationPositionMap; 
    3242 
    3343public: 
     
    3646  virtual ~CGenericAlgorithmTransformation() {} 
    3747 
     48//  void computeGlobalSourceIndex(int elementPositionInGrid, 
     49//                                const std::vector<int>& gridDestGlobalDim, 
     50//                                const std::vector<int>& gridSrcGlobalDim, 
     51//                                const GlobalLocalMap& globalLocalIndexGridDestSendToServer, 
     52//                                DestinationIndexMap& globaIndexWeightFromDestToSource); 
     53 
    3854  void computeGlobalSourceIndex(int elementPositionInGrid, 
    39                                 const std::vector<int>& gridDestGlobalDim, 
    40                                 const std::vector<int>& gridSrcGlobalDim, 
    41                                 const GlobalLocalMap& globalLocalIndexGridDestSendToServer, 
    42                                 DestinationIndexMap& globaIndexWeightFromDestToSource); 
     55                               CGrid* gridSrc, 
     56                               CGrid* gridDst, 
     57                               SourceDestinationIndexMap& globaIndexWeightFromSrcToDst); 
    4358 
    4459  std::vector<StdString> getIdAuxInputs(); 
     
    7287  virtual void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >&) = 0; 
    7388 
     89  virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalElementIndex, 
     90                                          boost::unordered_map<int,std::vector<size_t> >& globalElementIndexOnProc) = 0; 
     91 
     92  void computeGlobalGridIndexMapping(int elementPositionInGrid, 
     93                                     const std::vector<int>& srcRank, 
     94                                     boost::unordered_map<int, std::vector<std::pair<int,double> > >& src2DstMap, 
     95                                     CGrid* gridDst, 
     96                                     CGrid* gridSrc, 
     97                                     std::vector<boost::unordered_map<int,std::vector<size_t> > >& globalElementIndexOnProc, 
     98                                     SourceDestinationIndexMap& globaIndexWeightFromSrcToDst); 
     99 
     100  void computeExchangeDomainIndex(CDomain* domainDst, 
     101                                  CDomain* domainSrc, 
     102                                  CArray<size_t,1>& destGlobalIndexPositionInGrid, 
     103                                  boost::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc); 
     104 
     105  void computeExchangeAxisIndex(CAxis* axisDst, 
     106                                CAxis* axisSrc, 
     107                                CArray<size_t,1>& destGlobalIndexPositionInGrid, 
     108                                boost::unordered_map<int,std::vector<size_t> >& globalAxisIndexOnProc); 
     109 
    74110protected: 
    75   typedef boost::unordered_map<int, std::vector<int> > TransformationIndexMap; 
    76   typedef boost::unordered_map<int, std::vector<double> > TransformationWeightMap; 
    77   typedef boost::unordered_map<int, std::vector<int> > TransformationPositionMap; 
    78  
    79111  //! Map between global index of destination element and source element 
    80112  std::vector<TransformationIndexMap> transformationMapping_; 
Note: See TracChangeset for help on using the changeset viewer.