Changeset 1956


Ignore:
Timestamp:
10/08/20 13:10:29 (4 years ago)
Author:
ymipsl
Message:

Xios coupling

  • fix problem when sending grid mask from client to server
  • remove methods about grid compression, which will be managed in other ways

YM

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  
    9999 
    100100   /*! 
    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. 
    104105    */ 
    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 ; 
    109116   } 
    110117   CATCH 
     
    462469  CATCH_DUMP_ATTR 
    463470 
    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  
    475472  /*! 
    476473    Dispatch event from the lower communication layer then process event according to its type 
     
    16471644  } 
    16481645  
    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) 
    16501648  { 
    16511649    string serverAxisId = axisId.empty() ? this->getId() : axisId ; 
     
    16561654    CDistributedElement scatteredElement(n_glo,globalIndex) ; 
    16571655    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() ; 
    16611659     
    16621660    // phase 0 
     
    16721670    CMessage message1 ; 
    16731671    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) ; 
    16771675   
    16781676    // phase 2 send the mask : data index + mask2D 
     
    16871685    map<int,CArray<size_t,1>> workflowGlobalIndex ; 
    16881686    map<int,CArray<bool,1>> maskOut2 ;  
    1689     scattererConnector.transfer(maskOut, maskOut2) ; 
     1687    scattererConnector->transfer(maskOut, maskOut2) ; 
    16901688    scatteredElement.addView(CElementView::WORKFLOW, maskOut2) ; 
    16911689    scatteredElement.getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; 
     
    17521750    else if (phasis==2) 
    17531751    { 
    1754       delete gathererConnector_ ; 
     1752//      delete gathererConnector_ ; 
    17551753      elementFrom_ = new  CDistributedElement(event) ; 
    17561754      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() ; 
    17591757    } 
    17601758   
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp

    r1943 r1956  
    8888         bool isWrittenCompressed(const StdString& filename) const; 
    8989         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: 
    91104 
    92105         /// Mutateur /// 
     
    120133                                    CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); 
    121134 
    122          void checkEligibilityForCompressedOutput(); 
    123135         size_t getGlobalWrittenSize(void) ; 
    124136 
     
    213225         std::set<StdString> relFiles, relFilesCompressed; 
    214226         TransMapTypes transformationMap_;          
    215          //! True if and only if the data defined on the axis can be outputted in a compressed way 
    216          bool isCompressible_; 
    217227 
    218228         std::map<int, map<int,int> > nbSenders; // Mapping of number of communicating client to a server 
     
    254264       public: 
    255265         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="") ; 
    257268 
    258269         static void recvAxisDistribution(CEventServer& event) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp

    r1934 r1956  
    24032403      // Check if some axis, domains or grids are eligible to for compressed indexed output. 
    24042404      // 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 ???? 
    24062406 
    24072407      // Check if some automatic time series should be generated 
     
    25392539   CATCH_DUMP_ATTR 
    25402540 
    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   
    25612542   //! Client side: Prepare the timeseries by adding the necessary files 
    25622543   void CContext::prepareTimeseries() 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp

    r1875 r1956  
    140140         void createFileHeader(void); 
    141141         void initReadFiles(void); 
    142          void checkAxisDomainsGridsEligibilityForCompressedOutput(); 
    143          void prepareTimeseries(void); 
     142        void prepareTimeseries(void); 
    144143         void solveOnlyRefOfEnabledFields(void);          
    145144         void buildFilterGraphOfEnabledFields(); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp

    r1943 r1956  
    246246 
    247247   /*! 
    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. 
    251252    */ 
    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 ; 
    256263   } 
    257264   CATCH 
     
    13071314   CATCH_DUMP_ATTR 
    13081315 
    1309    void CDomain::checkEligibilityForCompressedOutput(void) 
    1310    TRY 
    1311    { 
    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_ATTR 
    13161316 
    13171317   //---------------------------------------------------------------- 
     
    22952295  
    22962296 
    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) 
    22982299  TRY 
    22992300  { 
     
    23052306    CDistributedElement scatteredElement(ni_glo*nj_glo, globalIndex) ; 
    23062307    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),  
    23082309                                           context->getIntraComm(), client->getRemoteSize()) ; 
    2309     scattererConnector.computeConnector() ; 
     2310    scattererConnector->computeConnector() ; 
    23102311 
    23112312    // phase 0 
     
    23212322    CMessage message1 ; 
    23222323    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) ; 
    23242325     
    2325     sendDistributedAttributes(client, scattererConnector, domainId) ; 
     2326    sendDistributedAttributes(client, *scattererConnector, domainId) ; 
    23262327 
    23272328   
     
    23382339    map<int,CArray<size_t,1>> workflowGlobalIndex ; 
    23392340    map<int,CArray<bool,1>> maskOut2 ;  
    2340     scattererConnector.transfer(maskOut, maskOut2, false) ; 
     2341    scattererConnector->transfer(maskOut, maskOut2, false) ; 
    23412342    scatteredElement.addView(CElementView::WORKFLOW, maskOut2) ; 
    23422343    scatteredElement.getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; 
     
    24072408    else if (phasis==2) 
    24082409    { 
    2409       delete gathererConnector_ ; 
     2410//      delete gathererConnector_ ; 
    24102411      elementFrom_ = new  CDistributedElement(event) ; 
    24112412      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() ; 
    24142415    } 
    24152416  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp

    r1943 r1956  
    8787         void checkAttributesOnClient(); 
    8888         void checkAttributesOnClientAfterTransformation(); 
    89          void checkEligibilityForCompressedOutput(void); 
    9089 
    9190         void sendCheckedAttributes(); 
     
    112111         bool isEmpty(void) const; 
    113112         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 : 
    116127         std::vector<int> getNbGlob(); 
    117128         bool isEqual(CDomain* domain); 
     
    296307         std::map<int, std::vector<int> > connectedServerRank_; 
    297308 
    298          //! True if and only if the data defined on the domain can be outputted in a compressed way 
    299          bool isCompressible_; 
    300309         bool isRedistributed_; 
    301310         TransMapTypes transformationMap_;          
     
    332341       public: 
    333342         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="") ; 
    335345 
    336346         static void recvDomainDistribution(CEventServer& event) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r1943 r1956  
    26812681     
    26822682    vector<CScattererConnector*> scattererConnectors ; 
     2683    CScattererConnector* scattererConnector; 
    26832684    for(int i=0 ; i<elements.size() ; i++) 
    26842685    { 
     
    26872688         CDomain* domain = (CDomain*) elements[i].ptr ; 
    26882689         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) ; 
    26912692      } 
    26922693      else if (elements[i].type==TYPE_AXIS) 
     
    26942695        CAxis* axis = (CAxis*) elements[i].ptr ; 
    26952696        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) ; 
    26982699      } 
    26992700      else if (elements[i].type==TYPE_SCALAR) 
     
    27012702        CScalar* scalar = (CScalar*) elements[i].ptr ; 
    27022703        sendAddScalar(scalar->getId(),client) ; 
    2703         scalar->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i)) ; 
    2704         scattererConnectors.push_back(scalar->getClientToServerConnector(client)) ; 
     2704        scalar->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector) ; 
     2705        scattererConnectors.push_back(scattererConnector) ; 
    27052706      } 
    27062707    } 
     
    27172718    message<<getId() ;  
    27182719    gridScattererConnector.transfer(maskOut, client, event, message) ; 
    2719  
     2720    for(auto& it : scattererConnectors) delete it ; 
    27202721 
    27212722    vector<CScattererConnector*> clientToServerConnectors ; 
     
    28002801  void CGrid::sendGridToCouplerOut(CContextClient* client, const string& fieldId) 
    28012802  { 
    2802     if (sendGridToCouplerOut_done_.count(client)!=0) return ; 
     2803/*    if (sendGridToCouplerOut_done_.count(client)!=0) return ; 
    28032804    else sendGridToCouplerOut_done_.insert(client) ; 
    28042805  
     
    28722873     
    28732874    // compute the grid clientToServerConnector to send flux from client to servers 
    2874     clientToClientConnector_[client] = new CGridScattererConnector(clientToClientConnectors) ; 
     2875    clientToClientConnector_[client] = new CGridScattererConnector(clientToClientConnectors) ;*/ 
    28752876  } 
    28762877 
Note: See TracChangeset for help on using the changeset viewer.