Changeset 2335 for XIOS/dev


Ignore:
Timestamp:
06/15/22 15:20:29 (2 years ago)
Author:
jderouillat
Message:

Introduced a new service (named defaultServicesId which contains all gatherers and all IO servers) to manage oasis_enddef through the different levels of servers. OASIS integration is moved in a dedicated virtual class CThirdPartyDriver whose an instance is owned by CServer.

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

Legend:

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

    r2333 r2335  
    106106          MPI_Comm_split(globalComm, color, commRank, &clientComm) ; 
    107107        } 
    108         else // using oasis to split communicator 
    109         { 
    110           if (!is_MPI_Initialized) oasis_init(codeId) ; 
    111           oasis_get_localcomm(clientComm) ; 
     108        else 
     109        { 
     110          ERROR("void CClient::initialize(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm)", <<"OASIS usage is set. In these conditions, XIOS initialization needs the local_comm created by OASIS."<<endl) ; 
    112111        } 
    113112      } 
     
    507506      if (!is_MPI_Initialized) 
    508507      { 
    509         if (CXios::usingOasis) oasis_finalize(); 
    510         else MPI_Finalize() ; 
     508        if (!CXios::usingOasis) MPI_Finalize() ; 
    511509      } 
    512510       
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.cpp

    r2329 r2335  
    2727  const string CXios::defaultServerId="default_server_id" ; 
    2828  const string CXios::defaultGathererId="default_gatherer_id" ; 
     29  const string CXios::defaultServicesId="default_services_id" ; 
    2930   
    3031  bool CXios::xiosStack = true; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.hpp

    r2329 r2335  
    7171     static const string defaultServerId ; 
    7272     static const string defaultGathererId ; 
    73  
     73     static const string defaultServicesId ; 
    7474 
    7575     static CRegistryManager* registryManager_ ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/services_manager.hpp

    r2260 r2335  
    2323    static const int IO_SERVER=2 ; 
    2424    static const int OUT_SERVER=3 ; 
     25    static const int ALL_SERVICES=4 ; 
    2526 
    2627    public: 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/server.cpp

    r2334 r2335  
    4848    CEventScheduler* CServer::eventScheduler = 0; 
    4949    CServersRessource* CServer::serversRessource_=nullptr ; 
     50    CThirdPartyDriver* CServer::driver_ =nullptr ; 
    5051 
    5152        
     
    9798      else // using OASIS 
    9899      { 
    99         if (!is_MPI_Initialized) oasis_init(CXios::xiosCodeId); 
    100  
    101         oasis_get_localcomm(serverComm); 
     100        if (!is_MPI_Initialized) driver_ = new CThirdPartyDriver(); 
     101 
     102        driver_->getComponentCommunicator( serverComm ); 
    102103      } 
    103104      MPI_Comm_dup(serverComm, &intraComm_); 
     
    200201          servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultGathererId, CServicesManager::GATHERER, nprocsGatherer, 1) ; 
    201202          servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultServerId, CServicesManager::OUT_SERVER, nprocsServer, nbPoolsServer2) ; 
     203 
     204 
    202205        } 
     206        servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultServicesId, CServicesManager::ALL_SERVICES, nbRessources, 1) ; 
    203207      } 
    204208      CTimer::get("XIOS initialize").suspend() ; 
     
    381385         boost::hash<string> hashString; 
    382386         size_t hashId = hashString("oasis_enddef"); 
    383          if (CXios::getPoolRessource()->getService(CXios::defaultServerId,0)->getEventScheduler()->queryEvent(0,hashId)) 
     387         if (CXios::getPoolRessource()->getService(CXios::defaultServicesId,0)->getEventScheduler()->queryEvent(0,hashId)) 
    384388         { 
    385            CXios::getPoolRessource()->getService(CXios::defaultServerId,0)->getEventScheduler()->popEvent() ; 
    386            oasis_enddef() ; 
     389           CXios::getPoolRessource()->getService(CXios::defaultServicesId,0)->getEventScheduler()->popEvent() ; 
     390           driver_->endSynchronizedDefinition() ; 
    387391           eventSent=false ; 
    388392         } 
     
    397401           boost::hash<string> hashString; 
    398402           size_t hashId = hashString("oasis_enddef"); 
    399            CXios::getPoolRessource()->getService(CXios::defaultServerId,0)->getEventScheduler()->registerEvent(0,hashId); 
     403           CXios::getPoolRessource()->getService(CXios::defaultServicesId,0)->getEventScheduler()->registerEvent(0,hashId); 
    400404           eventSent=true ; 
    401405       } 
     
    427431      if (!is_MPI_Initialized) 
    428432      { 
    429         if (CXios::usingOasis) oasis_finalize(); 
     433        if (CXios::usingOasis) delete driver_; 
    430434        else MPI_Finalize() ; 
    431435      } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/server.hpp

    r2333 r2335  
    77#include "mpi.hpp" 
    88#include "event_scheduler.hpp" 
     9#include "oasis_cinterface.hpp" 
    910 
    1011namespace xios 
     
    1213    class CServersRessource ; 
    1314 
     15    class CThirdPartyDriver 
     16    { 
     17      public: 
     18        CThirdPartyDriver() 
     19        { 
     20          oasis_init(CXios::xiosCodeId); 
     21        }; 
     22        virtual ~CThirdPartyDriver() 
     23        { 
     24          oasis_finalize(); 
     25        }; 
     26        virtual void endSynchronizedDefinition() 
     27        { 
     28          oasis_enddef(); 
     29        }; 
     30        virtual void getComponentCommunicator(MPI_Comm &intraComm) 
     31        { 
     32          oasis_get_localcomm(intraComm); 
     33        }; 
     34    }; 
     35   
    1436    class CServer 
    1537    { 
     
    80102        static StdOFStream m_errorStream; 
    81103        static CServersRessource* serversRessource_  ; 
     104 
     105        static CThirdPartyDriver* driver_; 
    82106    }; 
    83107} 
Note: See TracChangeset for help on using the changeset viewer.