Changeset 1853


Ignore:
Timestamp:
01/20/20 17:55:12 (3 months ago)
Author:
ymipsl
Message:

Coupling branch : replace hasServer and hasClient combination by the name of correct service : CLIENT, GATHERER or OUT_SERVER.

YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/context_client.cpp

    r1765 r1853  
    2222    */ 
    2323    CContextClient::CContextClient(CContext* parent, MPI_Comm intraComm_, MPI_Comm interComm_, CContext* cxtSer) 
    24      : mapBufferSize_(), parentServer(cxtSer), maxBufferedEvents(4) 
     24     : mapBufferSize_(), parentServer(cxtSer), maxBufferedEvents(4), associatedServer_(nullptr) 
    2525    { 
    2626       
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/context_client.hpp

    r1784 r1853  
    1414{ 
    1515  class CContext; 
    16  
     16  class CContextServer ; 
    1717  /*! 
    1818  \class CContextClient 
     
    6767      int getRemoteSize(void) {return serverSize;} 
    6868      int getServerSize(void) {return serverSize;} 
    69        
     69 
     70      /*! set the associated server (dual chanel client/server) */       
     71      void setAssociatedServer(CContextServer* associatedServer) { associatedServer=associatedServer_;} 
     72      /*! get the associated server (dual chanel client/server) */       
     73      CContextServer* getAssociatedServer(void) { return associatedServer_;} 
     74 
    7075    public: 
    7176      CContext* context; //!< Context for client 
     
    113118      std::vector<std::vector<MPI_Win> >windows ; //! one sided mpi windows to expose client buffers to servers == windows[nbServers][2] 
    114119      bool isAttached_ ; 
     120      CContextServer* associatedServer_ ; //!< The server associated to the pair client/server 
    115121 
    116122  }; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/context_server.cpp

    r1765 r1853  
    3030  using namespace std ; 
    3131 
    32   CContextServer::CContextServer(CContext* parent,MPI_Comm intraComm_,MPI_Comm interComm_) : eventScheduler_(nullptr), isProcessingEvent_(false) 
     32  CContextServer::CContextServer(CContext* parent,MPI_Comm intraComm_,MPI_Comm interComm_)  
     33    : eventScheduler_(nullptr), isProcessingEvent_(false), associatedClient_(nullptr) 
    3334  { 
    3435    context=parent; 
     
    288289      newBuffer>>size>>timeLine; 
    289290      it=events.find(timeLine); 
    290       if (it==events.end()) it=events.insert(pair<int,CEventServer*>(timeLine,new CEventServer)).first; 
     291      if (it==events.end()) it=events.insert(pair<int,CEventServer*>(timeLine,new CEventServer(this))).first; 
    291292      it->second->push(rank,buffers[rank],startBuffer,size); 
    292293 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/context_server.hpp

    r1764 r1853  
    1010{ 
    1111  class CContext ; 
     12  class CContextClient; 
    1213 
    1314  class CContextServer 
     
    6061    size_t hashId ; 
    6162 
     63    void setAssociatedClient(CContextClient* associatedClient) {associatedClient_=associatedClient ;} 
     64    CContextClient* getAssociatedClient(void) { return associatedClient_ ;} 
     65 
    6266    ~CContextServer() ; 
    6367 
     
    6771      CEventScheduler* eventScheduler_ ; 
    6872      bool isProcessingEvent_ ; 
     73      CContextClient* associatedClient_ ; 
    6974  } ; 
    7075 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/event_server.hpp

    r591 r1853  
    88namespace xios 
    99{ 
     10  class CContextServer ; 
    1011 
    1112  class CEventServer 
     
    1718    int nbSender ; 
    1819 
     20    CEventServer(CContextServer* contextServer) : contextServer_(contextServer) {} 
    1921 
    2022    void push(int rank,CServerBuffer* serverBuffer ,char* startBuffer,int size) ; 
    21  
     23    CContextServer* getContextServer(void) { return contextServer_ ;} 
     24     
    2225    struct SSubEvent 
    2326    { 
     
    3235    bool isFull(void) ; 
    3336    ~CEventServer() ;  
     37    private : 
     38 
     39    CContextServer* contextServer_ ; 
    3440  } ; 
    3541 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/file_writer_filter.cpp

    r1637 r1853  
    33#include "field.hpp" 
    44#include "utils.hpp" 
     5#include "context_client.hpp" 
    56 
    67namespace xios 
    78{ 
    8   CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field) 
     9  CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field, CContextClient* client) 
    910    : CInputPin(gc, 1) 
    10     , field(field) 
     11    , field(field), client_(client) 
    1112  { 
    1213    if (!field) 
     
    3435    } 
    3536 
    36     field->sendUpdateData(dataArray); 
     37    field->sendUpdateData(dataArray, client_); 
    3738  } 
    3839 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/file_writer_filter.hpp

    r1358 r1853  
    77{ 
    88  class CField; 
     9  class CContextClient ; 
    910 
    1011  /*! 
     
    2122       * \param field the associated field 
    2223       */ 
    23       CFileWriterFilter(CGarbageCollector& gc, CField* field); 
     24      CFileWriterFilter(CGarbageCollector& gc, CField* field, CContextClient* client); 
    2425 
    2526      /*! 
     
    4748    private: 
    4849      CField* field; //<! The associated field 
     50      CContextClient* client_ ; //! the associated context client 
    4951      std::map<Time, CDataPacketPtr> packets; //<! The stored packets 
    5052  }; // class CFileWriterFilter 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_input.cpp

    r1639 r1853  
    4747  { 
    4848    CContext* context = CContext::getCurrent(); 
    49     CContextServer* server = context->server; 
    5049 
    5150    CGrid* grid = field->grid; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_output.cpp

    r1847 r1853  
    7171 
    7272         CContext* context = CContext::getCurrent() ; 
    73          CContextServer* server=context->server ; 
    7473 
    7574         if (domain->IsWritten(this->filename)) return; 
     
    146145         string lonid,latid,bounds_lonid,bounds_latid ; 
    147146         string areaId = "area" + appendDomid; 
    148 /* 
    149          StdString lonid_loc = (server->intraCommSize > 1) 
    150                              ? StdString("lon").append(appendDomid).append("_local") 
    151                              : lonid; 
    152          StdString latid_loc = (server->intraCommSize > 1) 
    153                              ? StdString("lat").append(appendDomid).append("_local") 
    154                              : latid; 
    155 */ 
    156147 
    157148         CArray<int, 1>& indexToWrite = domain->localIndexToWriteOnServer; 
     
    246237                   SuperClassWriter::addDimension(dimVertId, domain->nvertex); 
    247238 
    248                  if (server->intraCommSize > 1) 
     239                 if (context->intraCommSize_ > 1) 
    249240                 { 
    250241                   this->writeLocalAttributes(domain->ibegin, 
     
    261252                                                      domain->nj, 
    262253                                                      domain->ni_glo,domain->nj_glo, 
    263                                                       server->intraCommRank,server->intraCommSize); 
     254                                                      context->intraCommRank_,context->intraCommSize_); 
    264255                 } 
    265256 
     
    300291 
    301292 
    302   // supress mask               if (server->intraCommSize > 1) 
     293  // supress mask               if (context->intraCommSize_ > 1) 
    303294  // supress mask               { 
    304295  // supress mask                  SuperClassWriter::addVariable(maskid, NC_INT, dim0); 
     
    548539    { 
    549540      CContext* context = CContext::getCurrent() ; 
    550       CContextServer* server=context->server ; 
    551541 
    552542      if (domain->IsWritten(this->filename)) return; 
     
    571561      StdString domainName = domain->name; 
    572562      domain->assignMesh(domainName, domain->nvertex); 
    573       domain->mesh->createMeshEpsilon(server->intraComm, domain->lonvalue, domain->latvalue, domain->bounds_lonvalue, domain->bounds_latvalue); 
     563      domain->mesh->createMeshEpsilon(context->intraComm_, domain->lonvalue, domain->latvalue, domain->bounds_lonvalue, domain->bounds_latvalue); 
    574564 
    575565      StdString node_x = domainName + "_node_x"; 
     
    908898      { 
    909899         CContext* context = CContext::getCurrent() ; 
    910          CContextServer* server=context->server ; 
    911900 
    912901         if (domain->IsWritten(this->filename)) return; 
     
    18141803      { 
    18151804        CContext* context = CContext::getCurrent() ; 
    1816         CContextServer* server=context->server ; 
    18171805 
    18181806        std::vector<StdString> dims, coodinates; 
     
    23582346      { 
    23592347        CContext* context = CContext::getCurrent(); 
    2360         CContextServer* server = context->server; 
    23612348        CGrid* grid = field->grid; 
    23622349 
     
    24622449        } 
    24632450 
    2464          bool isRoot = (server->intraCommRank == 0); 
     2451         bool isRoot = (context->intraCommRank_ == 0); 
    24652452 
    24662453         if (!field->scale_factor.isEmpty() || !field->add_offset.isEmpty()) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp

    r1787 r1853  
    319319      { 
    320320        // Avoid this check at writing because it fails in case of a hole 
    321         if (context->hasClient) 
     321        if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    322322        { 
    323323          StdSize true_size = value.numElements(); 
     
    333333      this->checkBounds(); 
    334334 
    335       if (context->hasClient) 
     335      if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    336336      { 
    337337        this->checkMask(); 
     
    512512 
    513513     CContext* context=CContext::getCurrent(); 
    514      if (context->hasClient && !context->hasServer) this->checkAttributes(); 
     514     if (context->getServiceType()==CServicesManager::CLIENT) this->checkAttributes(); 
    515515 
    516516     this->areClientAttributesChecked_ = true; 
     
    529529 
    530530     if (this->isClientAfterTransformationChecked) return; 
    531      if (context->hasClient) 
     531     if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    532532     {         
    533533       if (orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType)) 
     
    556556 
    557557     if (this->isChecked) return; 
    558      if (context->hasClient) sendAttributes(globalDim, orderPositionInGrid, distType);     
     558     if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) sendAttributes(globalDim, orderPositionInGrid, distType);     
    559559 
    560560     this->isChecked = true; 
     
    734734 
    735735    CContext* context=CContext::getCurrent();       
    736     CContextServer* server = context->server;  
    737736 
    738737    // We describe the distribution of client (server) on which data are written 
     
    742741    nBeginGlobal[0] = 0;  
    743742    nGlob[0]        = n_glo; 
    744     CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob);  
     743    CDistributionServer srvDist(context->intraCommSize_, nBegin, nSize, nBeginGlobal, nGlob);  
    745744    const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex(); 
    746745 
     
    784783      size_t nbWritten = 0, indGlo; 
    785784      CContext* context=CContext::getCurrent();       
    786       CContextServer* server = context->server;  
    787  
     785  
    788786      // We describe the distribution of client (server) on which data are written 
    789787      std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1); 
     
    792790      nBeginGlobal[0] = 0;  
    793791      nGlob[0]        = n_glo; 
    794       CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob);  
     792      CDistributionServer srvDist(context->intraCommSize_, nBegin, nSize, nBeginGlobal, nGlob);  
    795793      const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex(); 
    796794      std::unordered_map<size_t,size_t>::const_iterator itb = globalLocalIndexMap_.begin(), 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp

    r1848 r1853  
    432432    server = new CContextServer(this,intraComm_, interCommServer); // check if we need to dupl. intraComm_ ? 
    433433    client = new CContextClient(this,intraCommClient,interCommClient); 
     434    client->setAssociatedServer(server) ;   
     435    server->setAssociatedClient(client) ;   
    434436 
    435437  } 
     
    492494      client = new CContextClient(this, intraCommClient, interCommClient); 
    493495      server = new CContextServer(this, intraCommServer, interCommServer); 
    494      
     496      client->setAssociatedServer(server) ; 
     497      server->setAssociatedClient(client) ; 
    495498    } 
    496499     
     
    526529        MPI_Comm_dup(intraComm_, &intraCommServer) ; 
    527530 
    528  
    529         clientPrimServer.push_back(new CContextClient(this, intraCommClient, interCommClient)); 
    530         serverPrimServer.push_back(new CContextServer(this, intraCommServer, interCommServer));   
     531        CContextClient* client = new CContextClient(this, intraCommClient, interCommClient) ; 
     532        CContextServer* server = new CContextServer(this, intraCommServer, interCommServer) ; 
     533        client->setAssociatedServer(server) ; 
     534        server->setAssociatedClient(client) ; 
     535        clientPrimServer.push_back(client); 
     536        serverPrimServer.push_back(server);   
     537 
    531538       
    532539      } 
     
    592599         CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); 
    593600         CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); 
     601         client->setAssociatedServer(server) ; 
     602         server->setAssociatedClient(client) ; 
    594603       } 
    595604       else 
     
    599608          CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); 
    600609          CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); 
     610          client->setAssociatedServer(server) ; 
     611          server->setAssociatedClient(client) ; 
    601612       } 
    602613       MPI_Comm_free(&interComm) ; 
     
    633644      if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ; 
    634645 
    635       if (hasClient && !hasServer) 
     646      if (serviceType_==CServicesManager::CLIENT) 
    636647      { 
    637648        doPreTimestepOperationsForEnabledReadModeFiles(); // For now we only use server level 1 to read data 
     
    650661        info(100)<<"DEBUG: context "<<getId()<<" release client ok"<<endl ; 
    651662      } 
    652       else if (hasClient && hasServer) 
     663      else if (serviceType_==CServicesManager::GATHERER) 
    653664      { 
    654665         for (int i = 0; i < clientPrimServer.size(); ++i) 
     
    672683 
    673684      } 
    674       else if (!hasClient && hasServer) 
     685      else if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER) 
    675686      { 
    676687        closeAllFile(); 
     
    724735     checkGridEnabledFields(); 
    725736 
    726      setClientServerBuffer(client, (hasClient && !hasServer)); 
     737     setClientServerBuffer(client, (serviceType_==CServicesManager::CLIENT) ) ; 
    727738     for (int i = 0; i < clientPrimServer.size(); ++i) 
    728739         setClientServerBuffer(clientPrimServer[i], true); 
    729740 
    730741     
    731      if (hasClient) 
     742     if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) 
    732743     {  
    733        if (hasServer) 
     744       if (serviceType_==CServicesManager::GATHERER) 
    734745       {  
    735746         for (auto it=clientPrimServer.begin(); it!=clientPrimServer.end();++it)  
     
    739750         } 
    740751       } 
    741        else 
     752       else  
    742753       { 
    743754         this->sendAllAttributesToServer(client);   // Send all attributes of current context to server 
     
    750761      sendEnabledFiles(this->enabledWriteModeFiles); 
    751762      // We only use server-level 1 (for now) to read data 
    752       if (!hasServer) 
    753         sendEnabledFiles(this->enabledReadModeFiles); 
     763      if (serviceType_==CServicesManager::CLIENT)  sendEnabledFiles(this->enabledReadModeFiles); 
    754764 
    755765      // Then, send all enabled fields       
    756766      sendEnabledFieldsInFiles(this->enabledWriteModeFiles); 
    757       if (!hasServer) 
    758         sendEnabledFieldsInFiles(this->enabledReadModeFiles); 
     767       
     768      if (serviceType_==CServicesManager::CLIENT) sendEnabledFieldsInFiles(this->enabledReadModeFiles); 
    759769 
    760770      // Then, check whether we have domain_ref, axis_ref or scalar_ref attached to the enabled fields 
    761771      // If any, so send them to server 
    762        sendRefDomainsAxisScalars(this->enabledWriteModeFiles); 
    763       if (!hasServer) 
    764         sendRefDomainsAxisScalars(this->enabledReadModeFiles);         
     772       sendRefDomainsAxisScalars(this->enabledWriteModeFiles);  
     773      
     774      if (serviceType_==CServicesManager::CLIENT) sendRefDomainsAxisScalars(this->enabledReadModeFiles);         
    765775 
    766776       // Check whether enabled fields have grid_ref, if any, send this info to server 
     
    780790      // Finally, we send information of grid itself to server  
    781791      sendGridEnabledFieldsInFiles(this->enabledWriteModeFiles);        
    782       if (!hasServer) 
    783         sendGridEnabledFieldsInFiles(this->enabledReadModeFiles);        
     792      
     793      if (serviceType_==CServicesManager::CLIENT) sendGridEnabledFieldsInFiles(this->enabledReadModeFiles);        
     794      
    784795     } 
    785796     allProcessed = true; 
     
    790801   TRY 
    791802   { 
    792       // Use correct context client to send message 
    793      // int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 
    794     int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; 
    795      for (int i = 0; i < nbSrvPools; ++i) 
    796      { 
    797        CContextClient* contextClientTmp = (0 != clientPrimServer.size()) ? clientPrimServer[i] : client; 
     803 
     804    int nbSrvPools ; 
     805    if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; 
     806    else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; 
     807    else nbSrvPools = 0 ; 
     808    CContextClient* contextClientTmp ; 
     809 
     810    for (int i = 0; i < nbSrvPools; ++i) 
     811     { 
     812       if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; 
     813       else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; 
     814       
    798815       CEventClient event(getType(),EVENT_ID_POST_PROCESS_GLOBAL_ATTRIBUTES); 
    799816 
     
    844861    postProcessingGlobalAttributes(); 
    845862 
    846     if (hasClient) sendPostProcessingGlobalAttributes(); 
     863    if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) sendPostProcessingGlobalAttributes(); 
    847864 
    848865    // There are some processings that should be done after all of above. For example: check mask or index 
    849866    this->buildFilterGraphOfEnabledFields(); 
    850867     
    851      if (hasClient && !hasServer) 
     868     if (serviceType_==CServicesManager::CLIENT) 
    852869    { 
    853870      buildFilterGraphOfFieldsWithReadAccess(); 
     
    857874    checkGridEnabledFields();    
    858875 
    859     if (hasClient) this->sendProcessingGridOfEnabledFields(); 
    860     if (hasClient) this->sendCloseDefinition(); 
     876    if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) this->sendProcessingGridOfEnabledFields(); 
     877    if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) this->sendCloseDefinition(); 
    861878 
    862879    // Nettoyage de l'arborescence 
    863     if (hasClient) CleanTree(); // Only on client side?? 
    864  
    865     if (hasClient) 
    866     { 
    867       sendCreateFileHeader(); 
    868       if (!hasServer) startPrefetchingOfEnabledReadModeFiles(); 
    869     } 
     880    if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) CleanTree(); // Only on client side?? 
     881 
     882    if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) sendCreateFileHeader(); 
     883    if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); 
     884     
    870885    CTimer::get("Context : close definition").suspend() ; 
    871886   } 
     
    11091124      const vector<CGrid*> allGrids= CGrid::getAll(); 
    11101125 
    1111       if (hasClient && !hasServer) 
    1112       //if (hasClient) 
     1126      if (serviceType_==CServicesManager::CLIENT) 
    11131127      { 
    11141128        for (unsigned int i = 0; i < allFiles.size(); i++) 
     
    12291243     double eps=std::numeric_limits<double>::epsilon()*10 ; 
    12301244      
    1231      // If primary server 
    1232      if (hasServer && hasClient) 
     1245     if (serviceType_==CServicesManager::GATHERER) 
    12331246     { 
    12341247       std::ofstream ofs(("distribute_file_"+getId()+".dat").c_str(), std::ofstream::out); 
     
    13101323   TRY 
    13111324   { 
    1312      // If primary server 
    1313      if (hasServer && hasClient) 
     1325     if (serviceType_==CServicesManager::GATHERER) 
    13141326     { 
    13151327       int nbPools = clientPrimServer.size(); 
     
    15021514   TRY 
    15031515   { 
    1504      // Use correct context client to send message 
    1505      int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; 
    1506      for (int i = 0; i < nbSrvPools; ++i) 
    1507      { 
    1508        CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; 
     1516    int nbSrvPools ; 
     1517    if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; 
     1518    else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; 
     1519    else nbSrvPools = 0 ; 
     1520    CContextClient* contextClientTmp ; 
     1521 
     1522    for (int i = 0; i < nbSrvPools; ++i) 
     1523     { 
     1524       if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; 
     1525       else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; 
    15091526       CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION); 
    15101527       if (contextClientTmp->isServerLeader()) 
     
    15341551   TRY 
    15351552   { 
    1536      // Use correct context client to send message 
    1537     int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; 
    1538      for (int i = 0; i < nbSrvPools; ++i) 
    1539      { 
    1540        CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; 
     1553    int nbSrvPools ; 
     1554    if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; 
     1555    else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; 
     1556    else nbSrvPools = 0 ; 
     1557    CContextClient* contextClientTmp ; 
     1558 
     1559    for (int i = 0; i < nbSrvPools; ++i) 
     1560    { 
     1561       if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; 
     1562       else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; 
    15411563       CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR); 
    15421564 
     
    15441566         { 
    15451567           CMessage msg; 
    1546            if (hasServer) 
    1547              msg<<step; 
    1548            else 
    1549              msg<<step; 
     1568           msg<<step; 
    15501569           const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    15511570           for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     
    15741593      buffer>>step; 
    15751594      updateCalendar(step); 
    1576       if (hasClient && hasServer) 
     1595      if (serviceType_==CServicesManager::GATHERER) 
    15771596      {         
    15781597        sendUpdateCalendar(step); 
     
    15851604   TRY 
    15861605   { 
    1587      // Use correct context client to send message 
    1588      // int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 
    1589      int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; 
     1606     int nbSrvPools ; 
     1607     if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; 
     1608     else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; 
     1609     else nbSrvPools = 0 ; 
     1610     CContextClient* contextClientTmp ; 
     1611 
    15901612     for (int i = 0; i < nbSrvPools; ++i) 
    15911613     { 
    1592        CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; 
     1614       if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; 
     1615       else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; 
    15931616       CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER); 
    15941617 
     
    16191642   TRY 
    16201643   { 
    1621       if (!hasClient && hasServer)  
     1644      if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER)  
    16221645        createFileHeader(); 
    16231646   } 
     
    16281651   TRY 
    16291652   { 
    1630       // Use correct context client to send message 
    1631      int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; 
     1653     int nbSrvPools ; 
     1654     if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; 
     1655     else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; 
     1656     else nbSrvPools = 0 ; 
     1657     CContextClient* contextClientTmp ; 
     1658 
    16321659     for (int i = 0; i < nbSrvPools; ++i) 
    16331660     { 
    1634        CContextClient* contextClientTmp = (0 != clientPrimServer.size()) ? clientPrimServer[i] : client; 
     1661       if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; 
     1662       else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; 
     1663 
    16351664       CEventClient event(getType(),EVENT_ID_PROCESS_GRID_ENABLED_FIELDS); 
    16361665 
     
    16611690   TRY 
    16621691   { 
    1663       // Use correct context client to send message 
    1664      // int nbSrvPools = (hasServer) ? clientPrimServer.size() : 1; 
    1665      int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; 
     1692     int nbSrvPools ; 
     1693     if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; 
     1694     else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; 
     1695     else nbSrvPools = 0 ; 
     1696     CContextClient* contextClientTmp ; 
     1697 
    16661698     for (int i = 0; i < nbSrvPools; ++i) 
    16671699     { 
    1668        CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; 
     1700       if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; 
     1701       else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; 
    16691702       CEventClient event(getType(),EVENT_ID_POST_PROCESS); 
    16701703       if (contextClientTmp->isServerLeader()) 
     
    17321765 
    17331766      // The timeseries should only be prepared in client 
    1734       if (hasClient && !hasServer) prepareTimeseries(); 
     1767 
     1768      if (serviceType_==CServicesManager::CLIENT) prepareTimeseries(); 
    17351769 
    17361770      //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
     
    17541788      //   findAllEnabledFieldsInFiles(this->enabledReadModeFiles);       
    17551789 
    1756       if (hasClient && !hasServer) 
     1790      if (serviceType_==CServicesManager::CLIENT) 
    17571791      { 
    17581792        initReadFiles(); 
     
    17681802 
    17691803      // Find all fields with read access from the public API 
    1770       if (hasClient && !hasServer) findFieldsWithReadAccess(); 
     1804      if (serviceType_==CServicesManager::CLIENT) findFieldsWithReadAccess(); 
    17711805      // and solve the all reference for them 
    1772       if (hasClient && !hasServer) solveAllRefOfFieldsWithReadAccess(); 
     1806      if (serviceType_==CServicesManager::CLIENT) solveAllRefOfFieldsWithReadAccess(); 
    17731807 
    17741808      isPostProcessed = true; 
     
    19201954   TRY 
    19211955   { 
    1922      if (!hasClient) return; 
     1956     if (!(serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER)) return; 
    19231957 
    19241958     const vector<CAxis*> allAxis = CAxis::getAll(); 
     
    19401974   TRY 
    19411975   { 
    1942      if (!hasClient) return; 
     1976     if (!(serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER)) return; 
    19431977 
    19441978     const std::vector<CFile*> allFiles = CFile::getAll(); 
     
    21462180      if (prevStep < step) 
    21472181      { 
    2148         if (hasClient && !hasServer) // For now we only use server level 1 to read data 
     2182        if (serviceType_==CServicesManager::CLIENT) // For now we only use server level 1 to read data 
    21492183        { 
    21502184          doPreTimestepOperationsForEnabledReadModeFiles(); 
     
    21582192  #endif 
    21592193 
    2160         if (hasClient && !hasServer) // For now we only use server level 1 to read data 
     2194        if (serviceType_==CServicesManager::CLIENT) // For now we only use server level 1 to read data 
    21612195        { 
    21622196          doPostTimestepOperationsForEnabledReadModeFiles(); 
     
    22682302    registryOut->hierarchicalGatherRegistry() ; 
    22692303 
    2270     // Use correct context client to send message 
    2271     int nbSrvPools = (this->hasServer) ? (this->hasClient ? this->clientPrimServer.size() : 0) : 1; 
     2304    int nbSrvPools ; 
     2305    if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; 
     2306    else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; 
     2307    else nbSrvPools = 0 ; 
     2308    CContextClient* contextClientTmp ; 
     2309 
    22722310    for (int i = 0; i < nbSrvPools; ++i) 
    22732311    { 
    2274       CContextClient* contextClientTmp = (hasServer) ? clientPrimServer[i] : client; 
     2312      if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; 
     2313      else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; 
     2314 
    22752315      CEventClient event(CContext::GetType(), CContext::EVENT_ID_SEND_REGISTRY); 
    2276         if (contextClientTmp->isServerLeader()) 
    2277         { 
    2278            CMessage msg ; 
    2279            if (contextClientTmp->clientRank==0) msg<<*registryOut ; 
    2280            const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    2281            for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     2316      if (contextClientTmp->isServerLeader()) 
     2317      { 
     2318        CMessage msg ; 
     2319        if (contextClientTmp->clientRank==0) msg<<*registryOut ; 
     2320        const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
     2321        for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    22822322             event.push(*itRank,1,msg); 
    2283            contextClientTmp->sendEvent(event); 
    2284          } 
    2285          else contextClientTmp->sendEvent(event); 
     2323        contextClientTmp->sendEvent(event); 
     2324      } 
     2325      else contextClientTmp->sendEvent(event); 
    22862326    } 
    22872327  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp

    r1787 r1853  
    17271727 
    17281728     if (this->isClientAfterTransformationChecked) return; 
    1729      if (context->hasClient) 
     1729     if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    17301730     { 
    17311731      this->computeConnectedClients(); 
    17321732       if (hasLonLat) 
    1733          if (!context->hasServer) 
     1733         if (context->getServiceType()==CServicesManager::CLIENT) 
    17341734           this->completeLonLatClient(); 
    17351735     } 
     
    17481748     CContext* context=CContext::getCurrent(); 
    17491749 
    1750       if (context->hasClient && !context->hasServer) 
     1750      if (context->getServiceType()==CServicesManager::CLIENT) 
    17511751      { 
    17521752        this->checkDomain(); 
     
    17561756      } 
    17571757 
    1758       if (context->hasClient && !context->hasServer) 
     1758      if (context->getServiceType()==CServicesManager::CLIENT) 
    17591759      { // Ct client uniquement 
    17601760         this->checkMask(); 
     
    17801780 
    17811781     if (this->isChecked) return; 
    1782      if (context->hasClient) 
     1782     if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    17831783     { 
    17841784       sendAttributes(); 
     
    17991799      this->checkArea(); 
    18001800 
    1801       if (context->hasClient) 
     1801      if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    18021802      { // Ct client uniquement 
    18031803         this->checkMask(); 
     
    18111811      } 
    18121812 
    1813       if (context->hasClient) 
     1813      if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    18141814      { 
    18151815        this->computeConnectedClients(); 
     
    19721972 
    19731973      CContext* context=CContext::getCurrent();       
    1974       CContextServer* server = context->server;   
    19751974 
    19761975      std::vector<int> nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2); 
     
    19791978      nBeginGlobal[0] = 0; nBeginGlobal[1] = 0; 
    19801979      nGlob[0]        = ni_glo;   nGlob[1] = nj_glo; 
    1981       CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob);  
     1980      CDistributionServer srvDist(context->intraCommSize_, nBegin, nSize, nBeginGlobal, nGlob);  
    19821981      const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex(); 
    19831982 
     
    20182017      size_t nbWritten = 0, indGlo; 
    20192018      CContext* context=CContext::getCurrent();       
    2020       CContextServer* server = context->server;   
    20212019 
    20222020      std::vector<int> nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2); 
     
    20252023      nBeginGlobal[0] = 0; nBeginGlobal[1] = 0; 
    20262024      nGlob[0]        = ni_glo;   nGlob[1] = nj_glo; 
    2027       CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob);  
     2025      CDistributionServer srvDist(context->intraCommSize_, nBegin, nSize, nBeginGlobal, nGlob);  
    20282026      const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex(); 
    20292027 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp

    r1847 r1853  
    143143  CATCH 
    144144 
    145   void CField::sendUpdateData(const CArray<double,1>& data) 
     145  void CField::sendUpdateData(const CArray<double,1>& data, CContextClient* client) 
    146146  TRY 
    147147  { 
    148148    CTimer::get("Field : send data").resume(); 
    149  
    150     CContext* context = CContext::getCurrent(); 
    151     CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 
    152149    int receiverSize = client->serverSize; 
    153150 
     
    319316    \param [in] tsDataRequested timestamp when the call is made 
    320317  */ 
    321   bool CField::sendReadDataRequest(const CDate& tsDataRequested) 
     318  bool CField::sendReadDataRequest(const CDate& tsDataRequested, CContextClient* client) 
    322319  TRY 
    323320  { 
    324321    CContext* context = CContext::getCurrent(); 
    325     // CContextClient* client = context->client; 
    326  
    327     // This code is for future: If we want to read file with level-2 servers 
    328     CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 
    329322 
    330323    lastDataRequestedFromServer = tsDataRequested; 
     
    372365      info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 
    373366 
    374       dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); 
     367      dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq, file->getContextClient()); 
    375368    } 
    376369 
     
    385378    StdString fieldId; 
    386379    *buffer >> fieldId; 
    387     get(fieldId)->recvReadDataRequest(); 
     380    get(fieldId)->recvReadDataRequest(event.getContextServer()); 
    388381  } 
    389382  CATCH 
     
    395388    In the future, this should (only) be done by the last level servers. 
    396389  */ 
    397   void CField::recvReadDataRequest(void) 
     390  void CField::recvReadDataRequest(CContextServer* server) 
    398391  TRY 
    399392  { 
    400     CContext* context = CContext::getCurrent(); 
    401     CContextClient* client = context->client; 
    402  
     393    CContextClient* client = server->getAssociatedClient() ; 
    403394    CEventClient event(getType(), EVENT_ID_READ_DATA_READY); 
    404395    std::list<CMessage> msgs; 
     
    532523    if (!nstepMaxRead) 
    533524    { 
    534        MPI_Allreduce(MPI_IN_PLACE, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm); 
     525       MPI_Allreduce(MPI_IN_PLACE, &nstepMax, 1, MPI_INT, MPI_MAX, context->intraComm_); 
    535526       nstepMaxRead = true; 
    536527    } 
     
    809800   { 
    810801     CContext* context = CContext::getCurrent(); 
    811      if (context->hasClient && !context->hasServer) 
     802     if (context->getServiceType()==CServicesManager::CLIENT) 
    812803     { 
    813804       if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) 
     
    826817   { 
    827818     CContext* context = CContext::getCurrent(); 
    828      if (context->hasClient && !context->hasServer) 
     819     if (context->getServiceType()==CServicesManager::CLIENT) 
    829820     { 
    830821       std::map<CGrid*,std::pair<bool,StdString> >& gridSrcMap = grid->getTransGridSource(); 
     
    913904   { 
    914905     CContext* context = CContext::getCurrent(); 
    915      bool hasClient = context->hasClient; 
    916      bool hasServer = context->hasServer; 
    917906 
    918907     if (!isReferenceSolvedAndTransformed) 
     
    920909        isReferenceSolvedAndTransformed = true; 
    921910 
    922         if (hasClient && !hasServer) 
     911        if (context->getServiceType()==CServicesManager::CLIENT) 
    923912        { 
    924913          solveRefInheritance(true); 
     
    926915        } 
    927916 
    928         if (hasServer) 
     917        if (context->getServiceType()==CServicesManager::GATHERER || context->getServiceType()==CServicesManager::OUT_SERVER) 
    929918          solveServerOperation(); 
    930919 
    931920        solveGridReference(); 
    932921 
    933         if (hasClient && !hasServer) 
     922       if (context->getServiceType()==CServicesManager::CLIENT) 
    934923       { 
    935924         solveGenerateGrid(); 
     
    939928       solveGridDomainAxisRef(false); 
    940929 
    941        if (hasClient && !hasServer) 
     930       if (context->getServiceType()==CServicesManager::CLIENT) 
    942931       { 
    943932         solveTransformedGrid(); 
     
    984973        isReferenceSolved = true; 
    985974 
    986         if (context->hasClient && !context->hasServer) 
     975        if (context->getServiceType()==CServicesManager::CLIENT) 
    987976        { 
    988977          solveRefInheritance(true); 
     
    990979        } 
    991980 
    992         if (context->hasServer) 
     981        if (context->getServiceType()==CServicesManager::GATHERER || context->getServiceType()==CServicesManager::OUT_SERVER) 
    993982          solveServerOperation(); 
    994983 
     
    996985        grid->solveDomainAxisRefInheritance(true); // make it again to solve grid reading from file 
    997986 
    998         if (context->hasClient && !context->hasServer) 
     987       if (context->getServiceType()==CServicesManager::CLIENT) 
    999988       { 
    1000989         solveGenerateGrid(); 
     
    10151004        areAllReferenceSolved = true; 
    10161005        
    1017         if (context->hasClient && !context->hasServer) 
     1006        if (context->getServiceType()==CServicesManager::CLIENT) 
    10181007        { 
    10191008          solveRefInheritance(true); 
    10201009          if (hasDirectFieldReference()) getDirectFieldReference()->solveAllReferenceEnabledField(false); 
    10211010        } 
    1022         else if (context->hasServer) 
     1011        else if (context->getServiceType()==CServicesManager::GATHERER || context->getServiceType()==CServicesManager::OUT_SERVER) 
    10231012          solveServerOperation(); 
    10241013 
     
    10281017     solveGridDomainAxisRef(doSending2Server); 
    10291018 
    1030      if (context->hasClient && !context->hasServer) 
     1019     if (context->getServiceType()==CServicesManager::CLIENT) 
    10311020     { 
    10321021       solveTransformedGrid(); 
     
    10651054      CContext* context = CContext::getCurrent(); 
    10661055 
    1067       if (!context->hasServer || !hasOutputFile) return; 
     1056      if (context->getServiceType()==CServicesManager::CLIENT || !hasOutputFile) return; 
    10681057 
    10691058      if (freq_op.isEmpty()) 
     
    11261115 
    11271116     CContext* context = CContext::getCurrent(); 
    1128      bool hasWriterServer = context->hasServer && !context->hasClient; 
    1129      bool hasIntermediateServer = context->hasServer && context->hasClient; 
     1117     bool hasWriterServer = context->getServiceType()==CServicesManager::OUT_SERVER ; 
     1118     bool hasIntermediateServer = context->getServiceType()==CServicesManager::GATHERER ; 
    11301119 
    11311120     if (hasWriterServer) 
     
    11551144         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 
    11561145         { 
    1157            fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
     1146           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, file->getContextClient())); 
    11581147           instantDataFilter->connectOutput(fileWriterFilter, 0); 
    11591148         } 
     
    12171206         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 
    12181207         { 
    1219            fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
     1208           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, file->getContextClient())); 
    12201209           getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
    12211210         } 
     
    17361725     CContext* context = CContext::getCurrent(); 
    17371726     client = contextClient; 
    1738      if (context->hasClient) 
    1739      { 
    1740        // A grid is sent by a client (both for read or write) or by primary server (write only) 
    1741        if (context->hasServer) 
    1742        { 
    1743          if (file->mode.isEmpty() || (!file->mode.isEmpty() && file->mode == CFile::mode_attr::write)) 
    1744            grid->setContextClient(contextClient); 
    1745        } 
    1746        else 
    1747            grid->setContextClient(contextClient); 
    1748      } 
     1727   
     1728     // A grid is sent by a client (both for read or write) or by primary server (write only) 
     1729     if (context->getServiceType()==CServicesManager::GATHERER) 
     1730     { 
     1731       if (file->mode.isEmpty() || (!file->mode.isEmpty() && file->mode == CFile::mode_attr::write)) 
     1732         grid->setContextClient(contextClient); 
     1733     } 
     1734     else if (context->getServiceType()==CServicesManager::CLIENT) 
     1735       grid->setContextClient(contextClient); 
    17491736   } 
    17501737   CATCH_DUMP_ATTR 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp

    r1784 r1853  
    4646   END_DECLARE_ATTRIBUTE_MAP(CField) 
    4747 
     48   class CContextClient ; 
    4849   ///-------------------------------------------------------------- 
    4950   class CField 
     
    167168        void recvUpdateData(std::map<int,CBufferIn*>& rankBuffers); 
    168169        void writeField(void); 
    169         bool sendReadDataRequest(const CDate& tsDataRequested); 
     170        bool sendReadDataRequest(const CDate& tsDataRequested, CContextClient* client); 
    170171        bool sendReadDataRequestIfNeeded(void); 
    171172        static void recvReadDataRequest(CEventServer& event); 
    172         void recvReadDataRequest(void); 
     173        void recvReadDataRequest(CContextServer* server); 
    173174        EReadField readField(void); 
    174175        static void recvReadDataReady(CEventServer& event); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/file.cpp

    r1784 r1853  
    226226      CContext* context = CContext::getCurrent(); 
    227227      const CDate& currentDate = context->calendar->getCurrentDate(); 
    228       CContextServer* server = context->server; 
    229228 
    230229      lastSync  = currentDate; 
     
    294293    { 
    295294      CContext* context = CContext::getCurrent(); 
    296       CContextServer* server = context->server; 
    297295 
    298296      // create sub communicator for file 
     
    307305 
    308306      int color = allZoneEmpty ? 0 : 1; 
    309       MPI_Comm_split(server->intraComm, color, server->intraCommRank, &fileComm); 
     307      MPI_Comm_split(context->intraComm_, color, context->intraCommRank_, &fileComm); 
    310308      if (allZoneEmpty) MPI_Comm_free(&fileComm); 
    311309    } 
     
    443441   { 
    444442      CContext* context = CContext::getCurrent(); 
    445       CContextServer* server = context->server; 
    446  
     443       
    447444      if (!allZoneEmpty) 
    448445      { 
     
    560557            MPI_Comm_rank(fileComm, &commRank); 
    561558 
    562             if (server->intraCommSize > 1) 
     559            if (context->intraCommSize_ > 1) 
    563560            { 
    564561              oss << "_" ; 
     
    636633  { 
    637634    CContext* context = CContext::getCurrent(); 
    638     CContextServer* server = context->server; 
    639635    MPI_Comm readComm = this->fileComm; 
    640636 
     
    683679        MPI_Comm_rank(readComm, &commRank); 
    684680 
    685         if (server->intraCommSize > 1) 
     681        if (context->intraCommSize_ > 1) 
    686682        { 
    687683          oss << "_"; 
     
    699695      bool isCollective = par_access.isEmpty() || par_access == par_access_attr::collective; 
    700696      bool readMetaDataPar = true; 
    701       if (!context->hasServer) readMetaDataPar = (read_metadata_par.isEmpty()) ? false : read_metadata_par; 
     697      if (context->getServiceType()==CServicesManager::CLIENT) readMetaDataPar = (read_metadata_par.isEmpty()) ? false : read_metadata_par; 
    702698 
    703699      if (isOpen) data_out->closeFile(); 
     
    10051001     int size = this->enabledFields.size(); 
    10061002     for (int i = 0; i < size; ++i) 
    1007        this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
     1003       this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate(), getContextClient()); 
    10081004   } 
    10091005   CATCH_DUMP_ATTR 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r1847 r1853  
    331331   { 
    332332     CContext* context = CContext::getCurrent(); 
    333      if (context->hasClient && this->isChecked && doSendingIndex && !isIndexSent)  
    334      {  
    335        if (isScalarGrid())  sendIndexScalarGrid(); 
    336        else  sendIndex(); 
    337        this->isIndexSent = true;  
     333     if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER)      
     334     { 
     335       if (this->isChecked && doSendingIndex && !isIndexSent)  
     336       {  
     337         if (isScalarGrid())  sendIndexScalarGrid(); 
     338         else  sendIndex(); 
     339         this->isIndexSent = true;  
     340       } 
    338341     } 
    339342 
     
    726729          } 
    727730 
    728           if (doGridHaveDataDistributed(client) && (nbIndex != localIndex.numElements())) 
     731          if (nbIndex != localIndex.numElements()) 
    729732               ERROR("void CGrid::computeClientIndex()", 
    730733                  << "Number of local index on client is different from number of received global index" 
     
    892895     { 
    893896       computeClientIndexScalarGrid(); 
    894        if (context->hasClient) 
     897       if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    895898       { 
    896899         computeConnectedClientsScalarGrid(); 
     
    900903     { 
    901904       computeClientIndex(); 
    902        if (context->hasClient) 
     905       if (context->getServiceType()==CServicesManager::CLIENT || context->getServiceType()==CServicesManager::GATHERER) 
    903906       { 
    904907         computeConnectedClients(); 
     
    14741477          } 
    14751478 
    1476           if (context->hasClient && !context->hasServer) 
     1479          if (context->getServiceType()==CServicesManager::CLIENT)   
    14771480            storeIndex_fromSrv_.insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 
    14781481 
     
    14971500          } 
    14981501 
    1499           if (context->hasClient && !context->hasServer) 
     1502          if (context->getServiceType()==CServicesManager::CLIENT) 
    15001503            storeIndex_fromSrv_.insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 
    15011504        } 
     
    15441547          { 
    15451548            storeIndex_toSrv_[client].insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
    1546             if (context->hasClient && !context->hasServer) 
     1549            if (context->getServiceType()==CServicesManager::CLIENT) 
    15471550              storeIndex_fromSrv_.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
    15481551             
     
    16441647      buffers.push_back(buffer); 
    16451648    } 
    1646     get(gridId)->recvIndex(ranks, buffers); 
     1649    get(gridId)->recvIndex(ranks, buffers, event.getContextServer()); 
    16471650  } 
    16481651  CATCH 
    16491652 
    1650   void CGrid::recvIndex(vector<int> ranks, vector<CBufferIn*> buffers) 
     1653  void CGrid::recvIndex(vector<int> ranks, vector<CBufferIn*> buffers, CContextServer* server) 
    16511654  TRY 
    16521655  { 
     
    16551658 
    16561659    nbReadSenders_.clear(); 
    1657     CContextServer* server = context->server  ; 
    1658     CContextClient* client = context->client;    
     1660    CContextClient* client = server->getAssociatedClient();    
    16591661       
    16601662    int idx = 0, numElement = axis_domain_order.numElements(); 
     
    18111813    if (isScalarGrid()) return; 
    18121814 
    1813     nbReadSenders_[client] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); 
     1815    nbReadSenders_[client] = CClientServerMappingDistributed::computeConnectedClients(client->serverSize, client->clientSize, 
     1816                                                                                      client->intraComm, ranks); 
    18141817 
    18151818  } 
     
    22222225    { 
    22232226      CDomain* pDom = CDomain::get(*it); 
    2224       if (context->hasClient && !context->hasServer)       
     2227      if (context->getServiceType()==CServicesManager::CLIENT) 
    22252228      { 
    22262229        pDom->solveRefInheritance(apply); 
     
    22342237    { 
    22352238      CAxis* pAxis = CAxis::get(*it); 
    2236       if (context->hasClient && !context->hasServer) 
     2239      if (context->getServiceType()==CServicesManager::CLIENT) 
    22372240      { 
    22382241        pAxis->solveRefInheritance(apply); 
     
    22462249    { 
    22472250      CScalar* pScalar = CScalar::get(*it); 
    2248       if (context->hasClient && !context->hasServer) 
     2251      if (context->getServiceType()==CServicesManager::CLIENT) 
    22492252      { 
    22502253        pScalar->solveRefInheritance(apply); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp

    r1847 r1853  
    160160         static bool dispatchEvent(CEventServer& event); 
    161161         static void recvIndex(CEventServer& event); 
    162          void recvIndex(vector<int> ranks, vector<CBufferIn*> buffers); 
     162         void recvIndex(vector<int> ranks, vector<CBufferIn*> buffers, CContextServer* server); 
    163163         void sendIndex(void); 
    164164         void sendIndexScalarGrid(); 
Note: See TracChangeset for help on using the changeset viewer.