Changeset 2236
- Timestamp:
- 09/20/21 18:18:17 (3 years ago)
- 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 111 111 /** 112 112 * \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. 113 126 * \detail In order to achive better optimisation, 114 127 * we distingute the case when the grid is not distributed on source grid (\bcomputeSrcNonDistributed), … … 120 133 * redondantly the the remote servers 121 134 */ 122 void CGridRemoteConnector::computeConnector(void) 123 { 124 computeViewDistribution() ; 135 void CGridRemoteConnector::computeConnectorMethods(void) 136 { 125 137 vector<CLocalView*> srcView ; 126 138 vector<CDistributedView*> dstView ; … … 129 141 130 142 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] ; 132 144 133 145 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] ; 135 147 136 148 if (srcViewsNonDistributed) … … 184 196 } 185 197 186 removeRedondantRanks() ;187 198 } 188 199 … … 570 581 571 582 /** 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. 573 585 * The goal of this method is to make a hash of each block of indice that determine wich data to send to a 574 586 * of a specific server rank using a hash method. So data to send to a rank is associated to a hash. 575 587 * After we compare hash between local rank and remove redondant data corresponding to the same hash. 576 588 */ 577 void CGridRemoteConnector:: removeRedondantRanks(void)589 void CGridRemoteConnector::computeRedondantRanks(void) 578 590 { 579 591 int commRank ; … … 635 647 // only the process with the lowest rank get in charge of sendinf data to remote server 636 648 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 646 653 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.hpp
r2179 r2236 22 22 void computeViewDistribution(void) ; 23 23 void computeConnector(void) ; 24 void computeConnectorMethods(void) ; 24 25 void computeGenericMethod(vector<CLocalView*>& srcView, vector<CDistributedView*>& dstView, vector<int>& indElements) ; 25 26 void computeSrcDstNonDistributed(int i, map<int,bool>& ranks) ; 26 27 void computeDstNonDistributed(int i, map<int,bool>& ranks) ; 27 28 void computeSrcNonDistributed(int i) ; 28 void removeRedondantRanks(void) ;29 void computeRedondantRanks(void) ; 29 30 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: 32 36 33 37 /** … … 76 80 */ 77 81 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_ ; 78 87 79 88 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r2206 r2236 18 18 #include "server.hpp" 19 19 #include "distribution_type.hpp" 20 #include "grid_ remote_connector.hpp"20 #include "grid_client_server_remote_connector.hpp" 21 21 #include "grid_elements.hpp" 22 22 #include "grid_local_view.hpp" … … 1429 1429 1430 1430 vector<CLocalView*> localViews ; 1431 vector<CLocalView*> workflowView ; 1431 1432 vector<CDistributedView*> remoteViews ; 1432 1433 … … 1439 1440 remoteViews.push_back(domain->getRemoteElement(client)->getView(CElementView::FULL)) ; 1440 1441 localViews.push_back(domain->getLocalView(CElementView::FULL)) ; 1442 workflowView.push_back(domain->getLocalView(CElementView::WORKFLOW)) ; 1441 1443 } 1442 1444 else if (elements[i].type==TYPE_AXIS) … … 1446 1448 remoteViews.push_back(axis->getRemoteElement(client)->getView(CElementView::FULL)) ; 1447 1449 localViews.push_back(axis->getLocalView(CElementView::FULL)) ; 1450 workflowView.push_back(axis->getLocalView(CElementView::WORKFLOW)) ; 1448 1451 } 1449 1452 else if (elements[i].type==TYPE_SCALAR) … … 1453 1456 remoteViews.push_back(scalar->getRemoteElement(client)->getView(CElementView::FULL)) ; 1454 1457 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()) ; 1458 1464 gridRemoteConnector.computeConnector() ; 1459 1465 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/test/generic_testcase.f90
r2234 r2236 204 204 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 205 205 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 206 208 207 209 !! XIOS Initialization (get the local communicator) … … 635 637 CALL xios_close_context_definition() 636 638 CALL xios_set_current_context(trim(model_id)) 637 639 ! CALL xios_get_handle("field3D::domain",domain_handle) 638 640 639 641 DO while ( cdate <= edate )
Note: See TracChangeset
for help on using the changeset viewer.