Changeset 655 for XIOS/trunk/src/server.cpp
- Timestamp:
- 07/24/15 16:40:07 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/server.cpp
r597 r655 18 18 MPI_Comm CServer::intraComm ; 19 19 list<MPI_Comm> CServer::interComm ; 20 std::list<MPI_Comm> CServer::contextInterComms; 20 21 bool CServer::isRoot ; 21 22 int CServer::rank = INVALID_RANK; … … 110 111 111 112 CTimer::get("XIOS").resume() ; 112 oasis_get_localcomm(intraComm) ; 113 MPI_Comm localComm; 114 oasis_get_localcomm(localComm); 115 MPI_Comm_dup(localComm, &intraComm); 116 113 117 MPI_Comm_rank(intraComm,&rank) ; 114 118 MPI_Comm_size(intraComm,&size) ; … … 144 148 { 145 149 CTimer::get("XIOS").suspend() ; 146 150 147 151 delete eventScheduler ; 148 152 153 for (std::list<MPI_Comm>::iterator it = contextInterComms.begin(); it != contextInterComms.end(); it++) 154 MPI_Comm_free(&(*it)); 155 for (std::list<MPI_Comm>::iterator it = interComm.begin(); it != interComm.end(); it++) 156 MPI_Comm_free(&(*it)); 157 MPI_Comm_free(&intraComm); 158 149 159 if (!is_MPI_Initialized) 150 160 { … … 198 208 MPI_Recv(&msg,1,MPI_INT,0,0,*it,&status) ; 199 209 info(20)<<" CServer : Receive client finalize"<<endl ; 210 MPI_Comm_free(&(*it)); 200 211 interComm.erase(it) ; 201 212 break ; … … 361 372 362 373 363 void CServer::registerContext(void* buff,int count, int leaderRank) 364 { 365 374 void CServer::registerContext(void* buff, int count, int leaderRank) 375 { 366 376 string contextId; 367 CBufferIn buffer(buff,count) ; 368 369 buffer>>contextId ; 370 MPI_Comm contextIntercomm ; 371 MPI_Intercomm_create(intraComm,0,CXios::globalComm,leaderRank,10+leaderRank,&contextIntercomm) ; 372 373 info(20)<<"CServer : Register new Context : "<<contextId<<endl ; 374 MPI_Comm inter ; 375 MPI_Intercomm_merge(contextIntercomm,1,&inter) ; 376 MPI_Barrier(inter) ; 377 CBufferIn buffer(buff, count); 378 buffer >> contextId; 379 380 info(20)<<"CServer : Register new Context : "<<contextId<<endl; 381 377 382 if (contextList.find(contextId)!=contextList.end()) 378 383 ERROR("void CServer::registerContext(void* buff,int count, int leaderRank)", 379 <<"Context has already been registred") ; 380 381 CContext* context=CContext::create(contextId) ; 382 contextList[contextId]=context ; 383 context->initServer(intraComm,contextIntercomm) ; 384 384 << "Context has already been registred"); 385 386 MPI_Comm contextIntercomm; 387 MPI_Intercomm_create(intraComm,0,CXios::globalComm,leaderRank,10+leaderRank,&contextIntercomm); 388 389 MPI_Comm inter; 390 MPI_Intercomm_merge(contextIntercomm,1,&inter); 391 MPI_Barrier(inter); 392 393 CContext* context=CContext::create(contextId); 394 contextList[contextId]=context; 395 context->initServer(intraComm,contextIntercomm); 396 397 contextInterComms.push_back(contextIntercomm); 398 MPI_Comm_free(&inter); 385 399 } 386 400
Note: See TracChangeset
for help on using the changeset viewer.