Changeset 2547 for XIOS3/trunk/src/manager/server_context.cpp
- Timestamp:
- 08/29/23 17:24:04 (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/manager/server_context.cpp
r2517 r2547 6 6 #include "register_context_info.hpp" 7 7 #include "services.hpp" 8 #include "thread_manager.hpp" 8 9 #include "timer.hpp" 9 10 … … 50 51 info(10)<<"Context "<< CXios::getContextsManager()->getServerContextName(poolId, serviceId, partitionId, type, contextId)<<" created, on local rank "<<localRank 51 52 <<" and global rank "<<globalRank<<endl ; 53 54 if (CThreadManager::isUsingThreads()) CThreadManager::spawnThread(&CServerContext::threadEventLoop, this) ; 52 55 } 53 56 … … 84 87 } 85 88 86 MPI_Request req ; 87 MPI_Status status ; 88 MPI_Ibarrier(intraComm,&req) ; 89 90 int flag=false ; 91 while(!flag) 92 { 93 CXios::getDaemonsManager()->servicesEventLoop() ; 94 MPI_Test(&req,&flag,&status) ; 95 } 96 89 if (wait) 90 { 91 MPI_Request req ; 92 MPI_Status status ; 93 MPI_Ibarrier(intraComm,&req) ; 94 95 int flag=false ; 96 while(!flag) 97 { 98 CXios::getDaemonsManager()->servicesEventLoop() ; 99 MPI_Test(&req,&flag,&status) ; 100 } 101 } 102 97 103 MPI_Bcast(&ok, 1, MPI_INT, 0, intraComm) ; 98 104 … … 117 123 MPI_Comm_size(contextComm_,&commSize ) ; 118 124 */ 119 if (nOverlap> 0 ) 120 { 121 while (get<0>(overlapedComm_[name_])==false) CXios::getDaemonsManager()->servicesEventLoop() ; 122 isAttachedMode_=true ; 123 cout<<"CServerContext::createIntercomm : total overlap ==> context in attached mode"<<endl ; 124 interCommClient=newInterCommClient ; 125 interCommServer=newInterCommServer ; 126 } 127 else if (nOverlap==0) 125 if (nOverlap==0) 128 126 { 129 cout<<"CServerContext::createIntercomm : No overlap ==> context in server mode"<<endl ;130 isAttachedMode_=false ;131 127 MPI_Intercomm_create(intraComm, 0, xiosComm_, contextLeader, 3141, &interCommClient) ; 132 128 MPI_Comm_dup(interCommClient, &interCommServer) ; … … 136 132 else 137 133 { 138 cout<<"CServerContext::createIntercomm : partial overlap ==> not managed"<<endl;134 ERROR("void CServerContext::createIntercomm(void)",<<"CServerContext::createIntercomm : overlap ==> not managed") ; 139 135 } 140 136 } … … 259 255 } 260 256 257 void CServerContext::threadEventLoop(void) 258 { 259 260 info(100)<<"Launch Thread for CServerContext::threadEventLoop, context id = "<<context_->getId()<<endl ; 261 CThreadManager::threadInitialize() ; 262 do 263 { 264 CTimer::get("CServerContext::eventLoop").resume(); 265 int flag ; 266 MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); 267 268 if (winNotify_!=nullptr) checkNotifications() ; 269 270 271 if (context_!=nullptr) 272 { 273 if (context_->eventLoop()) 274 { 275 info(100)<<"Remove context server with id "<<context_->getId()<<endl ; 276 CContext::removeContext(context_->getId()) ; 277 context_=nullptr ; 278 // destroy context ??? --> later 279 } 280 } 281 CTimer::get("CServerContext::eventLoop").suspend(); 282 if (context_==nullptr && finalizeSignal_) finished_=true ; 283 284 if (!finished_) CThreadManager::yield() ; 285 } 286 while (!finished_) ; 287 288 CThreadManager::threadFinalize() ; 289 info(100)<<"Close thread for CServerContext::threadEventLoop"<<endl ; 290 } 291 261 292 void CServerContext::createIntercomm(void) 262 293 { … … 280 311 MPI_Comm_size(contextComm_,&commSize ) ; 281 312 282 if (nOverlap==commSize) 283 { 284 info(10)<<"CServerContext::createIntercomm : total overlap ==> context in attached mode"<<endl ; 285 isAttachedMode_=true ; 286 interCommClient=get<2>(it->second) ; 287 interCommServer=get<1>(it->second) ; 288 context_ -> createClientInterComm(interCommClient, interCommServer ) ; 289 clientsInterComm_.push_back(interCommClient) ; 290 clientsInterComm_.push_back(interCommServer) ; 291 } 292 else if (nOverlap==0) 313 if (nOverlap==0) 293 314 { 294 315 info(10)<<"CServerContext::createIntercomm : No overlap ==> context in server mode"<<endl ; 295 isAttachedMode_=false ;296 316 MPI_Intercomm_create(contextComm_, 0, xiosComm_, remoteLeader, 3141, &interCommServer) ; 297 317 MPI_Comm_dup(interCommServer,&interCommClient) ; … … 302 322 else 303 323 { 304 ERROR("void CServerContext::createIntercomm(void)",<<"CServerContext::createIntercomm : partialoverlap ==> not managed") ;324 ERROR("void CServerContext::createIntercomm(void)",<<"CServerContext::createIntercomm : overlap ==> not managed") ; 305 325 } 306 326
Note: See TracChangeset
for help on using the changeset viewer.