Changeset 697 for XIOS/trunk/src/node/context.cpp
- Timestamp:
- 09/18/15 12:01:48 (9 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.