Changeset 992


Ignore:
Timestamp:
11/16/16 18:00:52 (7 years ago)
Author:
oabramkina
Message:

First rebond on the secondary server pool. XIOS finalizes correctly.

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

Legend:

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

    r983 r992  
    8787      { 
    8888        MPI_Comm_test_inter(interComm, &flag); 
    89 //        if (flag) 
    90           MPI_Issend(buffer[current], count, MPI_CHAR, serverRank, 20, interComm, &request); 
    91 //        else 
    92 //          ERROR("bool CClientBuffer::checkBuffer(void)", 
    93 //                << "Invalid intercommunicator"); 
     89        MPI_Issend(buffer[current], count, MPI_CHAR, serverRank, 20, interComm, &request); 
    9490        pending = true; 
    9591        if (current == 1) current = 0; 
  • XIOS/dev/dev_olga/src/client.cpp

    r983 r992  
    2424    StdOFStream CClient::m_errorStream; 
    2525 
     26    MPI_Comm& CClient::getInterComm(void)   { return (interComm); } 
     27 
    2628///--------------------------------------------------------------- 
    2729/*! 
     
    248250      MPI_Comm_rank(intraComm,&rank) ; 
    249251  
    250       if ((!CXios::isServer) || (CXios::serverLevel == 1)) 
     252      if (!CXios::isServer) 
    251253      { 
    252254        MPI_Comm_rank(intraComm,&rank) ; 
     
    282284   } 
    283285 
     286 
    284287   int CClient::getRank() 
    285288   { 
  • XIOS/dev/dev_olga/src/client.hpp

    r983 r992  
    2020        static int serverLeader; 
    2121        static bool is_MPI_Initialized ; 
     22 
     23        static MPI_Comm& getInterComm(); 
    2224 
    2325        //! Get rank of the current process 
  • XIOS/dev/dev_olga/src/context_server.cpp

    r983 r992  
    2323{ 
    2424 
    25   CContextServer::CContextServer(CContext* parent,MPI_Comm intraComm_,MPI_Comm interComm_) 
     25  CContextServer::CContextServer(CContext* parent, MPI_Comm intraComm_,MPI_Comm interComm_) 
    2626  { 
    2727    context=parent; 
     
    4141    boost::hash<string> hashString; 
    4242    hashId=hashString(context->getId()); 
     43 
     44  } 
     45 
     46  CContextServer::CContextServer(CContext* parent, int srvLvl, MPI_Comm intraComm_,MPI_Comm interComm_) 
     47  { 
     48    context=parent; 
     49    intraComm=intraComm_; 
     50    MPI_Comm_size(intraComm,&intraCommSize); 
     51    MPI_Comm_rank(intraComm,&intraCommRank); 
     52    interComm=interComm_; 
     53    int flag; 
     54    MPI_Comm_test_inter(interComm,&flag); 
     55    if (flag) MPI_Comm_remote_size(interComm,&commSize); 
     56    else  MPI_Comm_size(interComm,&commSize); 
     57 
     58    currentTimeLine=0; 
     59    scheduled=false; 
     60    finished=false; 
     61 
     62    boost::hash<string> hashString; 
     63    StdString contextId = context->getId(); 
     64    contextId += "_prim";                      // just to distinguish between server and serverPrimServer on server1 
     65    hashId=hashString(contextId); 
    4366 
    4467  } 
     
    184207         // The best way to properly solve this problem will be to use the event scheduler also in attached mode 
    185208         // for now just set up a MPI barrier 
    186          if (!CServer::eventScheduler) MPI_Barrier(intraComm) ; 
     209//         if (!CServer::eventScheduler) MPI_Barrier(intraComm) ; 
    187210 
    188211         CTimer::get("Process events").resume(); 
  • XIOS/dev/dev_olga/src/context_server.hpp

    r983 r992  
    1414    public: 
    1515 
    16     CContextServer(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; 
     16    CContextServer(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm) ; 
     17    CContextServer(CContext* parent, int srvLvl, MPI_Comm intraComm, MPI_Comm interComm) ; 
    1718    bool eventLoop(void) ; 
    1819    void listen(void) ; 
  • XIOS/dev/dev_olga/src/cxios.hpp

    r983 r992  
    3737 
    3838     static bool isClient ; //!< Check if xios is client 
    39      static bool isServer ; //!< Check if xios is primary server 
     39     static bool isServer ; //!< Check if xios is server 
    4040 
    4141     static int serverLevel ; // 
  • XIOS/dev/dev_olga/src/distribution_client.cpp

    r983 r992  
    2424   , elementZoomMask_(), elementNLocal_(), elementNGlobal_() 
    2525{ 
    26 //  numElement_ = globalLocalIndex.size();    !!! numElement_ should be calculated !!!! 
    27   isComputed_ = true;  // my changes 
    28  
    29  
     26//  numElement_ = globalLocalIndex.size();    !!! numElement_ should be calculated (?) 
     27  isComputed_ = true; 
    3028  localDataIndex_.resize(globalLocalIndex.size()); 
    3129  localMaskIndex_.resize(globalLocalIndex.size()); 
  • XIOS/dev/dev_olga/src/event_scheduler.cpp

    r591 r992  
    107107  } 
    108108   
    109    
    110    
    111109  void CEventScheduler::checkParentRequest(void) 
    112110  { 
     
    152150        size_t hashId=recvRequest->buffer[1] ; 
    153151        size_t lev=recvRequest->buffer[2] ; 
    154         delete recvRequest ; 
     152//        delete recvRequest ; 
    155153        pendingRecvParentRequest.pop() ;        
    156154  
    157155        if (lev==level) eventStack.push(pair<size_t,size_t>(timeLine,hashId)) ; 
    158156        else  bcastEvent(timeLine, hashId, lev) ; 
     157        delete recvRequest ; 
    159158      } 
    160159    }    
  • XIOS/dev/dev_olga/src/node/context.cpp

    r987 r992  
    1515#include "xios_spl.hpp" 
    1616 
     17#include "server.hpp" 
    1718 
    1819namespace xios { 
     
    252253     { 
    253254       clientPrimServer = new CContextClient(this, intraComm, interComm); 
    254        serverPrimServer = new CContextServer(this, intraComm, interComm); 
     255       serverPrimServer = new CContextServer(this, 1, intraComm, interComm);  // just some int parameter to distinguish server from serverPrimServer on server1 
    255256     } 
    256257 
     
    414415      { 
    415416        finalized = true; 
    416         if (hasClient) sendRegistry() ; 
     417//        if (hasClient) sendRegistry() ; 
    417418 
    418419/*        if (CXios::serverLevel == 0) 
     
    446447        }*/ 
    447448 
    448         client->finalize(); 
    449         while (!server->hasFinished()) 
    450         { 
    451           server->eventLoop(); 
    452         } 
    453  
    454449        if ((hasClient) && (hasServer)) 
    455450        { 
     
    458453          { 
    459454            serverPrimServer->eventLoop(); 
     455            CServer::eventScheduler->checkEvent() ; 
    460456          } 
    461457        } 
     458 
     459        client->finalize(); 
     460        while (!server->hasFinished()) 
     461        { 
     462          server->eventLoop(); 
     463        } 
     464 
    462465 
    463466        if (hasServer) 
     
    10561059      this->solveAllInheritance(); 
    10571060 
    1058       ShowTree(info(10)); 
     1061//      ShowTree(info(10)); 
    10591062 
    10601063      // Check if some axis, domains or grids are eligible to for compressed indexed output. 
  • XIOS/dev/dev_olga/src/node/file.hpp

    r957 r992  
    115115         CVariableGroup* addVariableGroup(const string& id = ""); 
    116116 
    117          // Send info to serever 
     117         // Send info to server 
    118118         void sendEnabledFields(); 
    119119         void sendAddField(const string& id = ""); 
  • XIOS/dev/dev_olga/src/server.cpp

    r983 r992  
    1818{ 
    1919    MPI_Comm CServer::intraComm ; 
     20    list<MPI_Comm> CServer::interCommLeft ; 
     21    list<MPI_Comm> CServer::interCommRight ; 
    2022    list<MPI_Comm> CServer::interComm ; 
    2123    std::list<MPI_Comm> CServer::contextInterComms; 
     
    103105 
    104106               MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ; 
     107               interCommLeft.push_back(newComm) ; 
    105108               interComm.push_back(newComm) ; 
    106109            } 
     
    125128                         <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ; 
    126129                MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ; 
     130                interCommLeft.push_back(newComm) ; 
    127131                interComm.push_back(newComm) ; 
    128132              } 
     
    134138          } 
    135139 
    136         CClient::initializeClientOnServer(rank, intraComm, srvSndLeader); 
     140          CClient::initializeClientOnServer(rank, intraComm, srvSndLeader); 
     141          interCommRight.push_back(CClient::getInterComm()); 
     142          interComm.push_back(CClient::getInterComm()); 
     143 
    137144        } 
    138145 
     
    144151            if (it->first == hashServer1) 
    145152            { 
    146               // no changes needed here to create one context per process of the secondary server pool 
    147153              clientLeader=it->second ; 
    148154              int intraCommSize, intraCommRank ; 
     
    153159 
    154160              MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ; 
     161              interCommLeft.push_back(newComm) ; 
    155162              interComm.push_back(newComm) ; 
    156163 
     
    207214    void CServer::finalize(void) 
    208215    { 
    209       if (CXios::serverLevel == 1) 
    210       { 
    211         CClient::finalize(); 
    212       } 
    213216 
    214217      CTimer::get("XIOS").suspend() ; 
     
    219222        MPI_Comm_free(&(*it)); 
    220223 
    221       for (std::list<MPI_Comm>::iterator it = interComm.begin(); it != interComm.end(); it++) 
     224//      for (std::list<MPI_Comm>::iterator it = interComm.begin(); it != interComm.end(); it++) 
     225//        MPI_Comm_free(&(*it)); 
     226 
     227      for (std::list<MPI_Comm>::iterator it = interCommLeft.begin(); it != interCommLeft.end(); it++) 
     228        MPI_Comm_free(&(*it)); 
     229 
     230      for (std::list<MPI_Comm>::iterator it = interCommRight.begin(); it != interCommRight.end(); it++) 
    222231        MPI_Comm_free(&(*it)); 
    223232 
     
    263272     void CServer::listenFinalize(void) 
    264273     { 
    265         list<MPI_Comm>::iterator it; 
     274        list<MPI_Comm>::iterator it, itr; 
    266275        int msg ; 
    267276        int flag ; 
    268277 
    269         for(it=interComm.begin();it!=interComm.end();it++) 
     278        for(it=interCommLeft.begin();it!=interCommLeft.end();it++) 
    270279        { 
    271280           MPI_Status status ; 
     
    275284           if (flag==true) 
    276285           { 
    277               MPI_Recv(&msg,1,MPI_INT,0,0,*it,&status) ; 
    278               info(20)<<" CServer : Receive client finalize"<<endl ; 
     286             MPI_Recv(&msg,1,MPI_INT,0,0,*it,&status) ; 
     287             info(20)<<" CServer : Receive client finalize"<<endl ; 
     288 
     289             // If primary server, send finalize to secondary server pool(s) 
     290             for(itr=interCommRight.begin(); itr!=interCommRight.end(); itr++) 
     291             { 
     292               MPI_Send(&msg,1,MPI_INT,0,0,*itr) ; 
     293 
     294//               MPI_Comm_free(&(*itr)); 
     295//               interCommRight.erase(itr) ; 
     296             } 
     297 
    279298              MPI_Comm_free(&(*it)); 
    280               interComm.erase(it) ; 
     299//              interComm.erase(it) ; 
     300              interCommLeft.erase(it) ; 
    281301              break ; 
    282302            } 
    283303         } 
    284304 
    285          if (interComm.empty()) 
     305        if (interCommLeft.empty()) 
     306//        if (interComm.empty()) 
    286307         { 
    287308           int i,size ; 
  • XIOS/dev/dev_olga/src/server.hpp

    r987 r992  
    2727        // Communicators for the primary group of servers 
    2828        static MPI_Comm intraComm; 
    29         static list<MPI_Comm> interComm; 
     29        static list<MPI_Comm> interCommLeft;   // interComm between server and its client (client or primary server) 
     30        static list<MPI_Comm> interCommRight;  // interComm between primary server and secondary server (non-empty only for primary server pool) 
     31        static list<MPI_Comm> interComm;       // interCommLeft + interCommRight 
    3032        static std::list<MPI_Comm> contextInterComms; 
    3133        static CEventScheduler* eventScheduler; 
Note: See TracChangeset for help on using the changeset viewer.