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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 ; 
Note: See TracChangeset for help on using the changeset viewer.