Ignore:
Timestamp:
09/20/21 18:18:17 (3 years ago)
Author:
ymipsl
Message:

Fix problem in remoteConnector when computing grid to sent to server.
Some optimisations when grid is not distributed need knowledge of the workflow view.
New CGridClientServerConnector class created based on CGridRemoteConnector.

YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.cpp

    r2179 r2236  
    111111/** 
    112112  * \brief Compute the connector, i.e. compute the \b elements_ attribute.  
     113  * \detail Depending of the distributions of the view computed in the computeViewDistribution() call, the connector is computed in computeConnectorMethods(), and to achieve better optimisation 
     114  *         some redondant ranks can be removed from the elements_ map. 
     115  */ 
     116  void CGridRemoteConnector::computeConnector(void) 
     117  { 
     118    computeViewDistribution() ; 
     119    computeConnectorMethods() ; 
     120    computeRedondantRanks() ;  
     121    for(auto& rank : rankToRemove_) 
     122      for(auto& element : elements_) element.erase(rank) ; 
     123  } 
     124/** 
     125  * \brief Compute the connector, i.e. compute the \b elements_ attribute.  
    113126  * \detail In order to achive better optimisation, 
    114127  *         we distingute the case when the grid is not distributed on source grid (\bcomputeSrcNonDistributed),  
     
    120133  *         redondantly the the remote servers 
    121134  */ 
    122   void CGridRemoteConnector::computeConnector(void) 
    123   { 
    124     computeViewDistribution() ; 
     135  void CGridRemoteConnector::computeConnectorMethods(void) 
     136  { 
    125137    vector<CLocalView*> srcView ; 
    126138    vector<CDistributedView*> dstView ; 
     
    129141     
    130142    bool srcViewsNonDistributed=true ; 
    131     for(int i=0;i<srcView_.size();i++) srcViewsNonDistributed &= !isSrcViewDistributed_[i]  ; 
     143    for(int i=0;i<srcView_.size();i++) srcViewsNonDistributed = srcViewsNonDistributed && !isSrcViewDistributed_[i]  ; 
    132144     
    133145    bool dstViewsNonDistributed=true ; 
    134     for(int i=0;i<dstView_.size();i++) dstViewsNonDistributed &= !isDstViewDistributed_[i] ; 
     146    for(int i=0;i<dstView_.size();i++) dstViewsNonDistributed = dstViewsNonDistributed && !isDstViewDistributed_[i] ; 
    135147     
    136148    if (srcViewsNonDistributed)  
     
    184196    } 
    185197 
    186     removeRedondantRanks() ; 
    187198  } 
    188199 
     
    570581 
    571582 /** 
    572   * \brief Once the connector is computed (compute \b elements_), redondant data can be send to the server.  
     583  * \brief Once the connector is computed (compute \b elements_), redondant data can be avoid to be sent to the server.  
     584  *        This call compute the redondant rank and store them in \b rankToRemove_ attribute. 
    573585  *        The goal of this method is to make a hash of each block of indice that determine wich data to send to a  
    574586  *        of a specific server rank using a hash method. So data to send to a rank is associated to a hash. 
    575587  *        After we compare hash between local rank and remove redondant data corresponding to the same hash. 
    576588  */ 
    577   void CGridRemoteConnector::removeRedondantRanks(void) 
     589  void CGridRemoteConnector::computeRedondantRanks(void) 
    578590  { 
    579591    int commRank ; 
     
    635647      // only the process with the lowest rank get in charge of sendinf data to remote server 
    636648      for(int rank : ranks) if (commRank>rank) first=false ; 
    637       if (!first) 
    638       { 
    639         int rankToRemove=hashRank[hash] ; 
    640         for(auto& element : elements_) element.erase(rankToRemove) ; 
    641       } 
    642     } 
    643  
    644  
    645   } 
     649      if (!first) rankToRemove_.insert(hashRank[hash]) ; 
     650    } 
     651  } 
     652 
    646653} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.hpp

    r2179 r2236  
    2222      void computeViewDistribution(void) ; 
    2323      void computeConnector(void) ; 
     24      void computeConnectorMethods(void) ; 
    2425      void computeGenericMethod(vector<CLocalView*>& srcView, vector<CDistributedView*>& dstView, vector<int>& indElements) ; 
    2526      void computeSrcDstNonDistributed(int i, map<int,bool>& ranks) ; 
    2627      void computeDstNonDistributed(int i, map<int,bool>& ranks) ; 
    2728      void computeSrcNonDistributed(int i) ; 
    28       void removeRedondantRanks(void) ; 
     29      void computeRedondantRanks(void) ; 
    2930      std::map<int, CArray<size_t,1>>& getDistributedGlobalIndex(int pos) { return elements_[pos] ;}  
    30  
    31     private: 
     31      const vector<bool>& getIsSrcViewDistributed(void) { return isSrcViewDistributed_ ;} 
     32      const vector<bool>& getIsDstViewDistributed(void) { return isDstViewDistributed_ ;} 
     33      const set<int>& getRankToRemove(void) {return rankToRemove_;}  
     34     
     35    protected: 
    3236   
    3337    /**  
     
    7680       */ 
    7781      vector<bool> isDstViewDistributed_ ; 
     82 
     83      /** 
     84      /* Redondant ranks of the \b elements_ are stored there by calling computeRedondantRanks(), to be removed latter or to be retrieve from elsewhere.  
     85       */ 
     86      set<int> rankToRemove_ ; 
    7887       
    7988     
Note: See TracChangeset for help on using the changeset viewer.