Changeset 799 for XIOS/branchs


Ignore:
Timestamp:
11/27/15 09:55:05 (8 years ago)
Author:
rlacroix
Message:

Add registry

Location:
XIOS/branchs/xios-1.0/src
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-1.0/src/buffer_in.cpp

    r738 r799  
    2020    { 
    2121      own=false ; 
    22       realloc(0,0) ;       
     22      size_=0 ; 
    2323    } 
    2424 
     
    5252    } 
    5353 
    54     size_t CBufferIn::size(void) 
     54    size_t CBufferIn::bufferSize(void) 
    5555    { 
    5656      return size_ ; 
  • XIOS/branchs/xios-1.0/src/buffer_in.hpp

    r501 r799  
    4242 
    4343      void* ptr(void) ; 
     44      void* start(void) { return begin ; } 
    4445 
    4546       
    4647      size_t remain(void) ; 
    4748      size_t count(void) ;                           
    48       size_t size(void) ;                          
     49      size_t bufferSize(void) ; 
    4950      ~CBufferIn() ; 
    5051 
  • XIOS/branchs/xios-1.0/src/buffer_out.cpp

    r501 r799  
    1414    { 
    1515      own=false ; 
    16       realloc(0,0) ;       
     16      size_=0 ; 
    1717    } 
    1818 
     
    5757    } 
    5858 
    59     size_t CBufferOut::size(void) 
     59    size_t CBufferOut::bufferSize(void) 
    6060    { 
    6161      return size_ ; 
  • XIOS/branchs/xios-1.0/src/buffer_out.hpp

    r501 r799  
    4444       
    4545      void* ptr(void) ; 
     46      void* start(void) { return begin ; } 
    4647             
    4748      size_t remain(void) ; 
    4849      size_t count(void) ; 
    49       size_t size(void) ; 
     50      size_t bufferSize(void) ; 
    5051                             
    5152      ~CBufferOut() ; 
  • XIOS/branchs/xios-1.0/src/cxios.cpp

    r548 r799  
    1010#include <new> 
    1111#include "memtrack.hpp" 
     12#include "registry.hpp" 
    1213 
    1314namespace xios 
     
    2829  double CXios::defaultBufferServerFactorSize=2 ; 
    2930  bool CXios::printLogs2Files; 
     31  CRegistry* CXios::globalRegistry = 0; 
    3032 
    3133 
     
    5254 
    5355    CClient::initialize(codeId,localComm,returnComm) ; 
     56    if (CClient::getRank()==0) globalRegistry = new CRegistry(returnComm) ; 
    5457 
    5558    if (usingServer) isServer=false; 
     
    7174  { 
    7275     CClient::finalize() ; 
     76     if (CClient::getRank()==0) 
     77     { 
     78       info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 
     79       globalRegistry->toFile("xios_registry.bin") ; 
     80       delete globalRegistry ; 
     81     } 
    7382     CClient::closeInfoStream(); 
    7483 
     
    8998    // Initialize all aspects MPI 
    9099    CServer::initialize(); 
     100    if (CServer::getRank()==0) globalRegistry = new CRegistry(CServer::intraComm) ; 
    91101 
    92102    if (printLogs2Files) 
     
    106116    // Finalize 
    107117    CServer::finalize(); 
     118    if (CServer::getRank()==0) 
     119    { 
     120      info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 
     121      globalRegistry->toFile("xios_registry.bin") ; 
     122      delete globalRegistry ; 
     123    } 
    108124    CServer::closeInfoStream(); 
    109125  } 
  • XIOS/branchs/xios-1.0/src/cxios.hpp

    r548 r799  
    44#include "xmlioserver_spl.hpp" 
    55#include "mpi.hpp" 
     6#include "registry.hpp" 
    67 
    78namespace xios 
     
    4243     static double bufferServerFactorSize ; 
    4344     static double defaultBufferServerFactorSize ; 
     45     static CRegistry* globalRegistry ; //!< global registry which is written by the root process of the servers 
    4446 
    4547     public: 
  • XIOS/branchs/xios-1.0/src/node/context.cpp

    r535 r799  
    77#include "duration.hpp" 
    88 
     9#include "cxios.hpp" 
    910#include "context_client.hpp" 
    1011#include "context_server.hpp" 
     
    268269     hasClient=true ; 
    269270     client = new CContextClient(this,intraComm, interComm) ; 
     271     registryIn=new CRegistry(intraComm); 
     272     registryIn->setPath(getId()) ; 
     273     if (client->clientRank==0) registryIn->fromFile("xios_registry.bin") ; 
     274     registryIn->bcastRegistry() ; 
     275 
     276     registryOut=new CRegistry(intraComm) ; 
     277     registryOut->setPath(getId()) ; 
    270278   }  
    271279 
     
    279287     hasServer=true ; 
    280288     server = new CContextServer(this,intraComm,interComm) ; 
     289     registryIn=new CRegistry(intraComm); 
     290     registryIn->setPath(getId()) ; 
     291     if (server->intraCommRank==0) registryIn->fromFile("xios_registry.bin") ; 
     292     registryIn->bcastRegistry() ; 
     293     registryOut=new CRegistry(intraComm) ; 
     294     registryOut->setPath(getId()) ; 
    281295   }  
    282296 
     
    290304      if (hasClient && !hasServer) 
    291305      { 
     306         if (hasClient) sendRegistry() ; 
    292307         client->finalize() ; 
    293308      } 
     
    295310      { 
    296311        closeAllFile() ; 
     312        registryOut->hierarchicalGatherRegistry() ; 
     313        if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ; 
    297314      } 
    298315   } 
     
    429446             return true ; 
    430447             break ; 
     448           case EVENT_ID_SEND_REGISTRY: 
     449            recvRegistry(event); 
     450            return true; 
     451           break; 
    431452           default : 
    432453             ERROR("bool CContext::dispatchEvent(CEventServer& event)", 
     
    564585    return (context); 
    565586  } 
     587 
     588  void CContext::recvRegistry(CEventServer& event) 
     589  { 
     590    CBufferIn* buffer=event.subEvents.begin()->buffer; 
     591    string id; 
     592    *buffer>>id; 
     593    get(id)->recvRegistry(*buffer); 
     594  } 
     595 
     596  void CContext::recvRegistry(CBufferIn& buffer) 
     597  { 
     598    if (server->intraCommRank==0) 
     599    { 
     600      CRegistry registry(server->intraComm) ; 
     601      registry.fromBuffer(buffer) ; 
     602      registryOut->mergeRegistry(registry) ; 
     603    } 
     604  } 
     605 
     606  void CContext::sendRegistry(void) 
     607  { 
     608    registryOut->hierarchicalGatherRegistry() ; 
     609 
     610    CEventClient event(CContext::GetType(), CContext::EVENT_ID_SEND_REGISTRY); 
     611    if (client->isServerLeader()) 
     612    { 
     613       CMessage msg ; 
     614       msg<<this->getId(); 
     615       if (client->clientRank==0) msg<<*registryOut ; 
     616       event.push(client->getServerLeader(),1,msg); 
     617       client->sendEvent(event); 
     618     } 
     619     else client->sendEvent(event); 
     620  } 
    566621} // namespace xios 
  • XIOS/branchs/xios-1.0/src/node/context.hpp

    r501 r799  
    1313 
    1414#include "mpi.hpp" 
     15 
     16#include "registry.hpp" 
    1517 
    1618 
     
    4244         { 
    4345           EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR, 
    44            EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE 
     46           EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE, 
     47           EVENT_ID_SEND_REGISTRY 
    4548         } ; 
    4649          
     
    125128         void sendUpdateCalendar(int step) ; 
    126129         void sendCreateFileHeader(void) ; 
     130         void sendRegistry(void) ; //!< after be gathered to the root process of the context, merged registry is sent to the root process of the servers 
    127131         static void recvUpdateCalendar(CEventServer& event) ; 
    128132         void recvUpdateCalendar(CBufferIn& buffer) ; 
     
    130134         static void recvCreateFileHeader(CEventServer& event) ; 
    131135         void recvCreateFileHeader(CBufferIn& buffer) ; 
     136         static void recvRegistry(CEventServer& event) ; 
     137         void recvRegistry(CBufferIn& buffer) ; //!< registry is received by the root process of the servers 
    132138         static CContext* getCurrent(void) ; 
    133139         static CContextGroup* getRoot(void) ; 
     
    151157         static shared_ptr<CContextGroup> root ; 
    152158 
    153  
     159         CRegistry* registryIn ;  //!< input registry which is read from file 
     160         CRegistry* registryOut ; //!< output registry which will be wrote on file at the finalize 
    154161   }; // class CContext 
    155162 
Note: See TracChangeset for help on using the changeset viewer.