Changeset 1180 for XIOS/dev/dev_olga
- Timestamp:
- 06/22/17 17:03:07 (7 years ago)
- Location:
- XIOS/dev/dev_olga/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/client.cpp
r1158 r1180 100 100 MPI_Comm_split(CXios::globalComm,myColor,rank_,&intraComm) ; 101 101 102 if (CXios::usingServer2)103 MPI_Allgather(&hashClient, 1, MPI_LONG, hashAll, 1, MPI_LONG, CXios::globalComm) ;104 105 102 if (CXios::usingServer) 106 103 { -
XIOS/dev/dev_olga/src/node/context.cpp
r1158 r1180 491 491 info(20)<<"Context <"<<getId()<<"> is finalized."<<endl; 492 492 493 //if (hasServer && !hasClient)493 if (hasServer && !hasClient) 494 494 { 495 495 closeAllFile(); -
XIOS/dev/dev_olga/src/server.cpp
r1168 r1180 18 18 { 19 19 MPI_Comm CServer::intraComm ; 20 list<MPI_Comm> CServer::interCommLeft ;21 list<MPI_Comm> CServer::interCommRight ;20 std::list<MPI_Comm> CServer::interCommLeft ; 21 std::list<MPI_Comm> CServer::interCommRight ; 22 22 std::list<MPI_Comm> CServer::contextInterComms; 23 23 std::list<MPI_Comm> CServer::contextIntraComms; … … 84 84 map<unsigned long, int>::iterator it ; 85 85 86 int srvNodeSize = 1, srvNodeLeader = 0;87 88 86 // (1) Establish client leaders, distribute processes between two server levels 87 vector<int> srvRanks; 89 88 for(i=0,c=0;i<size;i++) 90 89 { … … 96 95 } 97 96 if (CXios::usingServer2) 98 {99 97 if (hashAll[i] == hashServer) 100 { 101 if (hashAll[i-1] != hashServer || i == 0) 102 { 103 srvNodeLeader = i; 104 } 105 if (hashAll[i+1] == hashServer) 106 { 107 ++srvNodeSize; 108 } 109 else 110 { 111 if ( (rank_-srvNodeLeader) >= 0 && 112 (rank_-srvNodeLeader) < (1.- CXios::ratioServer2/100.)*srvNodeSize ) 113 { 114 serverLevel = 1; 115 } 116 if ( (rank_-srvNodeLeader) >= (1.- CXios::ratioServer2/100.)*srvNodeSize && 117 (rank_ - srvNodeLeader) < srvNodeSize ) 118 { 119 serverLevel = 2; 120 } 121 srvNodeSize = 1; 122 } 123 } 98 srvRanks.push_back(i); 99 } 100 for (i=0; i<srvRanks.size(); i++) 101 { 102 if (i >= srvRanks.size()*CXios::ratioServer2/100) 103 { 104 sndServerGlobalRanks.push_back(srvRanks[i]); 105 if (rank_ == srvRanks[i]) serverLevel=2; 106 } 107 else 108 { 109 if (rank_ == srvRanks[i]) serverLevel=1; 124 110 } 125 111 } … … 130 116 131 117 // (3) Create interComm 132 if (CXios::usingServer2)133 {134 MPI_Allgather(&serverLevel, 1, MPI_LONG, hashAll, 1, MPI_LONG, CXios::globalComm) ;135 136 for (i=0; i<size; i++)137 if (hashAll[i] == 2)138 sndServerGlobalRanks.push_back(i);139 }140 141 118 if (serverLevel == 0) 142 119 { … … 154 131 155 132 MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ; 156 133 interCommLeft.push_back(newComm) ; 157 134 } 158 135 } … … 211 188 int size; 212 189 int myColor; 190 unsigned long* srvGlobalRanks; 213 191 if (!is_MPI_Initialized) oasis_init(CXios::xiosCodeId); 214 192 … … 225 203 else 226 204 { 205 int globalRank; 227 206 MPI_Comm_rank(localComm,&rank_) ; 228 207 MPI_Comm_size(localComm,&size) ; 208 MPI_Comm_rank(CXios::globalComm,&globalRank) ; 209 srvGlobalRanks = new unsigned long[size] ; 210 MPI_Allgather(&globalRank, 1, MPI_LONG, srvGlobalRanks, 1, MPI_LONG, localComm) ; 229 211 230 212 for (int i=size*CXios::ratioServer2/100; i<size; i++) 231 sndServerGlobalRanks.push_back( i);213 sndServerGlobalRanks.push_back(srvGlobalRanks[i]); 232 214 233 215 if ( rank_ < (size - sndServerGlobalRanks.size()) ) … … 255 237 MPI_Comm_rank(CXios::globalComm,&globalRank); 256 238 239 // (1) Create interComms with models 257 240 for(it=splitted.begin();it!=splitted.end();it++) 258 241 { 259 242 oasis_get_intercomm(newComm,*it) ; 260 // interComm.push_back(newComm) ; 261 if ( !CXios::usingServer2) 243 if ( !CXios::usingServer2 || serverLevel == 1) 262 244 { 263 245 interCommLeft.push_back(newComm) ; 264 246 if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,newComm) ; 265 247 } 266 else 267 { 268 if (serverLevel == 1) 269 { 270 interCommLeft.push_back(newComm) ; 271 if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,newComm) ; 272 for (int i = 0; i < sndServerGlobalRanks.size(); ++i) 273 { 274 int srvSndLeader = sndServerGlobalRanks[i]; 275 info(50)<<"intercommCreate::client (server level 1) "<<globalRank<<" intraCommSize : "<<size 276 <<" intraCommRank :"<<rank_<<" clientLeader "<< srvSndLeader<<endl ; 277 MPI_Intercomm_create(intraComm, 0, CXios::globalComm, srvSndLeader, 0, &newComm) ; 278 interCommRight.push_back(newComm) ; 279 } 280 } 281 else if (serverLevel == 2) 282 { 283 info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<size 284 <<" intraCommRank :"<<rank_<<" clientLeader "<< 0<<endl ; 285 MPI_Intercomm_create(intraComm, 0, localComm, 0, 0, &newComm) ; 286 interCommLeft.push_back(newComm) ; 287 } 288 } 289 // MPI_Comm_remote_size(newComm,&size); 290 } 248 } 249 250 // (2) Create interComms between primary and secondary servers 251 if (serverLevel == 1) 252 { 253 for (int i = 0; i < sndServerGlobalRanks.size(); ++i) 254 { 255 int srvSndLeader = sndServerGlobalRanks[i]; 256 info(50)<<"intercommCreate::client (server level 1) "<<globalRank<<" intraCommSize : "<<size 257 <<" intraCommRank :"<<rank_<<" clientLeader "<< srvSndLeader<<endl ; 258 MPI_Intercomm_create(intraComm, 0, CXios::globalComm, srvSndLeader, 0, &newComm) ; 259 interCommRight.push_back(newComm) ; 260 } 261 } 262 else if (serverLevel == 2) 263 { 264 info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<size 265 <<" intraCommRank :"<<rank_<<" clientLeader "<< srvGlobalRanks[0] <<endl ; 266 MPI_Intercomm_create(intraComm, 0, CXios::globalComm, srvGlobalRanks[0], 0, &newComm) ; 267 interCommLeft.push_back(newComm) ; 268 } 269 delete [] srvGlobalRanks ; 270 291 271 oasis_enddef() ; 292 272 } -
XIOS/dev/dev_olga/src/server.hpp
r1168 r1180 25 25 26 26 static MPI_Comm intraComm; 27 static list<MPI_Comm> interCommLeft; // interComm between server (primary, classical or secondary) and its client (client or primary server)28 static list<MPI_Comm> interCommRight; // interComm between primary server and secondary server (non-empty only for primary server pool)27 static std::list<MPI_Comm> interCommLeft; // interComm between server (primary, classical or secondary) and its client (client or primary server) 28 static std::list<MPI_Comm> interCommRight; // interComm between primary server and secondary server (non-empty only for primary server pool) 29 29 static std::list<MPI_Comm> contextInterComms; // list of context intercomms 30 30 static std::list<MPI_Comm> contextIntraComms; // list of context intercomms (needed only in case of secondary servers) … … 49 49 static int getRank(); 50 50 51 //!< Get global ranks of processes dedicated to the secondary server51 //!< Get global ranks of secondary server processes 52 52 static vector<int>& getSecondaryServerGlobalRanks(); 53 53 … … 68 68 private: 69 69 static vector<int> sndServerGlobalRanks; //!< Global ranks of secondary server processes 70 static int rank_; //!< If (!oasis) global rank, else rank in the intraComm returned by oasis71 static int nbContexts; //!< Number of contexts registered by server70 static int rank_; //!< If (!oasis) global rank, else rank in the intraComm returned by oasis 71 static int nbContexts; //!< Number of contexts registered by server 72 72 static StdOFStream m_infoStream; 73 73 static StdOFStream m_errorStream;
Note: See TracChangeset
for help on using the changeset viewer.