Ignore:
Timestamp:
08/25/21 19:31:05 (3 years ago)
Author:
ymipsl
Message:

Revisiting registry management and make it working.
YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src/node
Files:
2 edited

Legend:

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

    r2199 r2209  
    428428 
    429429      string contextRegistryId=getId() ; 
    430       registryIn=new CRegistry(intraComm); 
     430      registryIn=new CRegistry(CXios::getRegistryManager()->getRegistryIn()); 
    431431      registryIn->setPath(contextRegistryId) ; 
    432432       
    433       int commRank ; 
    434       MPI_Comm_rank(intraComm_,&commRank) ; 
    435       if (commRank==0) registryIn->fromFile("xios_registry.bin") ; 
    436       registryIn->bcastRegistry() ; 
    437433      registryOut=new CRegistry(intraComm_) ; 
    438434      registryOut->setPath(contextRegistryId) ; 
     
    465461     CXios::getContextsManager()->getContextId(getId(), contextId_, intraComm) ; 
    466462      
    467      registryIn=new CRegistry(intraComm); 
    468      registryIn->setPath(contextId_) ; 
    469       
    470      int commRank ; 
    471      MPI_Comm_rank(intraComm_,&commRank) ; 
    472      if (commRank==0) registryIn->fromFile("xios_registry.bin") ; 
    473      
    474      registryIn->bcastRegistry() ; 
    475      registryOut=new CRegistry(intraComm) ; 
    476      registryOut->setPath(contextId_) ; 
     463     string contextRegistryId=getId() ; 
     464     registryIn=new CRegistry(CXios::getRegistryManager()->getRegistryIn()); 
     465     registryIn->setPath(contextRegistryId) ; 
     466       
     467     registryOut=new CRegistry(intraComm_) ; 
     468     registryOut->setPath(contextRegistryId) ; 
    477469 
    478470   } 
     
    715707   { 
    716708      registryOut->hierarchicalGatherRegistry() ; 
    717       if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ; 
     709      if (server->intraCommRank==0) CXios::getRegistryManager()->merge(*registryOut) ; 
    718710 
    719711      if (serviceType_==CServicesManager::CLIENT) 
     
    15741566             return true; 
    15751567             break; 
    1576            case EVENT_ID_SEND_REGISTRY: 
    1577              recvRegistry(event); 
    1578              return true; 
    1579              break; 
    15801568           case EVENT_ID_COUPLER_IN_READY: 
    15811569             recvCouplerInReady(event); 
     
    21062094  CATCH 
    21072095 
    2108      //! Server side: Receive a message to do some post processing 
    2109   void CContext::recvRegistry(CEventServer& event) 
    2110   TRY 
    2111   { 
    2112     CBufferIn* buffer=event.subEvents.begin()->buffer; 
    2113     getCurrent()->recvRegistry(*buffer); 
    2114   } 
    2115   CATCH 
    2116  
    2117   void CContext::recvRegistry(CBufferIn& buffer) 
    2118   TRY 
    2119   { 
    2120     if (server->intraCommRank==0) 
    2121     { 
    2122       CRegistry registry(server->intraComm) ; 
    2123       registry.fromBuffer(buffer) ; 
    2124       registryOut->mergeRegistry(registry) ; 
    2125     } 
    2126   } 
    2127   CATCH_DUMP_ATTR 
    2128  
    2129   void CContext::sendRegistry(void) 
    2130   TRY 
    2131   { 
    2132     registryOut->hierarchicalGatherRegistry() ; 
    2133  
    2134     int nbSrvPools ; 
    2135     if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; 
    2136     else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; 
    2137     else nbSrvPools = 0 ; 
    2138     CContextClient* contextClientTmp ; 
    2139  
    2140     for (int i = 0; i < nbSrvPools; ++i) 
    2141     { 
    2142       if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; 
    2143       else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; 
    2144  
    2145       CEventClient event(CContext::GetType(), CContext::EVENT_ID_SEND_REGISTRY); 
    2146       if (contextClientTmp->isServerLeader()) 
    2147       { 
    2148         CMessage msg ; 
    2149         if (contextClientTmp->clientRank==0) msg<<*registryOut ; 
    2150         const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    2151         for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    2152              event.push(*itRank,1,msg); 
    2153         contextClientTmp->sendEvent(event); 
    2154       } 
    2155       else contextClientTmp->sendEvent(event); 
    2156     } 
    2157   } 
    2158   CATCH_DUMP_ATTR 
    2159  
    21602096   
    21612097  void CContext::sendFinalizeClient(CContextClient* contextClient, const string& contextClientId) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp

    r2204 r2209  
    5555           EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR, 
    5656           EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE, 
    57            EVENT_ID_SEND_REGISTRY, 
    5857           EVENT_ID_CONTEXT_FINALIZE_CLIENT, 
    5958           EVENT_ID_COUPLER_IN_READY, 
     
    170169         void sendRefDomainsAxisScalars(const std::vector<CFile*>& activeFiles); 
    171170         //!< after be gathered to the root process of the context, merged registry is sent to the root process of the servers 
    172          void sendRegistry(void) ; 
    173171         void sendFinalizeClient(CContextClient* contextClient, const string& contextClientId); 
    174172          
     
    189187         static void recvSolveInheritanceContext(CEventServer& event); 
    190188         void recvSolveInheritanceContext(CBufferIn& buffer); 
    191          static void recvRegistry(CEventServer& event) ; 
    192          void recvRegistry(CBufferIn& buffer) ; //!< registry is received by the servers 
    193189         static void recvFinalizeClient(CEventServer& event) ; 
    194190         void recvFinalizeClient(CBufferIn& buffer); 
Note: See TracChangeset for help on using the changeset viewer.