Changeset 1168 for XIOS/dev/dev_olga/src


Ignore:
Timestamp:
06/14/17 15:24:43 (7 years ago)
Author:
oabramkina
Message:

Two server levels: merging registries of secondary server pools into one and then writing the merged one.

Tested on curie with toy_cmip6.

Location:
XIOS/dev/dev_olga/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/cxios.cpp

    r1158 r1168  
    184184 
    185185    // 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(&registrySize,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(&registrySize, 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    } 
    192245    CServer::finalize(); 
    193246 
  • XIOS/dev/dev_olga/src/server.cpp

    r1167 r1168  
    8484        map<unsigned long, int>::iterator it ; 
    8585 
    86         int nbSrv = 0; 
    8786        int srvNodeSize = 1, srvNodeLeader = 0; 
    8887 
     
    134133        { 
    135134          MPI_Allgather(&serverLevel, 1, MPI_LONG, hashAll, 1, MPI_LONG, CXios::globalComm) ; 
     135 
    136136          for (i=0; i<size; i++) 
    137137            if (hashAll[i] == 2) 
     
    188188            interCommRight.push_back(newComm) ; 
    189189          } 
    190         } // primary server 
     190        } 
    191191        else 
    192192        { 
     
    201201          MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 1, &newComm) ; 
    202202          interCommLeft.push_back(newComm) ; 
    203         } // secondary server 
     203        } 
    204204 
    205205        delete [] hashAll ; 
     
    667667     } 
    668668 
     669     vector<int>& CServer::getSecondaryServerGlobalRanks() 
     670     { 
     671       return sndServerGlobalRanks; 
     672     } 
     673 
    669674    /*! 
    670675    * 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  
    4949        static int getRank(); 
    5050 
     51        //!< Get global ranks of processes dedicated to the secondary server 
     52        static vector<int>& getSecondaryServerGlobalRanks(); 
     53 
    5154        //! Open a file stream to write the info logs 
    5255        static void openInfoStream(const StdString& fileName); 
Note: See TracChangeset for help on using the changeset viewer.