Changeset 697
- Timestamp:
- 09/18/15 12:01:48 (9 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/client.cpp
r655 r697 220 220 int rank ; 221 221 int msg=0 ; 222 223 MPI_Comm_rank(intraComm,&rank) ; 224 222 225 if (!CXios::isServer) 223 226 { … … 242 245 else MPI_Finalize() ; 243 246 } 247 244 248 info(20) << "Client side context is finalized"<<endl ; 245 249 report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ; -
XIOS/trunk/src/context_client.cpp
r597 r697 6 6 #include "buffer_client.hpp" 7 7 #include "type.hpp" 8 #include "message.hpp"9 8 #include "event_client.hpp" 10 9 #include "context.hpp" … … 71 70 72 71 timeLine = 0; 72 73 73 } 74 74 75 75 76 /*! 76 77 In case of attached mode, the current context must be reset to context for client … … 287 288 } 288 289 290 291 289 292 /*! 290 293 Finalize context client and do some reports 291 294 */ 295 292 296 void CContextClient::finalize(void) 293 297 { 294 298 map<int,CClientBuffer*>::iterator itBuff; 295 299 bool stop = true; 296 300 297 301 CEventClient event(CContext::GetType(), CContext::EVENT_ID_CONTEXT_FINALIZE); 298 302 if (isServerLeader()) … … 327 331 328 332 releaseBuffers(); 333 329 334 } 330 335 } -
XIOS/trunk/src/context_client.hpp
r595 r697 4 4 #include "xios_spl.hpp" 5 5 #include "buffer_out.hpp" 6 #include "buffer_in.hpp" 6 7 #include "buffer_client.hpp" 7 8 #include "event_client.hpp" 9 #include "event_server.hpp" 8 10 #include "mpi.hpp" 11 #include "registry.hpp" 9 12 10 13 namespace xios … … 46 49 void setBufferSize(const std::map<int,StdSize>& mapSize); 47 50 void sendBufferSizeEvent(); 48 49 51 public: 50 52 CContext* context; //!< Context for client -
XIOS/trunk/src/context_server.hpp
r597 r697 39 39 size_t currentTimeLine ; 40 40 CContext* context ; 41 41 42 42 bool finished ; 43 43 bool pendingEvent ; -
XIOS/trunk/src/cxios.cpp
r591 r697 10 10 #include <new> 11 11 #include "memtrack.hpp" 12 #include "registry.hpp" 12 13 13 14 namespace xios … … 27 28 bool CXios::printLogs2Files; 28 29 bool CXios::isOptPerformance = true; 30 CRegistry* CXios::globalRegistry = 0; 29 31 30 32 //! Parse configuration file and create some objects from it … … 75 77 76 78 CClient::initialize(codeId,localComm,returnComm) ; 79 if (CClient::getRank()==0) globalRegistry = new CRegistry(returnComm) ; 77 80 78 81 if (usingServer) isServer=false; … … 95 98 CClient::finalize() ; 96 99 CClient::closeInfoStream(); 100 if (CClient::getRank()==0) 101 { 102 info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 103 globalRegistry->toFile("xios_registry.bin") ; 104 delete globalRegistry ; 105 } 97 106 98 107 #ifdef XIOS_MEMTRACK … … 121 130 // Initialize all aspects MPI 122 131 CServer::initialize(); 123 132 if (CServer::getRank()==0) globalRegistry = new CRegistry(CServer::intraComm) ; 133 124 134 if (printLogs2Files) 125 135 { … … 137 147 138 148 // Finalize 149 if (CServer::getRank()==0) 150 { 151 info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 152 globalRegistry->toFile("xios_registry.bin") ; 153 delete globalRegistry ; 154 } 139 155 CServer::finalize(); 140 156 CServer::closeInfoStream(); -
XIOS/trunk/src/cxios.hpp
r591 r697 4 4 #include "xios_spl.hpp" 5 5 #include "mpi.hpp" 6 #include "registry.hpp" 6 7 7 8 namespace xios … … 42 43 static double defaultBufferServerFactorSize ; //!< Default factor value 43 44 static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible) 45 static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers 44 46 45 47 public: -
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; -
XIOS/trunk/src/server.cpp
r680 r697 27 27 bool CServer::is_MPI_Initialized ; 28 28 CEventScheduler* CServer::eventScheduler = 0; 29 29 30 30 void CServer::initialize(void) 31 31 { … … 148 148 { 149 149 CTimer::get("XIOS").suspend() ; 150 150 151 151 delete eventScheduler ; 152 152 -
XIOS/trunk/src/server.hpp
r655 r697 4 4 #include "xios_spl.hpp" 5 5 #include "context.hpp" 6 #include "context_client.hpp" 6 7 #include "mpi.hpp" 7 8 #include "event_scheduler.hpp" … … 27 28 static std::list<MPI_Comm> contextInterComms; 28 29 static CEventScheduler* eventScheduler; 29 30 30 31 struct contextMessage 31 32 {
Note: See TracChangeset
for help on using the changeset viewer.