Changeset 2241


Ignore:
Timestamp:
09/30/21 14:25:40 (3 years ago)
Author:
jderouillat
Message:

Clean Context and it members before MPI_Finalize (to avoid some MPI call after MPI_Finalize, such as MPI_Free_mem in ServerBuffer? destructor)

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

Legend:

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

    r2212 r2241  
    175175 
    176176#endif 
     177      
     178     // Delete CContext 
     179     xios_map<StdString, xios_map<StdString, std::shared_ptr<CContext> > >* contextMap = CObjectTemplate<CContext>::GetAllMapobject(); 
     180     for(auto it = contextMap->begin(); it != contextMap->end(); ++it) 
     181     { 
     182       for(auto it2 = it->second.begin(); it2 != it->second.end(); ++it2) 
     183       { 
     184           std::shared_ptr<CContext> todel = it2->second; 
     185           todel.reset(); 
     186       } 
     187       it->second.clear(); 
     188 
     189       std::vector<std::shared_ptr<CContext> >*  contextVect = CObjectTemplate<CContext>::GetAllVectobjectPtr(it->first); 
     190       for(auto it = contextVect->begin(); it != contextVect->end(); ++it) 
     191       { 
     192           it->reset(); 
     193       } 
     194       contextVect->clear(); 
     195        
     196     } 
     197     contextMap->clear(); 
     198      
    177199  } 
    178200 
     
    225247    report(0)<<CMemChecker::getAllCumulatedMem() ; 
    226248    CServer::closeInfoStream(); 
     249     
     250    // Delete CContext 
     251    xios_map<StdString, xios_map<StdString, std::shared_ptr<CContext> > >* contextMap = CObjectTemplate<CContext>::GetAllMapobject(); 
     252    for(auto it = contextMap->begin(); it != contextMap->end(); ++it) 
     253    { 
     254      for(auto it2 = it->second.begin(); it2 != it->second.end(); ++it2) 
     255      { 
     256          std::shared_ptr<CContext> todel = it2->second; 
     257          todel.reset(); 
     258      } 
     259      it->second.clear(); 
     260 
     261      std::vector<std::shared_ptr<CContext> >*  contextVect = CObjectTemplate<CContext>::GetAllVectobjectPtr(it->first); 
     262      for(auto it = contextVect->begin(); it != contextVect->end(); ++it) 
     263      { 
     264          it->reset(); 
     265      } 
     266      contextVect->clear(); 
     267       
     268    } 
     269    contextMap->clear(); 
    227270  } 
    228271 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp

    r2203 r2241  
    6969         static std::vector<std::shared_ptr<DerivedType> > & 
    7070            GetAllVectobject(const StdString & contextId); 
     71         static std::vector<std::shared_ptr<DerivedType> > * 
     72            GetAllVectobjectPtr(const StdString & contextId); 
     73 
     74         static xios_map<StdString, xios_map<StdString, std::shared_ptr<DerivedType> > >* 
     75            GetAllMapobject(); 
     76 
    7177 
    7278         /// Destructeur /// 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template_impl.hpp

    r2203 r2241  
    6767   { 
    6868      return (CObjectTemplate<T>::AllVectObj[contextId]); 
     69   } 
     70   template <class T> 
     71      std::vector<std::shared_ptr<T> > * 
     72         CObjectTemplate<T>::GetAllVectobjectPtr(const StdString & contextId) 
     73   { 
     74      return &(CObjectTemplate<T>::AllVectObj[contextId]); 
     75   } 
     76 
     77  template <class T> 
     78      xios_map<StdString, xios_map<StdString, std::shared_ptr<T> > >* 
     79         CObjectTemplate<T>::GetAllMapobject() 
     80   { 
     81      return &(CObjectTemplate<T>::AllMapObj); 
    6982   } 
    7083 
Note: See TracChangeset for help on using the changeset viewer.