Changeset 1168
- Timestamp:
- 06/14/17 15:24:43 (7 years ago)
- Location:
- XIOS/dev/dev_olga/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/cxios.cpp
r1158 r1168 184 184 185 185 // Finalize 186 if (CServer::getRank()==0) 187 { 188 info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 189 globalRegistry->toFile("xios_registry.bin") ; 190 delete globalRegistry ; 191 } 186 if (!usingServer2) 187 { 188 if (CServer::getRank()==0) 189 { 190 info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 191 globalRegistry->toFile("xios_registry.bin") ; 192 delete globalRegistry ; 193 } 194 } 195 else 196 { 197 // If using two server levels, first merge globalRegistry of each server pool into one registry on the first pool 198 if (CServer::serverLevel == 2) 199 { 200 vector<int>& secondaryServerGlobalRanks = CServer::getSecondaryServerGlobalRanks(); 201 int firstPoolGlobalRank = secondaryServerGlobalRanks[0]; 202 int rankGlobal; 203 MPI_Comm_rank(globalComm, &rankGlobal); 204 205 // All pools (except the first): send globalRegistry to the first pool 206 if (rankGlobal != firstPoolGlobalRank) 207 { 208 int registrySize = globalRegistry->size(); 209 MPI_Send(®istrySize,1,MPI_LONG,firstPoolGlobalRank,15,CXios::globalComm) ; 210 CBufferOut buffer(registrySize) ; 211 globalRegistry->toBuffer(buffer) ; 212 MPI_Send(buffer.start(),registrySize,MPI_CHAR,firstPoolGlobalRank,15,CXios::globalComm) ; 213 } 214 215 // First pool: receive globalRegistry of all secondary server pools, merge and write the resultant registry 216 else 217 { 218 MPI_Status status; 219 char* recvBuff; 220 221 CRegistry globalRegistrySndServers (CServer::intraComm); 222 globalRegistrySndServers.mergeRegistry(*globalRegistry) ; 223 224 for (int i=1; i< secondaryServerGlobalRanks.size(); i++) 225 { 226 int rank = secondaryServerGlobalRanks[i]; 227 int registrySize = 0; 228 MPI_Recv(®istrySize, 1, MPI_LONG, rank, 15, CXios::globalComm, &status); 229 recvBuff = new char[registrySize]; 230 MPI_Recv(recvBuff, registrySize, MPI_CHAR, rank, 15, CXios::globalComm, &status); 231 CBufferIn buffer(recvBuff, registrySize) ; 232 CRegistry recvRegistry; 233 recvRegistry.fromBuffer(buffer) ; 234 globalRegistrySndServers.mergeRegistry(recvRegistry) ; 235 delete[] recvBuff; 236 } 237 238 info(80)<<"Write data base Registry"<<endl<<globalRegistrySndServers.toString()<<endl ; 239 globalRegistrySndServers.toFile("xios_registry.bin") ; 240 241 } 242 } 243 delete globalRegistry; 244 } 192 245 CServer::finalize(); 193 246 -
XIOS/dev/dev_olga/src/server.cpp
r1167 r1168 84 84 map<unsigned long, int>::iterator it ; 85 85 86 int nbSrv = 0;87 86 int srvNodeSize = 1, srvNodeLeader = 0; 88 87 … … 134 133 { 135 134 MPI_Allgather(&serverLevel, 1, MPI_LONG, hashAll, 1, MPI_LONG, CXios::globalComm) ; 135 136 136 for (i=0; i<size; i++) 137 137 if (hashAll[i] == 2) … … 188 188 interCommRight.push_back(newComm) ; 189 189 } 190 } // primary server190 } 191 191 else 192 192 { … … 201 201 MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 1, &newComm) ; 202 202 interCommLeft.push_back(newComm) ; 203 } // secondary server203 } 204 204 205 205 delete [] hashAll ; … … 667 667 } 668 668 669 vector<int>& CServer::getSecondaryServerGlobalRanks() 670 { 671 return sndServerGlobalRanks; 672 } 673 669 674 /*! 670 675 * Open a file specified by a suffix and an extension and use it for the given file buffer. -
XIOS/dev/dev_olga/src/server.hpp
r1152 r1168 49 49 static int getRank(); 50 50 51 //!< Get global ranks of processes dedicated to the secondary server 52 static vector<int>& getSecondaryServerGlobalRanks(); 53 51 54 //! Open a file stream to write the info logs 52 55 static void openInfoStream(const StdString& fileName);
Note: See TracChangeset
for help on using the changeset viewer.