Changeset 2266 for XIOS


Ignore:
Timestamp:
12/01/21 14:29:36 (3 years ago)
Author:
ymipsl
Message:

Fix problem from previous commit when deallocating context.
YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src
Files:
5 edited

Legend:

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

    r2265 r2266  
    487487      CTimer::get("XIOS init/finalize",false).suspend() ; 
    488488      CTimer::get("XIOS").suspend() ; 
     489      CXios::finalizeDaemonsManager() ; 
    489490      CContext::removeAllContexts() ; // free memory for related context  
    490       CXios::finalizeDaemonsManager() ; 
     491      
    491492 
    492493      if (!is_MPI_Initialized) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/interface/c/icdata.cpp

    r2265 r2266  
    135135     CContext* context = CContext::getCurrent(); 
    136136     context->finalize(); 
    137      CContext::removeContext(context->getId()) ; 
     137     CXios::getDaemonsManager()->eventLoop() ; 
    138138     CTimer::get("XIOS context finalize").suspend(); 
    139139     CTimer::get("XIOS").suspend(); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/daemons_manager.cpp

    r2246 r2266  
    3232  CDaemonsManager::~CDaemonsManager() 
    3333  { 
    34     CXios::finalizeContextsManager() ; 
    35     CXios::finalizeCouplerManager() ; 
    36     CXios::finalizeServicesManager() ; 
    37     CXios::finalizeRessourcesManager() ; 
    38     CXios::finalizeRegistryManager() ; 
     34    finalize() ; 
    3935  } 
    4036 
     
    5854  }  
    5955 
     56  bool CDaemonsManager::finalize(void) 
     57  { 
     58    if (!isFinalized_) 
     59    { 
     60      if (isServer_) CServer::getServersRessource()->finalizeSignal() ; 
     61      else CXios::getPoolRessource()->finalizeSignal() ; 
     62      while(!eventLoop()) ; 
     63      MPI_Barrier( CXios::getXiosComm()) ; 
     64      CXios::finalizeContextsManager() ; 
     65      CXios::finalizeCouplerManager() ; 
     66      CXios::finalizeServicesManager() ; 
     67      CXios::finalizeRessourcesManager() ; 
     68      CXios::finalizeRegistryManager() ; 
     69      isFinalized_=true ; 
     70    } 
     71  } 
     72 
    6073} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/daemons_manager.hpp

    r2130 r2266  
    2020    bool isScheduledContext(size_t hashId) { return scheduledContext_==hashId ;} //!< for attached mode, return true if context server is sceduled 
    2121    void unscheduleContext(void) { scheduledContext_=0 ;} //!< for attached mode : unschedule context 
    22  
     22    bool finalize(void) ; 
    2323    private: 
    2424    bool isServer_ ; 
    2525    size_t scheduledContext_ = 0 ; //!< Hash id of the next scehduled context for attached mode 
     26    bool isFinalized_=false ; 
    2627  } ; 
    2728} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/server.cpp

    r2265 r2266  
    313313 
    314314//      MPI_Comm_free(&intraComm); 
     315      CXios::finalizeDaemonsManager(); 
    315316      CContext::removeAllContexts() ; // free memory for related context  
    316       CXios::finalizeDaemonsManager(); 
    317317       
    318318      if (!is_MPI_Initialized) 
Note: See TracChangeset for help on using the changeset viewer.