Changeset 1130 for XIOS/dev/dev_olga/src/server.cpp
- Timestamp:
- 05/15/17 15:00:24 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/server.cpp
r1077 r1130 67 67 68 68 boost::hash<string> hashString ; 69 // unsigned long hashServer1 = hashString(CXios::xiosCodeIdPrm);70 // unsigned long hashServer2 = hashString(CXios::xiosCodeIdSnd);71 // unsigned long hashServer = (CXios::serverLevel < 2) ? hashServer1 : hashServer2;72 69 unsigned long hashServer = hashString(CXios::xiosCodeId); 73 70 … … 193 190 else 194 191 { 195 // int rank ,size;196 int size;192 int size, rank; 193 int myColor; 197 194 if (!is_MPI_Initialized) oasis_init(CXios::xiosCodeId); 198 195 … … 200 197 MPI_Comm localComm; 201 198 oasis_get_localcomm(localComm); 202 MPI_Comm_dup(localComm, &intraComm); 203 199 200 // Create server intraComm 201 if (!CXios::usingServer2) 202 MPI_Comm_dup(localComm, &intraComm); 203 else 204 { 205 MPI_Comm_rank(localComm,&rank) ; 206 MPI_Comm_size(localComm,&serverSize_) ; 207 nbPools = serverSize_ * CXios::ratioServer2 / 100; 208 if ( rank < (serverSize_ - nbPools) ) 209 { 210 serverLevel = 1; 211 myColor = 0; 212 } 213 else 214 { 215 serverLevel = 2; 216 poolId = rank - serverSize_ + nbPools; 217 myColor = rank; 218 } 219 MPI_Comm_split(localComm, myColor, rank, &intraComm) ; 220 221 } 204 222 MPI_Comm_rank(intraComm,&rank_) ; 205 223 MPI_Comm_size(intraComm,&size) ; 224 206 225 string codesId=CXios::getin<string>("oasis_codes_id") ; 207 226 … … 217 236 { 218 237 oasis_get_intercomm(newComm,*it) ; 219 if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,newComm) ; 220 MPI_Comm_remote_size(newComm,&size); 221 // interComm.push_back(newComm) ; 222 interCommLeft.push_back(newComm) ; 238 // interComm.push_back(newComm) ; 239 if ( !CXios::usingServer2) 240 interCommLeft.push_back(newComm) ; 241 else 242 { 243 if (serverLevel == 1) 244 { 245 info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<size 246 <<" intraCommRank :"<<rank_<<" clientLeader "<< rank<<endl ; 247 MPI_Intercomm_create(intraComm, 0, localComm, rank, 0, &newComm) ; 248 interCommRight.push_back(newComm) ; 249 250 } 251 else if (serverLevel == 2) 252 { 253 info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<size 254 <<" intraCommRank :"<<rank_<<" clientLeader "<< 0<<endl ; 255 MPI_Intercomm_create(intraComm, 0, localComm, 0, 0, &newComm) ; 256 interCommLeft.push_back(newComm) ; 257 258 } 259 260 } 261 // if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,newComm) ; 262 // MPI_Comm_remote_size(newComm,&size); 263 // Send serverLeader to client 264 if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,interCommLeft.back()) ; 223 265 } 224 266 oasis_enddef() ; … … 286 328 287 329 contextEventLoop() ; 288 // if (finished && contextList.empty()) stop=true ;289 330 if (finished && contextList.empty()) stop=true ; 290 331 eventScheduler->checkEvent() ; … … 510 551 contextInterComms.push_back(inter); 511 552 context->initServer(intraComm, contextInterComms.back()); 512 // context->initServer(intraComm, interCommLeft.front());513 553 } 514 554 … … 535 575 contextIntraComms.push_back(inter); 536 576 context->initClient(contextIntraComms.back(), contextInterComms.back()) ; 537 // context->initClient(intraComm, contextPrimInterComms.back()) ;538 // context->initClient(intraComm, *it) ;539 577 delete [] buff ; 540 578 } … … 545 583 void CServer::contextEventLoop(void) 546 584 { 547 bool finished ;585 bool isFinalized ; 548 586 549 587 map<string,CContext*>::iterator it ; … … 551 589 for(it=contextList.begin();it!=contextList.end();it++) 552 590 { 553 finished=it->second->isFinalized();554 if ( finished)555 { 556 it->second-> freeComms(); // deallocate internally allocated context communicators591 isFinalized=it->second->isFinalized(); 592 if (isFinalized) 593 { 594 it->second->postFinalize(); 557 595 contextList.erase(it) ; 558 596 break ; 559 597 } 560 598 else 561 finished=it->second->checkBuffersAndListen(); 599 { 600 isFinalized=it->second->checkBuffersAndListen(); 601 } 562 602 } 563 603 }
Note: See TracChangeset
for help on using the changeset viewer.