Changeset 2310 for XIOS/dev


Ignore:
Timestamp:
03/15/22 14:56:16 (3 years ago)
Author:
ymipsl
Message:

Implement small garbage collector for unfreed MPI windows and communicator.

YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src
Files:
1 added
6 edited

Legend:

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

    r2274 r2310  
    492492      CContext::removeAllContexts() ; // free memory for related context  
    493493 
    494  
     494      CXios::getMpiGarbageCollector().release() ; // release unfree MPI ressources 
    495495      if (!is_MPI_Initialized) 
    496496      { 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/context_client.cpp

    r2287 r2310  
    335335        MPI_Intercomm_create(commSelf_, 0, interCommMerged_, clientSize+rank, 0, &interComm) ; 
    336336        MPI_Intercomm_merge(interComm, false, &winComm_[rank]) ; 
     337        CXios::getMpiGarbageCollector().registerCommunicator(winComm_[rank]) ; 
    337338        MPI_Comm_free(&interComm) ; 
    338339        windows_[rank].resize(2) ; 
     340         
    339341        MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][0]); 
     342        CXios::getMpiGarbageCollector().registerWindow(windows_[rank][0]) ; 
     343         
    340344        MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][1]);    
     345        CXios::getMpiGarbageCollector().registerWindow(windows_[rank][1]) ; 
     346 
    341347        CTimer::get("create Windows").suspend() ; 
    342348      } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/context_server.cpp

    r2309 r2310  
    162162        MPI_Intercomm_create(commSelf_, 0, interCommMerged_, rank, 0 , &interComm) ; 
    163163        MPI_Intercomm_merge(interComm, true, &winComm_[rank]) ; 
     164        CXios::getMpiGarbageCollector().registerCommunicator(winComm_[rank]) ; 
     165        MPI_Comm_free(&interComm) ; 
    164166        windows_[rank].resize(2) ; 
    165167        MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][0]); 
     168        CXios::getMpiGarbageCollector().registerWindow(windows_[rank][0]) ; 
    166169        MPI_Win_create_dynamic(MPI_INFO_NULL, winComm_[rank], &windows_[rank][1]); 
     170        CXios::getMpiGarbageCollector().registerWindow(windows_[rank][1]) ; 
    167171        CTimer::get("create Windows").suspend() ; 
    168172        MPI_Barrier(winComm_[rank]) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.cpp

    r2282 r2310  
    5959  CRegistryManager*   CXios::registryManager_=nullptr ; 
    6060 
     61  CMpiGarbageCollector CXios::MpiGarbageCollector_  ; 
     62 
    6163  //! Parse configuration file and create some objects from it 
    6264  void CXios::initialize() 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.hpp

    r2209 r2310  
    1111#include "coupler_manager.hpp" 
    1212#include "registry_manager.hpp" 
     13#include "mpi_garbage_collector.hpp" 
    1314 
    1415namespace xios 
     
    7576     static CContextsManager* contextsManager_ ; 
    7677     static CDaemonsManager* daemonsManager_ ; 
    77       
    78  
     78     static CMpiGarbageCollector MpiGarbageCollector_  ; 
     79    public: 
     80     static CMpiGarbageCollector& getMpiGarbageCollector(void) { return MpiGarbageCollector_ ; } 
    7981    public: 
    8082     //! Setting xios to use server mode 
     
    111113     static CDaemonsManager*    getDaemonsManager(void) { return daemonsManager_ ;} 
    112114     static CPoolRessource*     getPoolRessource(void) ; 
    113  
     115      
    114116     static MPI_Comm getGlobalComm(void) { return globalComm ;} 
    115117     static MPI_Comm getXiosComm(void) { return xiosComm ;} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/server.cpp

    r2290 r2310  
    320320      CContext::removeAllContexts() ; // free memory for related context 
    321321           
     322      CXios::getMpiGarbageCollector().release() ; // release unfree MPI ressources 
     323 
    322324      if (!is_MPI_Initialized) 
    323325      { 
Note: See TracChangeset for help on using the changeset viewer.