- Timestamp:
- 10/08/20 13:10:29 (4 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src/node
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp
r1950 r1956 99 99 100 100 /*! 101 * Test whether the data defined on the axis can be outputted in a compressed way. 102 * 103 * \return true if and only if a mask was defined for this axis 101 * Compute if the axis can be ouput in a compressed way. 102 * In this case the workflow view on server side must be the same 103 * than the full view for all context rank. The result is stored on 104 * internal isCompressible_ attribute. 104 105 */ 105 bool CAxis::isCompressible(void) const 106 TRY 107 { 108 return isCompressible_; 106 void CAxis::computeIsCompressible(void) 107 TRY 108 { 109 // mesh is compressible contains some masked or indexed value, ie if full view is different of workflow view. 110 // But now assume that the size of the 2 view must be equal for everybody. True on server side 111 int isSameView = getLocalView(CElementView::FULL)->getSize() == getLocalView(CElementView::WORKFLOW)->getSize(); 112 MPI_Allreduce(MPI_IN_PLACE, &isSameView, 1, MPI_INT, MPI_LAND, CContext::getCurrent()->getIntraComm()) ; 113 if (isSameView) isCompressible_ = false ; 114 else isCompressible_ = true ; 115 isCompressibleComputed_=true ; 109 116 } 110 117 CATCH … … 462 469 CATCH_DUMP_ATTR 463 470 464 /*! 465 Check whether we can do compressed output 466 */ 467 void CAxis::checkEligibilityForCompressedOutput() 468 TRY 469 { 470 // We don't check if the mask is valid here, just if a mask has been defined at this point. 471 isCompressible_ = !mask.isEmpty(); 472 } 473 CATCH_DUMP_ATTR 474 471 475 472 /*! 476 473 Dispatch event from the lower communication layer then process event according to its type … … 1647 1644 } 1648 1645 1649 void CAxis::distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, const string& axisId) 1646 void CAxis::distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, 1647 CScattererConnector* &scattererConnector, const string& axisId) 1650 1648 { 1651 1649 string serverAxisId = axisId.empty() ? this->getId() : axisId ; … … 1656 1654 CDistributedElement scatteredElement(n_glo,globalIndex) ; 1657 1655 scatteredElement.addFullView() ; 1658 CScattererConnector scattererConnector(localElement_->getView(CElementView::FULL), scatteredElement.getView(CElementView::FULL),1659 context->getIntraComm(), client->getRemoteSize()) ;1660 scattererConnector .computeConnector() ;1656 scattererConnector = new CScattererConnector(localElement_->getView(CElementView::FULL), scatteredElement.getView(CElementView::FULL), 1657 context->getIntraComm(), client->getRemoteSize()) ; 1658 scattererConnector->computeConnector() ; 1661 1659 1662 1660 // phase 0 … … 1672 1670 CMessage message1 ; 1673 1671 message1<<serverAxisId<<1<<localElement_->getView(CElementView::FULL)->getGlobalSize() ; 1674 scattererConnector .transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ;1675 1676 sendDistributedAttributes(client, scattererConnector, axisId) ;1672 scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; 1673 1674 sendDistributedAttributes(client, *scattererConnector, axisId) ; 1677 1675 1678 1676 // phase 2 send the mask : data index + mask2D … … 1687 1685 map<int,CArray<size_t,1>> workflowGlobalIndex ; 1688 1686 map<int,CArray<bool,1>> maskOut2 ; 1689 scattererConnector .transfer(maskOut, maskOut2) ;1687 scattererConnector->transfer(maskOut, maskOut2) ; 1690 1688 scatteredElement.addView(CElementView::WORKFLOW, maskOut2) ; 1691 1689 scatteredElement.getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; … … 1752 1750 else if (phasis==2) 1753 1751 { 1754 delete gathererConnector_ ;1752 // delete gathererConnector_ ; 1755 1753 elementFrom_ = new CDistributedElement(event) ; 1756 1754 elementFrom_->addFullView() ; 1757 gathererConnector_ = new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ;1758 gathererConnector_ -> computeConnector() ;1755 // gathererConnector_ = new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 1756 // gathererConnector_ -> computeConnector() ; 1759 1757 } 1760 1758 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp
r1943 r1956 88 88 bool isWrittenCompressed(const StdString& filename) const; 89 89 bool isDistributed(void) const; 90 bool isCompressible(void) const; 90 91 public: 92 /*! 93 \brief return if the axis can be written or not in a compressed way. 94 ie if there are some masked or indexed point on the domain. Valid only on server side. 95 \return true if domain can be writtedn in a compressed way 96 */ 97 bool isCompressible(void) { if (!isCompressibleComputed_) computeIsCompressible() ; return isCompressible_ ;} 98 private: 99 bool isCompressible_ ; /** specify if the domain can be written in a compressed way */ 100 bool isCompressibleComputed_=false ; /** Indicate if compressability has been computed*/ 101 void computeIsCompressible() ; 102 103 public: 91 104 92 105 /// Mutateur /// … … 120 133 CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); 121 134 122 void checkEligibilityForCompressedOutput();123 135 size_t getGlobalWrittenSize(void) ; 124 136 … … 213 225 std::set<StdString> relFiles, relFilesCompressed; 214 226 TransMapTypes transformationMap_; 215 //! True if and only if the data defined on the axis can be outputted in a compressed way216 bool isCompressible_;217 227 218 228 std::map<int, map<int,int> > nbSenders; // Mapping of number of communicating client to a server … … 254 264 public: 255 265 void computeRemoteElement(CContextClient* client, EDistributionType) ; 256 void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, const string& axisId="") ; 266 void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector, 267 const string& axisId="") ; 257 268 258 269 static void recvAxisDistribution(CEventServer& event) ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp
r1934 r1956 2403 2403 // Check if some axis, domains or grids are eligible to for compressed indexed output. 2404 2404 // Warning: This must be done after solving the inheritance and before the rest of post-processing 2405 checkAxisDomainsGridsEligibilityForCompressedOutput(); // only for field written on IO_SERVER service ????2405 //checkAxisDomainsGridsEligibilityForCompressedOutput(); // only for field written on IO_SERVER service ???? 2406 2406 2407 2407 // Check if some automatic time series should be generated … … 2539 2539 CATCH_DUMP_ATTR 2540 2540 2541 //! Client side: Check if the defined axis, domains and grids are eligible for compressed indexed output 2542 void CContext::checkAxisDomainsGridsEligibilityForCompressedOutput() 2543 TRY 2544 { 2545 if (!(serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER)) return; 2546 2547 const vector<CAxis*> allAxis = CAxis::getAll(); 2548 for (vector<CAxis*>::const_iterator it = allAxis.begin(); it != allAxis.end(); it++) 2549 (*it)->checkEligibilityForCompressedOutput(); 2550 2551 const vector<CDomain*> allDomains = CDomain::getAll(); 2552 for (vector<CDomain*>::const_iterator it = allDomains.begin(); it != allDomains.end(); it++) 2553 (*it)->checkEligibilityForCompressedOutput(); 2554 2555 const vector<CGrid*> allGrids = CGrid::getAll(); 2556 for (vector<CGrid*>::const_iterator it = allGrids.begin(); it != allGrids.end(); it++) 2557 (*it)->checkEligibilityForCompressedOutput(); 2558 } 2559 CATCH_DUMP_ATTR 2560 2541 2561 2542 //! Client side: Prepare the timeseries by adding the necessary files 2562 2543 void CContext::prepareTimeseries() -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp
r1875 r1956 140 140 void createFileHeader(void); 141 141 void initReadFiles(void); 142 void checkAxisDomainsGridsEligibilityForCompressedOutput(); 143 void prepareTimeseries(void); 142 void prepareTimeseries(void); 144 143 void solveOnlyRefOfEnabledFields(void); 145 144 void buildFilterGraphOfEnabledFields(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp
r1943 r1956 246 246 247 247 /*! 248 * Test whether the data defined on the domain can be outputted in a compressed way. 249 * 250 * \return true if and only if a mask was defined for this domain 248 * Compute if the domain can be ouput in a compressed way. 249 * In this case the workflow view on server side must be the same 250 * than the full view for all context rank. The result is stored on 251 * internal isCompressible_ attribute. 251 252 */ 252 bool CDomain::isCompressible(void) const 253 TRY 254 { 255 return isCompressible_; 253 void CDomain::computeIsCompressible(void) 254 TRY 255 { 256 // mesh is compressible contains some masked or indexed value, ie if full view is different of workflow view. 257 // But now assume that the size of the 2 view must be equal for everybody. True on server side 258 int isSameView = getLocalView(CElementView::FULL)->getSize() == getLocalView(CElementView::WORKFLOW)->getSize(); 259 MPI_Allreduce(MPI_IN_PLACE, &isSameView, 1, MPI_INT, MPI_LAND, CContext::getCurrent()->getIntraComm()) ; 260 if (isSameView) isCompressible_ = false ; 261 else isCompressible_ = true ; 262 isCompressibleComputed_=true ; 256 263 } 257 264 CATCH … … 1307 1314 CATCH_DUMP_ATTR 1308 1315 1309 void CDomain::checkEligibilityForCompressedOutput(void)1310 TRY1311 {1312 // We don't check if the mask or the indexes are valid here, just if they have been defined at this point.1313 isCompressible_ = !mask_1d.isEmpty() || !mask_2d.isEmpty() || !data_i_index.isEmpty();1314 }1315 CATCH_DUMP_ATTR1316 1316 1317 1317 //---------------------------------------------------------------- … … 2295 2295 2296 2296 2297 void CDomain::distributeToServer(CContextClient* client, map<int, CArray<size_t,1>>& globalIndex, const string& domainId) 2297 void CDomain::distributeToServer(CContextClient* client, map<int, CArray<size_t,1>>& globalIndex, 2298 CScattererConnector* &scattererConnector, const string& domainId) 2298 2299 TRY 2299 2300 { … … 2305 2306 CDistributedElement scatteredElement(ni_glo*nj_glo, globalIndex) ; 2306 2307 scatteredElement.addFullView() ; 2307 CScattererConnector scattererConnector(localElement_->getView(CElementView::FULL), scatteredElement.getView(CElementView::FULL),2308 scattererConnector = new CScattererConnector(localElement_->getView(CElementView::FULL), scatteredElement.getView(CElementView::FULL), 2308 2309 context->getIntraComm(), client->getRemoteSize()) ; 2309 scattererConnector .computeConnector() ;2310 scattererConnector->computeConnector() ; 2310 2311 2311 2312 // phase 0 … … 2321 2322 CMessage message1 ; 2322 2323 message1<<serverDomainId<<1<<localElement_->getView(CElementView::FULL)->getGlobalSize() ; 2323 scattererConnector .transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ;2324 scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; 2324 2325 2325 sendDistributedAttributes(client, scattererConnector, domainId) ;2326 sendDistributedAttributes(client, *scattererConnector, domainId) ; 2326 2327 2327 2328 … … 2338 2339 map<int,CArray<size_t,1>> workflowGlobalIndex ; 2339 2340 map<int,CArray<bool,1>> maskOut2 ; 2340 scattererConnector .transfer(maskOut, maskOut2, false) ;2341 scattererConnector->transfer(maskOut, maskOut2, false) ; 2341 2342 scatteredElement.addView(CElementView::WORKFLOW, maskOut2) ; 2342 2343 scatteredElement.getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; … … 2407 2408 else if (phasis==2) 2408 2409 { 2409 delete gathererConnector_ ;2410 // delete gathererConnector_ ; 2410 2411 elementFrom_ = new CDistributedElement(event) ; 2411 2412 elementFrom_->addFullView() ; 2412 gathererConnector_ = new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ;2413 gathererConnector_ -> computeConnector() ;2413 // gathererConnector_ = new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 2414 // gathererConnector_ -> computeConnector() ; 2414 2415 } 2415 2416 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp
r1943 r1956 87 87 void checkAttributesOnClient(); 88 88 void checkAttributesOnClientAfterTransformation(); 89 void checkEligibilityForCompressedOutput(void);90 89 91 90 void sendCheckedAttributes(); … … 112 111 bool isEmpty(void) const; 113 112 bool isDistributed(void) const; 114 bool isCompressible(void) const; 115 113 114 public : 115 /*! 116 \brief return if the domain can be written or not in a compressed way. 117 ie if there are some masked or indexed point on the domain. Valid only on server side. 118 \return true if domain can be writtedn in a compressed way 119 */ 120 bool isCompressible(void) { if (!isCompressibleComputed_) computeIsCompressible() ; return isCompressible_ ;} 121 private : 122 bool isCompressible_ ; /** specify if the domain can be written in a compressed way */ 123 bool isCompressibleComputed_=false ; /** Indicate if compressability has been computed*/ 124 void computeIsCompressible() ; 125 126 public : 116 127 std::vector<int> getNbGlob(); 117 128 bool isEqual(CDomain* domain); … … 296 307 std::map<int, std::vector<int> > connectedServerRank_; 297 308 298 //! True if and only if the data defined on the domain can be outputted in a compressed way299 bool isCompressible_;300 309 bool isRedistributed_; 301 310 TransMapTypes transformationMap_; … … 332 341 public: 333 342 void computeRemoteElement(CContextClient* client, EDistributionType) ; 334 void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, const string& domainId="") ; 343 void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector, 344 const string& domainId="") ; 335 345 336 346 static void recvDomainDistribution(CEventServer& event) ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r1943 r1956 2681 2681 2682 2682 vector<CScattererConnector*> scattererConnectors ; 2683 CScattererConnector* scattererConnector; 2683 2684 for(int i=0 ; i<elements.size() ; i++) 2684 2685 { … … 2687 2688 CDomain* domain = (CDomain*) elements[i].ptr ; 2688 2689 sendAddDomain(domain->getId(),client) ; 2689 domain->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i) ) ;2690 scattererConnectors.push_back( domain->getClientToServerConnector(client)) ;2690 domain->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector) ; 2691 scattererConnectors.push_back(scattererConnector) ; 2691 2692 } 2692 2693 else if (elements[i].type==TYPE_AXIS) … … 2694 2695 CAxis* axis = (CAxis*) elements[i].ptr ; 2695 2696 sendAddAxis(axis->getId(),client) ; 2696 axis->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i) ) ;2697 scattererConnectors.push_back( axis->getClientToServerConnector(client)) ;2697 axis->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector) ; 2698 scattererConnectors.push_back(scattererConnector) ; 2698 2699 } 2699 2700 else if (elements[i].type==TYPE_SCALAR) … … 2701 2702 CScalar* scalar = (CScalar*) elements[i].ptr ; 2702 2703 sendAddScalar(scalar->getId(),client) ; 2703 scalar->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i) ) ;2704 scattererConnectors.push_back(sca lar->getClientToServerConnector(client)) ;2704 scalar->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector) ; 2705 scattererConnectors.push_back(scattererConnector) ; 2705 2706 } 2706 2707 } … … 2717 2718 message<<getId() ; 2718 2719 gridScattererConnector.transfer(maskOut, client, event, message) ; 2719 2720 for(auto& it : scattererConnectors) delete it ; 2720 2721 2721 2722 vector<CScattererConnector*> clientToServerConnectors ; … … 2800 2801 void CGrid::sendGridToCouplerOut(CContextClient* client, const string& fieldId) 2801 2802 { 2802 if (sendGridToCouplerOut_done_.count(client)!=0) return ;2803 /* if (sendGridToCouplerOut_done_.count(client)!=0) return ; 2803 2804 else sendGridToCouplerOut_done_.insert(client) ; 2804 2805 … … 2872 2873 2873 2874 // compute the grid clientToServerConnector to send flux from client to servers 2874 clientToClientConnector_[client] = new CGridScattererConnector(clientToClientConnectors) ; 2875 clientToClientConnector_[client] = new CGridScattererConnector(clientToClientConnectors) ;*/ 2875 2876 } 2876 2877
Note: See TracChangeset
for help on using the changeset viewer.