Changeset 2236


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
Files:
2 added
4 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     
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r2206 r2236  
    1818#include "server.hpp" 
    1919#include "distribution_type.hpp" 
    20 #include "grid_remote_connector.hpp" 
     20#include "grid_client_server_remote_connector.hpp" 
    2121#include "grid_elements.hpp" 
    2222#include "grid_local_view.hpp" 
     
    14291429     
    14301430    vector<CLocalView*> localViews ; 
     1431    vector<CLocalView*> workflowView ; 
    14311432    vector<CDistributedView*> remoteViews ; 
    14321433 
     
    14391440         remoteViews.push_back(domain->getRemoteElement(client)->getView(CElementView::FULL)) ; 
    14401441         localViews.push_back(domain->getLocalView(CElementView::FULL)) ; 
     1442         workflowView.push_back(domain->getLocalView(CElementView::WORKFLOW)) ; 
    14411443      } 
    14421444      else if (elements[i].type==TYPE_AXIS) 
     
    14461448        remoteViews.push_back(axis->getRemoteElement(client)->getView(CElementView::FULL)) ; 
    14471449        localViews.push_back(axis->getLocalView(CElementView::FULL)) ; 
     1450        workflowView.push_back(axis->getLocalView(CElementView::WORKFLOW)) ; 
    14481451      } 
    14491452      else if (elements[i].type==TYPE_SCALAR) 
     
    14531456        remoteViews.push_back(scalar->getRemoteElement(client)->getView(CElementView::FULL)) ; 
    14541457        localViews.push_back(scalar->getLocalView(CElementView::FULL)) ; 
    1455       } 
    1456     } 
    1457     CGridRemoteConnector gridRemoteConnector(localViews, remoteViews, context->getIntraComm(), client->getRemoteSize()) ; 
     1458        workflowView.push_back(scalar->getLocalView(CElementView::WORKFLOW)) ; 
     1459      } 
     1460    } 
     1461     
     1462    // CGridClientServerRemoteConnector : workflowView is added to avoid spurious optimisation with only the fullview 
     1463    CGridClientServerRemoteConnector gridRemoteConnector(localViews, workflowView, remoteViews, context->getIntraComm(), client->getRemoteSize()) ; 
    14581464    gridRemoteConnector.computeConnector() ; 
    14591465     
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/test/generic_testcase.f90

    r2234 r2236  
    204204    LOGICAL :: ok_other_field0D_W, ok_other_field2D_W, ok_other_field3D_W, ok_other_pressure_W, ok_other_field2D_sub_W, ok_other_field3D_sub_W,ok_other_field3D_recv_W, ok_other_field3D_send_W 
    205205    LOGICAL :: ok_other_field_XW, ok_other_field_YW, ok_other_field_XYW, ok_other_field_ZW, ok_other_field_XYZW, ok_other_field_XZW, ok_other_field_YZW 
     206 
     207    TYPE(xios_domain)  :: domain_handle 
    206208     
    207209      !! XIOS Initialization (get the local communicator) 
     
    635637    CALL xios_close_context_definition() 
    636638    CALL xios_set_current_context(trim(model_id)) 
    637  
     639!    CALL xios_get_handle("field3D::domain",domain_handle)  
    638640     
    639641    DO while ( cdate <= edate ) 
Note: See TracChangeset for help on using the changeset viewer.