Changeset 697 for XIOS/trunk/src/node
- Timestamp:
- 09/18/15 12:01:48 (9 years ago)
- Location:
- XIOS/trunk/src/node
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/context.cpp
r676 r697 14 14 #include "type.hpp" 15 15 #include "xios_spl.hpp" 16 16 17 17 18 namespace xios { … … 239 240 hasClient=true; 240 241 client = new CContextClient(this,intraComm, interComm, cxtServer); 242 registryIn=new CRegistry(intraComm); 243 registryIn->setPath(getId()) ; 244 if (client->clientRank==0) registryIn->fromFile("xios_registry.bin") ; 245 registryIn->bcastRegistry() ; 246 247 registryOut=new CRegistry(intraComm) ; 248 registryOut->setPath(getId()) ; 249 241 250 MPI_Comm intraCommServer, interCommServer; 242 251 if (cxtServer) // Attached mode … … 296 305 hasServer=true; 297 306 server = new CContextServer(this,intraComm,interComm); 307 308 registryIn=new CRegistry(intraComm); 309 registryIn->setPath(getId()) ; 310 if (server->intraCommRank==0) registryIn->fromFile("xios_registry.bin") ; 311 registryIn->bcastRegistry() ; 312 registryOut=new CRegistry(intraComm) ; 313 registryOut->setPath(getId()) ; 314 298 315 MPI_Comm intraCommClient, interCommClient; 299 316 if (cxtClient) // Attached mode … … 331 348 { 332 349 finalized = true; 333 350 if (hasClient) sendRegistry() ; 334 351 client->finalize(); 335 352 while (!server->hasFinished()) … … 341 358 { 342 359 closeAllFile(); 360 registryOut->hierarchicalGatherRegistry() ; 361 if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ; 343 362 } 344 363 345 364 for (std::list<MPI_Comm>::iterator it = comms.begin(); it != comms.end(); ++it) 346 365 MPI_Comm_free(&(*it)); … … 576 595 recvPostProcessing(event); 577 596 return true; 578 break; 597 case EVENT_ID_SEND_REGISTRY: 598 recvRegistry(event); 599 return true; 600 break; 579 601 580 602 default : … … 1018 1040 return (context); 1019 1041 } 1042 1043 1044 1045 //! Server side: Receive a message to do some post processing 1046 void CContext::recvRegistry(CEventServer& event) 1047 { 1048 CBufferIn* buffer=event.subEvents.begin()->buffer; 1049 string id; 1050 *buffer>>id; 1051 get(id)->recvRegistry(*buffer); 1052 } 1053 1054 void CContext::recvRegistry(CBufferIn& buffer) 1055 { 1056 if (server->intraCommRank==0) 1057 { 1058 CRegistry registry(server->intraComm) ; 1059 registry.fromBuffer(buffer) ; 1060 registryOut->mergeRegistry(registry) ; 1061 } 1062 } 1063 1064 void CContext::sendRegistry(void) 1065 { 1066 registryOut->hierarchicalGatherRegistry() ; 1067 1068 CEventClient event(CContext::GetType(), CContext::EVENT_ID_SEND_REGISTRY); 1069 if (client->isServerLeader()) 1070 { 1071 CMessage msg ; 1072 msg<<this->getIdServer(); 1073 if (client->clientRank==0) msg<<*registryOut ; 1074 const std::list<int>& ranks = client->getRanksServerLeader(); 1075 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1076 event.push(*itRank,1,msg); 1077 client->sendEvent(event); 1078 } 1079 else client->sendEvent(event); 1080 } 1081 1020 1082 } // namespace xios -
XIOS/trunk/src/node/context.hpp
r676 r697 12 12 #include "data_output.hpp" 13 13 #include "garbage_collector.hpp" 14 14 #include "registry.hpp" 15 15 #include "mpi.hpp" 16 16 … … 51 51 EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR, 52 52 EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE, 53 EVENT_ID_POST_PROCESS 53 EVENT_ID_POST_PROCESS, EVENT_ID_SEND_REGISTRY 54 54 }; 55 55 … … 132 132 void sendRefGrid(); 133 133 void sendPostProcessing(); 134 134 void sendRegistry(void) ; //!< after be gathered to the root process of the context, merged registry is sent to the root process of the servers 135 135 const StdString& getIdServer(); 136 136 … … 145 145 static void recvPostProcessing(CEventServer& event); 146 146 void recvPostProcessing(CBufferIn& buffer); 147 static void recvRegistry(CEventServer& event) ; 148 void recvRegistry(CBufferIn& buffer) ; //!< registry is received by the root process of the servers 147 149 148 150 // dispatch event … … 213 215 // Concrete contex client 214 216 CContextClient* client; 215 217 CRegistry* registryIn ; //!< input registry which is read from file 218 CRegistry* registryOut ; //!< output registry which will be wrote on file at the finalize 219 216 220 private: 217 221 bool isPostProcessed;
Note: See TracChangeset
for help on using the changeset viewer.