Changeset 799
- Timestamp:
- 11/27/15 09:55:05 (9 years ago)
- 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 20 20 { 21 21 own=false ; 22 realloc(0,0) ;22 size_=0 ; 23 23 } 24 24 … … 52 52 } 53 53 54 size_t CBufferIn:: size(void)54 size_t CBufferIn::bufferSize(void) 55 55 { 56 56 return size_ ; -
XIOS/branchs/xios-1.0/src/buffer_in.hpp
r501 r799 42 42 43 43 void* ptr(void) ; 44 void* start(void) { return begin ; } 44 45 45 46 46 47 size_t remain(void) ; 47 48 size_t count(void) ; 48 size_t size(void) ;49 size_t bufferSize(void) ; 49 50 ~CBufferIn() ; 50 51 -
XIOS/branchs/xios-1.0/src/buffer_out.cpp
r501 r799 14 14 { 15 15 own=false ; 16 realloc(0,0) ;16 size_=0 ; 17 17 } 18 18 … … 57 57 } 58 58 59 size_t CBufferOut:: size(void)59 size_t CBufferOut::bufferSize(void) 60 60 { 61 61 return size_ ; -
XIOS/branchs/xios-1.0/src/buffer_out.hpp
r501 r799 44 44 45 45 void* ptr(void) ; 46 void* start(void) { return begin ; } 46 47 47 48 size_t remain(void) ; 48 49 size_t count(void) ; 49 size_t size(void) ;50 size_t bufferSize(void) ; 50 51 51 52 ~CBufferOut() ; -
XIOS/branchs/xios-1.0/src/cxios.cpp
r548 r799 10 10 #include <new> 11 11 #include "memtrack.hpp" 12 #include "registry.hpp" 12 13 13 14 namespace xios … … 28 29 double CXios::defaultBufferServerFactorSize=2 ; 29 30 bool CXios::printLogs2Files; 31 CRegistry* CXios::globalRegistry = 0; 30 32 31 33 … … 52 54 53 55 CClient::initialize(codeId,localComm,returnComm) ; 56 if (CClient::getRank()==0) globalRegistry = new CRegistry(returnComm) ; 54 57 55 58 if (usingServer) isServer=false; … … 71 74 { 72 75 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 } 73 82 CClient::closeInfoStream(); 74 83 … … 89 98 // Initialize all aspects MPI 90 99 CServer::initialize(); 100 if (CServer::getRank()==0) globalRegistry = new CRegistry(CServer::intraComm) ; 91 101 92 102 if (printLogs2Files) … … 106 116 // Finalize 107 117 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 } 108 124 CServer::closeInfoStream(); 109 125 } -
XIOS/branchs/xios-1.0/src/cxios.hpp
r548 r799 4 4 #include "xmlioserver_spl.hpp" 5 5 #include "mpi.hpp" 6 #include "registry.hpp" 6 7 7 8 namespace xios … … 42 43 static double bufferServerFactorSize ; 43 44 static double defaultBufferServerFactorSize ; 45 static CRegistry* globalRegistry ; //!< global registry which is written by the root process of the servers 44 46 45 47 public: -
XIOS/branchs/xios-1.0/src/node/context.cpp
r535 r799 7 7 #include "duration.hpp" 8 8 9 #include "cxios.hpp" 9 10 #include "context_client.hpp" 10 11 #include "context_server.hpp" … … 268 269 hasClient=true ; 269 270 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()) ; 270 278 } 271 279 … … 279 287 hasServer=true ; 280 288 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()) ; 281 295 } 282 296 … … 290 304 if (hasClient && !hasServer) 291 305 { 306 if (hasClient) sendRegistry() ; 292 307 client->finalize() ; 293 308 } … … 295 310 { 296 311 closeAllFile() ; 312 registryOut->hierarchicalGatherRegistry() ; 313 if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ; 297 314 } 298 315 } … … 429 446 return true ; 430 447 break ; 448 case EVENT_ID_SEND_REGISTRY: 449 recvRegistry(event); 450 return true; 451 break; 431 452 default : 432 453 ERROR("bool CContext::dispatchEvent(CEventServer& event)", … … 564 585 return (context); 565 586 } 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 } 566 621 } // namespace xios -
XIOS/branchs/xios-1.0/src/node/context.hpp
r501 r799 13 13 14 14 #include "mpi.hpp" 15 16 #include "registry.hpp" 15 17 16 18 … … 42 44 { 43 45 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 45 48 } ; 46 49 … … 125 128 void sendUpdateCalendar(int step) ; 126 129 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 127 131 static void recvUpdateCalendar(CEventServer& event) ; 128 132 void recvUpdateCalendar(CBufferIn& buffer) ; … … 130 134 static void recvCreateFileHeader(CEventServer& event) ; 131 135 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 132 138 static CContext* getCurrent(void) ; 133 139 static CContextGroup* getRoot(void) ; … … 151 157 static shared_ptr<CContextGroup> root ; 152 158 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 154 161 }; // class CContext 155 162
Note: See TracChangeset
for help on using the changeset viewer.