Changeset 1784


Ignore:
Timestamp:
12/12/19 18:15:14 (4 years ago)
Author:
ymipsl
Message:
  • Preparing coupling functionalities.
  • Make some cleaner things

YM

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

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/config/coupler_in_attribute.conf

    r1782 r1784  
    11DECLARE_ATTRIBUTE(StdString, context) 
     2DECLARE_ATTRIBUTE(bool, enabled) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/config/coupler_out_attribute.conf

    r1782 r1784  
    11DECLARE_ATTRIBUTE(StdString, context) 
     2DECLARE_ATTRIBUTE(bool, enabled) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/context_client.hpp

    r1761 r1784  
    6565      void setBufferSize(const std::map<int,StdSize>& mapSize, const std::map<int,StdSize>& maxEventSize); 
    6666 
     67      int getRemoteSize(void) {return serverSize;} 
     68      int getServerSize(void) {return serverSize;} 
     69       
    6770    public: 
    6871      CContext* context; //!< Context for client 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/spatial_transform_filter.cpp

    r1645 r1784  
    187187    CTimer::get("CSpatialTransformFilterEngine::apply").resume();  
    188188     
    189     CContextClient* client = CContext::getCurrent()->client; 
     189    CContext* context = CContext::getCurrent(); 
    190190    int rank; 
    191     MPI_Comm_rank (client->intraComm, &rank); 
     191    MPI_Comm_rank (context->intraComm_, &rank); 
    192192 
    193193    // Get default value for output data 
     
    246246          } 
    247247          sendRecvRequest.push_back(MPI_Request()); 
    248           MPI_Isend(sendBuff[idxSendBuff], countSize, MPI_DOUBLE, destRank, 12, client->intraComm, &sendRecvRequest.back()); 
     248          MPI_Isend(sendBuff[idxSendBuff], countSize, MPI_DOUBLE, destRank, 12, context->intraComm_, &sendRecvRequest.back()); 
    249249        } 
    250250        else 
     
    279279          int countSize = itRecv->second.size(); 
    280280          sendRecvRequest.push_back(MPI_Request()); 
    281           MPI_Irecv(recvBuff + currentBuff, countSize, MPI_DOUBLE, srcRank, 12, client->intraComm, &sendRecvRequest.back()); 
     281          MPI_Irecv(recvBuff + currentBuff, countSize, MPI_DOUBLE, srcRank, 12, context->intraComm_, &sendRecvRequest.back()); 
    282282          currentBuff += countSize; 
    283283        } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/group_template.hpp

    r1542 r1784  
    7272         void addChildGroup(V* childGroup) ;  
    7373         static bool dispatchEvent(CEventServer& event) ; 
    74          void sendCreateChild(const string& id="") ; 
    7574         void sendCreateChild(const string& id, CContextClient* client) ; 
    76          void sendCreateChildGroup(const string& id="") ; 
     75         void sendCreateChildGroup(const string& id, CContextClient* client) ; 
    7776         static void recvCreateChild(CEventServer& event) ; 
    7877         void recvCreateChild(CBufferIn& buffer) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/group_template_impl.hpp

    r1542 r1784  
    368368    return CGroupFactory::AddGroup<V>(this->getShared(), childGroup->getShared()) ; 
    369369  } 
    370  
    371  
    372    template <class U, class V, class W> 
    373    void CGroupTemplate<U, V, W>::sendCreateChild(const string& id) 
    374    { 
    375     CContext* context=CContext::getCurrent() ;   
    376  
    377     if (context->hasClient) 
    378     // if (!context->hasServer ) 
    379     { 
    380       // Use correct context client to send message 
    381 //      CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; 
    382       int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    383       for (int i = 0; i < nbSrvPools; ++i) 
    384       { 
    385          CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    386  
    387          CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD) ; 
    388          if (contextClientTmp->isServerLeader()) 
    389          { 
    390            CMessage msg ; 
    391            msg<<this->getId() ; 
    392            msg<<id ; 
    393            const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    394            for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    395              event.push(*itRank,1,msg) ; 
    396            contextClientTmp->sendEvent(event) ; 
    397          } 
    398          else contextClientTmp->sendEvent(event) ; 
    399       } 
    400     } 
    401        
    402    } 
    403370 
    404371   template <class U, class V, class W> 
     
    420387   } 
    421388 
    422  
    423    template <class U, class V, class W> 
    424    void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id) 
    425    { 
    426     CContext* context=CContext::getCurrent() ; 
    427     if (context->hasClient) 
    428     { 
    429       // Use correct context client to send message 
    430       // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    431       int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    432       for (int i = 0; i < nbSrvPools; ++i) 
    433       { 
    434         CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    435         CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ; 
    436         if (contextClientTmp->isServerLeader()) 
    437         { 
    438           CMessage msg ; 
    439           msg<<this->getId() ; 
    440           msg<<id ; 
    441           const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    442           for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    443             event.push(*itRank,1,msg) ; 
    444           contextClientTmp->sendEvent(event) ; 
    445         } 
    446         else contextClientTmp->sendEvent(event) ; 
    447       } 
    448     } 
    449    } 
    450     
     389   template <class U, class V, class W> 
     390   void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id, CContextClient* client) 
     391   { 
     392     CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ; 
     393     if (client->isServerLeader()) 
     394     { 
     395       CMessage msg ; 
     396       msg<<this->getId() ; 
     397       msg<<id ; 
     398       const std::list<int>& ranks = client->getRanksServerLeader(); 
     399       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     400         event.push(*itRank,1,msg) ; 
     401       client->sendEvent(event) ; 
     402     } 
     403     else client->sendEvent(event) ; 
     404   }    
     405 
     406 
    451407   template <class U, class V, class W> 
    452408   void CGroupTemplate<U, V, W>::recvCreateChild(CEventServer& event) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp

    r1761 r1784  
    600600    CContext* context = CContext::getCurrent(); 
    601601 
    602     int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    603  
    604     connectedServerRank_.clear(); 
    605     nbSenders.clear(); 
    606  
    607     for (int p = 0; p < nbSrvPools; ++p) 
    608     { 
    609       CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; 
     602    set<int> listNbServer ; 
     603 
     604    for (auto client : clients) 
     605    { 
    610606      int nbServer = client->serverSize; 
    611607      int range, clientSize = client->clientSize; 
    612608      int rank = client->clientRank; 
    613609 
    614       if (connectedServerRank_.find(nbServer) == connectedServerRank_.end()) 
    615       { 
     610      if (listNbServer.find(nbServer)==listNbServer.end()) 
     611      { 
     612        listNbServer.insert(nbServer) ; 
     613  
     614        if (connectedServerRank_.find(nbServer) != connectedServerRank_.end()) 
     615        { 
     616          nbSenders.erase(nbServer); 
     617          connectedServerRank_.erase(nbServer); 
     618        } 
     619 
    616620        size_t ni = this->n.getValue(); 
    617621        size_t ibegin = this->begin.getValue(); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp

    r1766 r1784  
    2424#include "cxios.hpp" 
    2525#include "client.hpp" 
     26#include "coupler_in.hpp" 
     27#include "coupler_out.hpp" 
    2628 
    2729namespace xios { 
     
    353355   { 
    354356      intraComm_=intraComm ; 
     357      MPI_Comm_rank(intraComm_, &intraCommRank_) ; 
     358      MPI_Comm_size(intraComm_, &intraCommSize_) ; 
     359 
    355360      serviceType_ = CServicesManager::CLIENT ; 
    356361      if (serviceType_==CServicesManager::CLIENT) 
     
    385390     hasServer=true; 
    386391     intraComm_=intraComm ; 
     392     MPI_Comm_rank(intraComm_, &intraCommRank_) ; 
     393     MPI_Comm_size(intraComm_, &intraCommSize_) ; 
     394 
    387395     serviceType_=serviceType ; 
    388396 
     
    544552    } 
    545553 
     554    for (auto it=couplerClient_.begin(); it!=couplerClient_.end(); ++it) 
     555    { 
     556      if (!finalized) it->second->checkBuffers(); 
     557    } 
     558 
     559    for (auto it=couplerServer_.begin(); it!=couplerServer_.end(); ++it) 
     560    { 
     561      if (!finalized) it->second->eventLoop(enableEventsProcessing); 
     562    } 
     563 
    546564    if (server!=nullptr) if (!finalized) finished &= server->eventLoop(enableEventsProcessing); 
    547565   
     
    549567  } 
    550568 
    551   
     569  void CContext::addCouplingChanel(const std::string& context, bool out) 
     570  { 
     571     vector<string> vectStr=splitRegex(context,"::") ; 
     572     string poolId=vectStr[0] ; 
     573     string serviceId=poolId ; 
     574     string contextId=vectStr[1] ; 
     575 
     576     int contextLeader ; 
     577     int type = CServicesManager::CLIENT ; 
     578     string contextName=CXios::getContextsManager()->getServerContextName(poolId, serviceId, 0, type, contextId) ; 
     579      
     580     if (couplerClient_.find(contextName)==couplerClient_.end()) 
     581     { 
     582       bool ok=CXios::getContextsManager()->getContextLeader(contextName, contextLeader, getIntraComm()) ; 
     583      
     584       MPI_Comm interComm, interCommClient, interCommServer  ; 
     585       MPI_Comm intraCommClient, intraCommServer ; 
     586 
     587       if (ok) MPI_Intercomm_create(getIntraComm(), 0, CXios::getXiosComm(), contextLeader, 0, &interComm) ; 
     588 
     589       MPI_Comm_dup(intraComm_, &intraCommClient) ; 
     590       MPI_Comm_dup(intraComm_, &intraCommServer) ; 
     591       if (out) 
     592       { 
     593         MPI_Comm_dup(interComm, &interCommClient) ; 
     594         MPI_Comm_dup(interComm, &interCommServer) ; 
     595         CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); 
     596         CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); 
     597       } 
     598       else 
     599       { 
     600          MPI_Comm_dup(interComm, &interCommServer) ; 
     601          MPI_Comm_dup(interComm, &interCommClient) ; 
     602          CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); 
     603          CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); 
     604       } 
     605       MPI_Comm_free(&interComm) ; 
     606 
     607 
     608      // for now, we don't now which beffer size must be used for client coupler 
     609      // It will be evaluated later. Fix a constant size for now... 
     610      // set to 10Mb for development 
     611       map<int,size_t> bufferSize, maxEventSize ; 
     612       for(int i=0;i<client->getRemoteSize();i++) 
     613       { 
     614         bufferSize[i]=10000000 ; 
     615         maxEventSize[i]=10000000 ; 
     616       } 
     617 
     618       client->setBufferSize(bufferSize, maxEventSize);     
     619        
     620       couplerClient_[contextName] = client ; 
     621       couplerServer_[contextName] = server ; 
     622     } 
     623  } 
    552624   
    553625  void CContext::globalEventLoop(void) 
     
    649721     postProcessing(); 
    650722 
     723     // Distribute files between secondary servers according to the data size 
     724     distributeFiles(); 
     725 
    651726     // Check grid and calculate its distribution 
    652727     checkGridEnabledFields(); 
    653   
    654      // Distribute files between secondary servers according to the data size 
    655      distributeFiles(); 
    656728 
    657729     setClientServerBuffer(client, (hasClient && !hasServer)); 
     
    659731         setClientServerBuffer(clientPrimServer[i], true); 
    660732 
     733     
    661734     if (hasClient) 
    662      { 
    663       // Send all attributes of current context to server 
    664       this->sendAllAttributesToServer(); 
    665  
    666       // Send all attributes of current calendar 
    667       CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer(); 
     735     {  
     736       if (hasServer) 
     737       {  
     738         for (auto it=clientPrimServer.begin(); it!=clientPrimServer.end();++it)  
     739         { 
     740           this->sendAllAttributesToServer(*it); // Send all attributes of current context to server 
     741           CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer(*it); // Send all attributes of current calendar 
     742         } 
     743       } 
     744       else 
     745       { 
     746         this->sendAllAttributesToServer(client);   // Send all attributes of current context to server 
     747         CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer(client); // Send all attributes of current calendar 
     748       } 
     749 
    668750 
    669751      // We have enough information to send to server 
     
    779861    { 
    780862      buildFilterGraphOfFieldsWithReadAccess(); 
    781       postProcessFilterGraph(); 
     863      postProcessFilterGraph(); // For coupling in, modify this later 
    782864    } 
    783865     
     
    849931       enabledFiles[i]->checkGridOfEnabledFields();        
    850932     } 
     933 
     934     size = enabledCouplerOut.size(); 
     935     for (int i = 0; i < size; ++i) 
     936     { 
     937       enabledCouplerOut[i]->checkGridOfEnabledFields();        
     938     } 
    851939   } 
    852940   CATCH_DUMP_ATTR 
     
    872960      \param [in] sendToServer Flag to indicate whether calculated information will be sent 
    873961   */ 
    874    void CContext::solveOnlyRefOfEnabledFields(bool sendToServer) 
     962   void CContext::solveOnlyRefOfEnabledFields(void) 
    875963   TRY 
    876964   { 
     
    878966     for (int i = 0; i < size; ++i) 
    879967     { 
    880        this->enabledFiles[i]->solveOnlyRefOfEnabledFields(sendToServer); 
     968       this->enabledFiles[i]->solveOnlyRefOfEnabledFields(); 
    881969     } 
    882970 
     
    884972     { 
    885973       this->enabledFiles[i]->generateNewTransformationGridDest(); 
     974     } 
     975 
     976     size = this->enabledCouplerOut.size(); 
     977     for (int i = 0; i < size; ++i) 
     978     { 
     979       this->enabledCouplerOut[i]->solveOnlyRefOfEnabledFields(); 
     980     } 
     981 
     982     for (int i = 0; i < size; ++i) 
     983     { 
     984       this->enabledCouplerOut[i]->generateNewTransformationGridDest(); 
    886985     } 
    887986   } 
     
    894993      \param [in] sendToServer Flag to indicate whether calculated information will be sent 
    895994   */ 
    896    void CContext::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) 
     995   void CContext::solveAllRefOfEnabledFieldsAndTransform(void) 
    897996   TRY 
    898997   { 
     
    900999     for (int i = 0; i < size; ++i) 
    9011000     { 
    902        this->enabledFiles[i]->solveAllRefOfEnabledFieldsAndTransform(sendToServer); 
    903      } 
     1001       this->enabledFiles[i]->solveAllRefOfEnabledFieldsAndTransform(); 
     1002     } 
     1003 
     1004     size = this->enabledCouplerOut.size(); 
     1005     for (int i = 0; i < size; ++i) 
     1006     { 
     1007       this->enabledCouplerOut[i]->solveAllRefOfEnabledFieldsAndTransform(); 
     1008     } 
     1009 
    9041010   } 
    9051011   CATCH_DUMP_ATTR 
     
    9121018     { 
    9131019       this->enabledFiles[i]->buildFilterGraphOfEnabledFields(garbageCollector); 
     1020     } 
     1021 
     1022     size = this->enabledCouplerOut.size(); 
     1023     for (int i = 0; i < size; ++i) 
     1024     { 
     1025       this->enabledCouplerOut[i]->buildFilterGraphOfEnabledFields(garbageCollector); 
    9141026     } 
    9151027   } 
     
    10021114     // Résolution des héritages par référence au niveau des fichiers. 
    10031115      const vector<CFile*> allFiles=CFile::getAll(); 
     1116      const vector<CCouplerIn*> allCouplerIn=CCouplerIn::getAll(); 
     1117      const vector<CCouplerOut*> allCouplerOut=CCouplerOut::getAll(); 
    10041118      const vector<CGrid*> allGrids= CGrid::getAll(); 
    10051119 
     
    10091123        for (unsigned int i = 0; i < allFiles.size(); i++) 
    10101124          allFiles[i]->solveFieldRefInheritance(apply); 
     1125 
     1126        for (unsigned int i = 0; i < allCouplerIn.size(); i++) 
     1127          allCouplerIn[i]->solveFieldRefInheritance(apply); 
     1128 
     1129        for (unsigned int i = 0; i < allCouplerOut.size(); i++) 
     1130          allCouplerOut[i]->solveFieldRefInheritance(apply); 
    10111131      } 
    10121132 
     
    10711191   CATCH_DUMP_ATTR 
    10721192 
     1193   void CContext::findEnabledCouplerIn(void) 
     1194   TRY 
     1195   { 
     1196      const std::vector<CCouplerIn*> allCouplerIn = CCouplerIn::getAll(); 
     1197      bool enabled ; 
     1198      for (size_t i = 0; i < allCouplerIn.size(); i++) 
     1199      { 
     1200        if (allCouplerIn[i]->enabled.isEmpty()) enabled=true ; 
     1201        else enabled=allCouplerIn[i]->enabled ; 
     1202        if (enabled) enabledCouplerIn.push_back(allCouplerIn[i]) ; 
     1203      } 
     1204   } 
     1205   CATCH_DUMP_ATTR 
     1206 
     1207   void CContext::findEnabledCouplerOut(void) 
     1208   TRY 
     1209   { 
     1210      const std::vector<CCouplerOut*> allCouplerOut = CCouplerOut::getAll(); 
     1211      bool enabled ; 
     1212      for (size_t i = 0; i < allCouplerOut.size(); i++) 
     1213      { 
     1214        if (allCouplerOut[i]->enabled.isEmpty()) enabled=true ; 
     1215        else enabled=allCouplerOut[i]->enabled ; 
     1216        if (enabled) enabledCouplerOut.push_back(allCouplerOut[i]) ; 
     1217      } 
     1218   } 
     1219   CATCH_DUMP_ATTR 
     1220 
     1221 
     1222 
     1223 
    10731224   void CContext::distributeFiles(void) 
    10741225   TRY 
     
    16691820      findEnabledWriteModeFiles(); 
    16701821      findEnabledReadModeFiles(); 
     1822      findEnabledCouplerIn(); 
     1823      findEnabledCouplerOut(); 
     1824       
     1825      createCouplerInterCommunicator() ; 
    16711826 
    16721827      // For now, only read files with client and only one level server 
     
    16891844 
    16901845      // Only search and rebuild all reference objects of enable fields, don't transform 
    1691       this->solveOnlyRefOfEnabledFields(false); 
     1846      this->solveOnlyRefOfEnabledFields(); 
    16921847 
    16931848      // Search and rebuild all reference object of enabled fields, and transform 
    1694       this->solveAllRefOfEnabledFieldsAndTransform(false); 
     1849      this->solveAllRefOfEnabledFieldsAndTransform(); 
    16951850 
    16961851      // Find all fields with read access from the public API 
     
    17001855 
    17011856      isPostProcessed = true; 
     1857   } 
     1858   CATCH_DUMP_ATTR 
     1859 
     1860   void CContext::createCouplerInterCommunicator(void) 
     1861   TRY 
     1862   { 
     1863      // juste for test now, in future need an scheduler to avoid dead-lock 
     1864      for(auto it=enabledCouplerOut.begin();it!=enabledCouplerOut.end();++it) 
     1865      { 
     1866        (*it)->createInterCommunicator() ; 
     1867      } 
     1868 
     1869      for(auto it=enabledCouplerIn.begin();it!=enabledCouplerIn.end();++it) 
     1870      { 
     1871        (*it)->createInterCommunicator() ; 
     1872      } 
    17021873   } 
    17031874   CATCH_DUMP_ATTR 
     
    19532124   TRY 
    19542125   { 
    1955      std::set<StdString> gridIds; 
     2126     std::set<pair<StdString,CContextClient*>> gridIds; 
     2127 
    19562128     int sizeFile = activeFiles.size(); 
    19572129     CFile* filePtr(NULL); 
     
    19662138       { 
    19672139         if (0 != enabledFields[numField]->getRelGrid()) 
    1968            gridIds.insert(CGrid::get(enabledFields[numField]->getRelGrid())->getId()); 
     2140           gridIds.insert(make_pair(CGrid::get(enabledFields[numField]->getRelGrid())->getId(),enabledFields[numField]->getContextClient())); 
    19692141       } 
    19702142     } 
     
    19732145     StdString gridDefRoot("grid_definition"); 
    19742146     CGridGroup* gridPtr = CGridGroup::get(gridDefRoot); 
    1975      std::set<StdString>::const_iterator it, itE = gridIds.end(); 
    1976      for (it = gridIds.begin(); it != itE; ++it) 
    1977      { 
    1978        gridPtr->sendCreateChild(*it); 
    1979        CGrid::get(*it)->sendAllAttributesToServer(); 
    1980        CGrid::get(*it)->sendAllDomains(); 
    1981        CGrid::get(*it)->sendAllAxis(); 
    1982        CGrid::get(*it)->sendAllScalars(); 
     2147     for (auto it = gridIds.begin(); it != gridIds.end(); ++it) 
     2148     { 
     2149       gridPtr->sendCreateChild(it->first,it->second); 
     2150       CGrid::get(it->first)->sendAllAttributesToServer(it->second); 
     2151       CGrid::get(it->first)->sendAllDomains(it->second); 
     2152       CGrid::get(it->first)->sendAllAxis(it->second); 
     2153       CGrid::get(it->first)->sendAllScalars(it->second); 
    19832154     } 
    19842155   } 
     
    19892160   TRY 
    19902161   { 
    1991      std::set<StdString> domainIds, axisIds, scalarIds; 
     2162     std::set<pair<StdString,CContextClient*>> domainIds, axisIds, scalarIds; 
    19922163 
    19932164     // Find all reference domain and axis of all active fields 
     
    19992170       for (int j = 0; j < numEnabledFields; ++j) 
    20002171       { 
     2172         CContextClient* contextClient=enabledFields[j]->getContextClient() ; 
    20012173         const std::vector<StdString>& prDomAxisScalarId = enabledFields[j]->getRefDomainAxisIds(); 
    2002          if ("" != prDomAxisScalarId[0]) domainIds.insert(prDomAxisScalarId[0]); 
    2003          if ("" != prDomAxisScalarId[1]) axisIds.insert(prDomAxisScalarId[1]); 
    2004          if ("" != prDomAxisScalarId[2]) scalarIds.insert(prDomAxisScalarId[2]); 
     2174         if ("" != prDomAxisScalarId[0]) domainIds.insert(make_pair(prDomAxisScalarId[0],contextClient)); 
     2175         if ("" != prDomAxisScalarId[1]) axisIds.insert(make_pair(prDomAxisScalarId[1],contextClient)); 
     2176         if ("" != prDomAxisScalarId[2]) scalarIds.insert(make_pair(prDomAxisScalarId[2],contextClient)); 
    20052177       } 
    20062178     } 
     
    20122184     StdString scalarDefRoot("scalar_definition"); 
    20132185     CScalarGroup* scalarPtr = CScalarGroup::get(scalarDefRoot); 
    2014      itE = scalarIds.end(); 
    2015      for (itScalar = scalarIds.begin(); itScalar != itE; ++itScalar) 
    2016      { 
    2017        if (!itScalar->empty()) 
     2186      
     2187     for (auto itScalar = scalarIds.begin(); itScalar != scalarIds.end(); ++itScalar) 
     2188     { 
     2189       if (!itScalar->first.empty()) 
    20182190       { 
    2019          scalarPtr->sendCreateChild(*itScalar); 
    2020          CScalar::get(*itScalar)->sendAllAttributesToServer(); 
     2191         scalarPtr->sendCreateChild(itScalar->first,itScalar->second); 
     2192         CScalar::get(itScalar->first)->sendAllAttributesToServer(itScalar->second); 
    20212193       } 
    20222194     } 
     
    20242196     StdString axiDefRoot("axis_definition"); 
    20252197     CAxisGroup* axisPtr = CAxisGroup::get(axiDefRoot); 
    2026      itE = axisIds.end(); 
    2027      for (itAxis = axisIds.begin(); itAxis != itE; ++itAxis) 
    2028      { 
    2029        if (!itAxis->empty()) 
     2198      
     2199     for (auto itAxis = axisIds.begin(); itAxis != axisIds.end(); ++itAxis) 
     2200     { 
     2201       if (!itAxis->first.empty()) 
    20302202       { 
    2031          axisPtr->sendCreateChild(*itAxis); 
    2032          CAxis::get(*itAxis)->sendAllAttributesToServer(); 
     2203         axisPtr->sendCreateChild(itAxis->first, itAxis->second); 
     2204         CAxis::get(itAxis->first)->sendAllAttributesToServer(itAxis->second); 
    20332205       } 
    20342206     } 
     
    20372209     StdString domDefRoot("domain_definition"); 
    20382210     CDomainGroup* domPtr = CDomainGroup::get(domDefRoot); 
    2039      itE = domainIds.end(); 
    2040      for (itDom = domainIds.begin(); itDom != itE; ++itDom) 
    2041      { 
    2042        if (!itDom->empty()) { 
    2043           domPtr->sendCreateChild(*itDom); 
    2044           CDomain::get(*itDom)->sendAllAttributesToServer(); 
     2211      
     2212     for (auto itDom = domainIds.begin(); itDom != domainIds.end(); ++itDom) 
     2213     { 
     2214       if (!itDom->first.empty()) { 
     2215          domPtr->sendCreateChild(itDom->first, itDom->second); 
     2216          CDomain::get(itDom->first)->sendAllAttributesToServer(itDom->second); 
    20452217       } 
    20462218     } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp

    r1766 r1784  
    2626   class CContext; 
    2727   class CFile; 
     28   class CCouplerIn ; 
     29   class CCouplerOut ; 
    2830   ///-------------------------------------------------------------- 
    2931 
     
    120122         void solveAllInheritance(bool apply=true); 
    121123         void findEnabledFiles(void); 
     124         void findEnabledCouplerIn(void); 
     125         void findEnabledCouplerOut(void); 
     126         void createCouplerInterCommunicator(void) ; 
    122127         void findEnabledWriteModeFiles(void); 
    123128         void findEnabledReadModeFiles(void); 
     
    128133         void checkAxisDomainsGridsEligibilityForCompressedOutput(); 
    129134         void prepareTimeseries(void); 
    130          void solveOnlyRefOfEnabledFields(bool sendToServer);          
     135         void solveOnlyRefOfEnabledFields(void);          
    131136         void buildFilterGraphOfEnabledFields(); 
    132137         void postProcessFilterGraph(); 
     
    140145         void postProcessingGlobalAttributes();          
    141146 
    142          void solveAllRefOfEnabledFieldsAndTransform(bool sendToServer); 
     147         void solveAllRefOfEnabledFieldsAndTransform(void); 
    143148         void checkGridEnabledFields(); 
    144149         void checkGridEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles); 
     
    243248         bool setProcessingEvent(void) {isProcessingEvent_=true ;} 
    244249         bool unsetProcessingEvent(void) {isProcessingEvent_=false ;} 
     250         MPI_Comm getIntraComm(void) { return intraComm_ ;} 
     251 
     252         void addCouplingChanel(const std::string& contextId, bool out) ; 
    245253 
    246254      public : 
     
    255263         std::vector<CFile*> enabledWriteModeFiles; 
    256264 
     265         std::vector<CCouplerIn*> enabledCouplerIn; 
     266         std::vector<CCouplerOut*> enabledCouplerOut; 
     267 
     268 
    257269         // List of all enabled fields whose instant data is accessible from the public API 
    258270         // but which are not part of a file 
     
    272284         std::vector<CContextServer*> serverPrimServer; 
    273285         std::vector<CContextClient*> clientPrimServer; 
     286         std::map<std::string, CContextClient*> couplerClient_ ; 
     287         std::map<std::string, CContextServer*> couplerServer_ ; 
     288 
     289 
    274290         std::vector<std::string> primServerId_; 
    275291 
     
    279295 
    280296        MPI_Comm intraComm_ ; //! context intra communicator 
    281  
     297        int intraCommRank_ ; //! context intra communicator rank 
     298        int intraCommSize_ ; //! context intra communicator size 
     299         
    282300      private: 
    283301         bool isPostProcessed; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/coupler_in.cpp

    r1782 r1784  
    5151   CATCH_DUMP_ATTR 
    5252 
    53     
     53   void CCouplerIn::createInterCommunicator(void) 
     54   TRY 
     55   { 
     56     if (context.isEmpty()) 
     57     { 
     58        ERROR("void CCouplerOut::createInterCommunicator(void)", 
     59               "The attribute <context> must be defined to specify the target coupling context"); 
     60     } 
     61     CContext* contextPtr = CContext::getCurrent(); 
     62     contextPtr->addCouplingChanel(context, false) ; 
     63   } 
     64   CATCH_DUMP_ATTR 
     65 
     66   
    5467   /*! 
    5568   \brief Parse xml file and write information into coupler_in object 
     
    8699   CATCH 
    87100 
     101   void CCouplerIn::solveDescInheritance(bool apply, const CAttributeMap * const parent) 
     102   TRY 
     103   { 
     104      SuperClassAttribute::setAttributes(parent,apply); 
     105      this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL); 
     106   } 
     107   CATCH_DUMP_ATTR 
    88108 
     109   void CCouplerIn::solveFieldRefInheritance(bool apply) 
     110   TRY 
     111   { 
     112      // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. 
     113      std::vector<CField*> allF = this->getAllFields(); 
     114      for (unsigned int i = 0; i < allF.size(); i++) 
     115         allF[i]->solveRefInheritance(apply); 
     116   } 
     117   CATCH_DUMP_ATTR 
    89118   /*! 
    90119   \brief Get virtual variable group 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/coupler_in.hpp

    r1782 r1784  
    1111#include "context_client.hpp" 
    1212#include "mpi.hpp" 
     13#include "string_tools.hpp" 
    1314 
    1415namespace xios 
     
    9293 
    9394      public: 
     95         virtual void solveDescInheritance(bool apply, const CAttributeMap* const parent = 0); 
     96         void solveFieldRefInheritance(bool apply); 
     97         void createInterCommunicator(void) ; 
    9498 
    9599      private : 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/coupler_out.cpp

    r1782 r1784  
    66#include "context.hpp" 
    77#include "xios_spl.hpp" 
     8#include "string_tools.hpp" 
     9#include "contexts_manager.hpp" 
     10#include "services_manager.hpp" 
     11 
    812 
    913namespace xios 
     
    102106   CATCH 
    103107 
    104  
     108   void CCouplerOut::solveDescInheritance(bool apply, const CAttributeMap * const parent) 
     109   TRY 
     110   { 
     111      SuperClassAttribute::setAttributes(parent,apply); 
     112      this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL); 
     113   } 
     114   CATCH_DUMP_ATTR 
     115 
     116   void CCouplerOut::solveFieldRefInheritance(bool apply) 
     117   TRY 
     118   { 
     119      // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. 
     120      std::vector<CField*> allF = this->getAllFields(); 
     121      for (unsigned int i = 0; i < allF.size(); i++) 
     122         allF[i]->solveRefInheritance(apply); 
     123   } 
     124   CATCH_DUMP_ATTR 
     125 
     126   void CCouplerOut::createInterCommunicator(void) 
     127   TRY 
     128   { 
     129     if (context.isEmpty()) 
     130     { 
     131        ERROR("void CCouplerOut::createInterCommunicator(void)", 
     132               "The attribute <context> must be defined to specify the target coupling context"); 
     133     } 
     134     CContext* contextPtr = CContext::getCurrent(); 
     135     contextPtr->addCouplingChanel(context, true) ; 
     136   } 
     137   CATCH_DUMP_ATTR 
     138 
     139   
     140   void CCouplerOut::solveOnlyRefOfEnabledFields(void) 
     141   TRY 
     142   { 
     143     int size = this->enabledFields.size(); 
     144     for (int i = 0; i < size; ++i) 
     145     { 
     146       this->enabledFields[i]->solveOnlyReferenceEnabledField(); 
     147     } 
     148   } 
     149   CATCH_DUMP_ATTR 
     150 
     151   void CCouplerOut::generateNewTransformationGridDest(void) 
     152   TRY 
     153   { 
     154     int size = this->enabledFields.size(); 
     155     for (int i = 0; i < size; ++i) 
     156     { 
     157       this->enabledFields[i]->generateNewTransformationGridDest(); 
     158     } 
     159   } 
     160   CATCH_DUMP_ATTR 
     161 
     162   void CCouplerOut::solveAllRefOfEnabledFieldsAndTransform(void) 
     163   TRY 
     164   { 
     165     int size = this->enabledFields.size(); 
     166     for (int i = 0; i < size; ++i) 
     167     {        
     168      this->enabledFields[i]->solveAllEnabledFieldsAndTransform(); 
     169     } 
     170   } 
     171   CATCH_DUMP_ATTR 
     172 
     173   /*! 
     174    * Constructs the filter graph for each active field. 
     175    * 
     176    * \param gc the garbage collector to use when building the filter graph 
     177    */ 
     178   void CCouplerOut::buildFilterGraphOfEnabledFields(CGarbageCollector& gc) 
     179   TRY 
     180   { 
     181     int size = this->enabledFields.size(); 
     182     for (int i = 0; i < size; ++i) 
     183     { 
     184       this->enabledFields[i]->buildFilterGraph(gc, true); 
     185     } 
     186   } 
     187   CATCH_DUMP_ATTR 
     188 
     189   void CCouplerOut::checkGridOfEnabledFields(void) 
     190   TRY 
     191   {  
     192     int size = this->enabledFields.size(); 
     193     for (int i = 0; i < size; ++i) 
     194     { 
     195       this->enabledFields[i]->checkGridOfEnabledFields(); 
     196     } 
     197   } 
     198   CATCH_DUMP_ATTR 
    105199 
    106200   //---------------------------------------------------------------- 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/coupler_out.hpp

    r1782 r1784  
    8888 
    8989      public: 
     90        virtual void solveDescInheritance(bool apply, const CAttributeMap* const parent = 0); 
     91        void solveFieldRefInheritance(bool apply); 
     92        void createInterCommunicator(void) ; 
     93        void solveOnlyRefOfEnabledFields(void); 
     94        void generateNewTransformationGridDest(void); 
     95        void solveAllRefOfEnabledFieldsAndTransform() ; 
     96        void buildFilterGraphOfEnabledFields(CGarbageCollector& gc); 
     97        void checkGridOfEnabledFields(void) ; 
    9098 
    9199      private : 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp

    r1761 r1784  
    302302     // For now the assumption is that secondary server pools consist of the same number of procs. 
    303303     // CHANGE the line below if the assumption changes. 
    304      CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client; 
    305      int rankClient = client->clientRank; 
     304 
     305     int rankClient = context->intraCommRank_; 
    306306     int rankOnDomain = rankClient%nbLocalDomain; 
    307307 
     
    680680    // For now the assumption is that secondary server pools consist of the same number of procs. 
    681681    // CHANGE the line below if the assumption changes. 
    682     CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client; 
     682     int clientSize = context->intraCommSize_ ; 
    683683     lon_g.resize(ni_glo) ; 
    684684     lat_g.resize(nj_glo) ; 
    685685 
    686686 
    687      int* ibegin_g = new int[client->clientSize] ; 
    688      int* jbegin_g = new int[client->clientSize] ; 
    689      int* ni_g = new int[client->clientSize] ; 
    690      int* nj_g = new int[client->clientSize] ; 
     687     int* ibegin_g = new int[clientSize] ; 
     688     int* jbegin_g = new int[clientSize] ; 
     689     int* ni_g = new int[clientSize] ; 
     690     int* nj_g = new int[clientSize] ; 
    691691     int v ; 
    692692     v=ibegin ; 
    693      MPI_Allgather(&v,1,MPI_INT,ibegin_g,1,MPI_INT,client->intraComm) ; 
     693     MPI_Allgather(&v,1,MPI_INT,ibegin_g,1,MPI_INT,context->intraComm_) ; 
    694694     v=jbegin ; 
    695      MPI_Allgather(&v,1,MPI_INT,jbegin_g,1,MPI_INT,client->intraComm) ; 
     695     MPI_Allgather(&v,1,MPI_INT,jbegin_g,1,MPI_INT,context->intraComm_) ; 
    696696     v=ni ; 
    697      MPI_Allgather(&v,1,MPI_INT,ni_g,1,MPI_INT,client->intraComm) ; 
     697     MPI_Allgather(&v,1,MPI_INT,ni_g,1,MPI_INT,context->intraComm_) ; 
    698698     v=nj ; 
    699      MPI_Allgather(&v,1,MPI_INT,nj_g,1,MPI_INT,client->intraComm) ; 
    700  
    701      MPI_Allgatherv(lon.dataFirst(),ni,MPI_DOUBLE,lon_g.dataFirst(),ni_g, ibegin_g,MPI_DOUBLE,client->intraComm) ; 
    702      MPI_Allgatherv(lat.dataFirst(),nj,MPI_DOUBLE,lat_g.dataFirst(),nj_g, jbegin_g,MPI_DOUBLE,client->intraComm) ; 
     699     MPI_Allgather(&v,1,MPI_INT,nj_g,1,MPI_INT,context->intraComm_) ; 
     700 
     701     MPI_Allgatherv(lon.dataFirst(),ni,MPI_DOUBLE,lon_g.dataFirst(),ni_g, ibegin_g,MPI_DOUBLE,context->intraComm_) ; 
     702     MPI_Allgatherv(lat.dataFirst(),nj,MPI_DOUBLE,lat_g.dataFirst(),nj_g, jbegin_g,MPI_DOUBLE,context->intraComm_) ; 
    703703 
    704704      delete[] ibegin_g ; 
     
    18311831  { 
    18321832    CContext* context=CContext::getCurrent() ; 
    1833      
    1834     // This line should be changed soon. 
    1835     int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 
    1836  
    1837     nbSenders.clear(); 
    1838     connectedServerRank_.clear(); 
    1839  
    1840     for (int p = 0; p < nbSrvPools; ++p) 
     1833    set<int> listNbServer ; 
     1834 
     1835    for (auto client : clients) 
    18411836    { 
    1842       CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[p] : context->client; 
     1837 
    18431838      int nbServer = client->serverSize; 
    18441839      int nbClient = client->clientSize; 
    18451840      int rank     = client->clientRank; 
    18461841      bool doComputeGlobalIndexServer = true; 
    1847  
    1848       if (connectedServerRank_.find(nbServer) == connectedServerRank_.end()) 
    1849       { 
     1842    
     1843      if (listNbServer.find(nbServer)==listNbServer.end()) 
     1844      { 
     1845        listNbServer.insert(nbServer) ; 
     1846  
     1847        if (connectedServerRank_.find(nbServer) != connectedServerRank_.end()) 
     1848        { 
     1849          nbSenders.erase(nbServer); 
     1850          connectedServerRank_.erase(nbServer); 
     1851        } 
    18501852 
    18511853        if (indSrv_.find(nbServer) == indSrv_.end()) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp

    r1764 r1784  
    976976   CATCH_DUMP_ATTR 
    977977 
    978    void CField::solveOnlyReferenceEnabledField(bool doSending2Server) 
     978   void CField::solveOnlyReferenceEnabledField(void) 
    979979   TRY 
    980980   { 
     
    987987        { 
    988988          solveRefInheritance(true); 
    989           if (hasDirectFieldReference()) getDirectFieldReference()->solveOnlyReferenceEnabledField(false); 
     989          if (hasDirectFieldReference()) getDirectFieldReference()->solveOnlyReferenceEnabledField(); 
    990990        } 
    991991 
     
    10091009   { 
    10101010     CContext* context = CContext::getCurrent(); 
    1011      solveOnlyReferenceEnabledField(doSending2Server); 
     1011     solveOnlyReferenceEnabledField(); 
    10121012 
    10131013     if (!areAllReferenceSolved) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp

    r1637 r1784  
    122122         void solveCheckMaskIndex(bool doSendingIndex); 
    123123         void solveAllReferenceEnabledField(bool doSending2Server); 
    124          void solveOnlyReferenceEnabledField(bool doSending2Server); 
     124         void solveOnlyReferenceEnabledField(void); 
    125125         void generateNewTransformationGridDest(); 
    126126         void updateRef(CGrid* grid); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/file.cpp

    r1761 r1784  
    834834   \param [in] sendToServer: Send all info to server (true) or only a part of it (false) 
    835835   */ 
    836    void CFile::solveOnlyRefOfEnabledFields(bool sendToServer) 
     836   void CFile::solveOnlyRefOfEnabledFields(void) 
    837837   TRY 
    838838   { 
     
    840840     for (int i = 0; i < size; ++i) 
    841841     { 
    842        this->enabledFields[i]->solveOnlyReferenceEnabledField(sendToServer); 
     842       this->enabledFields[i]->solveOnlyReferenceEnabledField(); 
    843843     } 
    844844   } 
     
    953953   \param [in] sendToServer: Send all info to server (true) or only a part of it (false) 
    954954   */ 
    955    void CFile::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) 
     955   void CFile::solveAllRefOfEnabledFieldsAndTransform(void) 
    956956   TRY 
    957957   { 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/file.hpp

    r1639 r1784  
    108108         void solveFieldRefInheritance(bool apply); 
    109109         void processEnabledFile(void); 
    110          void solveOnlyRefOfEnabledFields(bool sendToServer); 
     110         void solveOnlyRefOfEnabledFields(void); 
    111111         void generateNewTransformationGridDest(); 
    112112          
     
    117117         void doPostTimestepOperationsForEnabledReadModeFields(); 
    118118 
    119          void solveAllRefOfEnabledFieldsAndTransform(bool sendToServer); 
     119         void solveAllRefOfEnabledFieldsAndTransform(void); 
    120120         void checkGridOfEnabledFields(); 
    121121         void sendGridOfEnabledFields(); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r1761 r1784  
    331331   { 
    332332     CContext* context = CContext::getCurrent(); 
    333      int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1;    
    334      nbSrvPools = 1;   
    335      for (int p = 0; p < nbSrvPools; ++p) 
    336      {     
    337        if (context->hasClient && this->isChecked && doSendingIndex && !isIndexSent)  
    338        {  
    339          if (isScalarGrid()) 
    340            sendIndexScalarGrid(); 
    341          else 
    342            sendIndex(); 
    343          this->isIndexSent = true;  
    344        } 
    345  
    346        // Not sure about this 
    347        //if (!(this->hasTransform() && !this->isTransformed())) 
    348        // this->isChecked = true; 
    349        //return; 
     333     if (context->hasClient && this->isChecked && doSendingIndex && !isIndexSent)  
     334     {  
     335       if (isScalarGrid())  sendIndexScalarGrid(); 
     336       else  sendIndex(); 
     337       this->isIndexSent = true;  
    350338     } 
    351      
     339 
    352340     if (this->isChecked) return; 
    353341     this->checkAttributesAfterTransformation(); 
     
    364352   } 
    365353   CATCH_DUMP_ATTR 
     354 
     355 
    366356   bool CGrid::hasMask() const 
    367357   TRY 
     
    763753   { 
    764754     CContext* context = CContext::getCurrent(); 
    765      int nbSrvPools = (context->clientPrimServer.size() == 0) ? 1 : context->clientPrimServer.size(); 
    766      connectedServerRank_.clear(); 
    767      connectedDataSize_.clear(); 
    768      globalIndexOnServer_.clear(); 
    769      nbSenders.clear(); 
    770  
    771      for (int p = 0; p < nbSrvPools; ++p) 
     755      
     756     set<int> listReceiverSize ; 
     757     for (auto it=clients.begin(); it!=clients.end(); ++it) 
    772758     { 
    773        CContextClient* client = (context->clientPrimServer.size() == 0) ? context->client : context->clientPrimServer[p]; 
     759        
     760       CContextClient* client = *it ; 
     761 
    774762       int receiverSize = client->serverSize; 
    775 //       connectedServerRank_[client].clear(); 
    776  
    777        if (connectedServerRank_.find(receiverSize) == connectedServerRank_.end()) 
     763       
     764       if (listReceiverSize.find(receiverSize)==listReceiverSize.end()) 
    778765       { 
    779         if (!doGridHaveDataDistributed(client)) 
     766         listReceiverSize.insert(receiverSize) ; 
     767         if (connectedServerRank_.find(receiverSize) != connectedServerRank_.end()) 
     768         { 
     769            // delete corresponding map in case of recompute, probably because a grid could has been modifiedd  
     770            // by a transformation 
     771            connectedServerRank_.erase(receiverSize); 
     772            connectedDataSize_.erase(receiverSize); 
     773            globalIndexOnServer_.erase(receiverSize); 
     774            nbSenders.erase(receiverSize); 
     775         } 
     776 
     777         if (!doGridHaveDataDistributed(client)) 
    780778         { 
    781779            if (client->isServerLeader()) 
     
    13071305   CATCH 
    13081306 
    1309 /* 
    1310    void CGrid::outputField(int rank, const CArray<double, 1>& stored, double* field) 
    1311    { 
    1312      const CArray<size_t,1>& out_i = outIndexFromClient[rank]; 
    1313      StdSize numElements = stored.numElements(); 
    1314      for (StdSize n = 0; n < numElements; ++n) 
    1315      { 
    1316        field[out_i(n)] = stored(n); 
    1317      } 
    1318    } 
    1319  
    1320    void CGrid::inputField(int rank, const double* const field, CArray<double,1>& stored) 
    1321    { 
    1322      const CArray<size_t,1>& out_i = outIndexFromClient[rank]; 
    1323      StdSize numElements = stored.numElements(); 
    1324      for (StdSize n = 0; n < numElements; ++n) 
    1325      { 
    1326        stored(n) = field[out_i(n)]; 
    1327      } 
    1328    } 
    1329  
    1330    void CGrid::outputCompressedField(int rank, const CArray<double,1>& stored, double* field) 
    1331    { 
    1332      const CArray<size_t,1>& out_i = compressedOutIndexFromClient[rank]; 
    1333      StdSize numElements = stored.numElements(); 
    1334      for (StdSize n = 0; n < numElements; ++n) 
    1335      { 
    1336        field[out_i(n)] = stored(n); 
    1337      } 
    1338    } 
    1339 */ 
    13401307   //---------------------------------------------------------------- 
    13411308 
     
    14201387  TRY 
    14211388  { 
    1422     CContext* context = CContext::getCurrent();     
    1423     int nbSrvPools = (context->clientPrimServer.size()==0) ? 1 : context->clientPrimServer.size(); 
    1424     connectedServerRank_.clear(); 
    1425     connectedDataSize_.clear(); 
    1426     nbSenders.clear(); 
    1427  
    1428     for (int p = 0; p < nbSrvPools; ++p) 
    1429     { 
    1430       CContextClient* client = (context->clientPrimServer.size()==0) ? context->client : context->clientPrimServer[p]; 
     1389 
     1390    CContext* context = CContext::getCurrent(); 
     1391      
     1392    set<int> listReceiverSize ; 
     1393    for (auto it=clients.begin(); it!=clients.end(); ++it) 
     1394    { 
     1395        
     1396      CContextClient* client = *it ; 
     1397 
    14311398      int receiverSize = client->serverSize; 
    1432  
    1433 //      connectedServerRank_[client].clear(); 
    1434  
    1435       if (connectedServerRank_.find(receiverSize)==connectedServerRank_.end()) 
    1436       { 
     1399       
     1400      if (listReceiverSize.find(receiverSize)==listReceiverSize.end()) 
     1401      { 
     1402        listReceiverSize.insert(receiverSize) ; 
     1403        if (connectedServerRank_.find(receiverSize) != connectedServerRank_.end()) 
     1404        { 
     1405           // delete corresponding map in case of recompute, probably because a grid could has been modifiedd  
     1406           // by a transformation 
     1407          connectedServerRank_.erase(receiverSize); 
     1408          connectedDataSize_.erase(receiverSize); 
     1409          globalIndexOnServer_.erase(receiverSize); 
     1410          nbSenders.erase(receiverSize); 
     1411        } 
     1412 
    14371413        if (client->isServerLeader()) 
    14381414        { 
     
    16801656    connectedServerRankRead_ = ranks; 
    16811657 
    1682 // ym something is bad here, I comment some line, to be checked in future 
    1683    // int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    1684     int nbSrvPools = 1;     
    16851658    nbReadSenders.clear(); 
    1686     for (int p = 0; p < nbSrvPools; ++p) 
    1687     { 
    1688      // CContextServer* server = (!context->hasClient) ? context->server : context->serverPrimServer[p]; 
    1689       CContextServer* server = context->server  ; 
    1690       CContextClient* client = context->client;   //(!context->hasClient) ? context->client : context->clientPrimServer[p]; 
     1659    CContextServer* server = context->server  ; 
     1660    CContextClient* client = context->client;    
    16911661       
    1692       int idx = 0, numElement = axis_domain_order.numElements(); 
    1693       int ssize = numElement; 
    1694       std::vector<int> indexMap(numElement); 
    1695       for (int i = 0; i < numElement; ++i) 
    1696       { 
    1697         indexMap[i] = idx; 
    1698         if (2 == axis_domain_order(i)) 
    1699         { 
    1700           ++ssize; 
    1701           idx += 2; 
    1702         } 
    1703         else 
    1704           ++idx; 
    1705       } 
    1706  
    1707       for (int n = 0; n < ranks.size(); n++) 
    1708       { 
    1709         int rank = ranks[n]; 
    1710         CBufferIn& buffer = *buffers[n]; 
    1711  
    1712         buffer >> isDataDistributed_ >> isCompressible_; 
    1713         size_t dataSize = 0; 
    1714  
    1715         if (0 == serverDistribution_) 
    1716         { 
    1717           int axisId = 0, domainId = 0, scalarId = 0, globalSize = 1; 
    1718           std::vector<CDomain*> domainList = getDomains(); 
    1719           std::vector<CAxis*> axisList = getAxis(); 
    1720           std::vector<int> nBegin(ssize), nSize(ssize), nGlob(ssize), nBeginGlobal(ssize), nGlobElement(numElement); 
    1721           std::vector<CArray<int,1> > globalIndex(numElement); 
    1722           for (int i = 0; i < numElement; ++i) 
    1723           { 
    1724             nGlobElement[i] = globalSize; 
    1725             if (2 == axis_domain_order(i)) //domain 
    1726             { 
    1727               nBegin[indexMap[i]] = domainList[domainId]->ibegin; 
    1728               nSize[indexMap[i]]  = domainList[domainId]->ni; 
    1729               nBeginGlobal[indexMap[i]] = 0; 
    1730               nGlob[indexMap[i]] = domainList[domainId]->ni_glo; 
    1731  
    1732               nBegin[indexMap[i] + 1] = domainList[domainId]->jbegin; 
    1733               nSize[indexMap[i] + 1] = domainList[domainId]->nj; 
    1734               nBeginGlobal[indexMap[i] + 1] = 0; 
    1735               nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; 
    1736  
    1737               { 
    1738                 int count = 0; 
    1739                 globalIndex[i].resize(nSize[indexMap[i]]*nSize[indexMap[i]+1]); 
    1740                 for (int jdx = 0; jdx < nSize[indexMap[i]+1]; ++jdx) 
    1741                   for (int idx = 0; idx < nSize[indexMap[i]]; ++idx) 
    1742                   { 
    1743                     globalIndex[i](count) = (nBegin[indexMap[i]] + idx) + (nBegin[indexMap[i]+1] + jdx) * nGlob[indexMap[i]]; 
    1744                     ++count; 
    1745                   } 
    1746               } 
    1747  
    1748               ++domainId; 
    1749             } 
    1750             else if (1 == axis_domain_order(i)) // axis 
    1751             { 
    1752               nBegin[indexMap[i]] = axisList[axisId]->begin; 
    1753               nSize[indexMap[i]]  = axisList[axisId]->n; 
    1754               nBeginGlobal[indexMap[i]] = 0; 
    1755               nGlob[indexMap[i]] = axisList[axisId]->n_glo;      
    1756               globalIndex[i].resize(nSize[indexMap[i]]); 
    1757               for (int idx = 0; idx < nSize[indexMap[i]]; ++idx) 
    1758                 globalIndex[i](idx) = nBegin[indexMap[i]] + idx; 
    1759  
    1760               ++axisId; 
    1761             } 
    1762             else // scalar 
    1763             {  
    1764               nBegin[indexMap[i]] = 0; 
    1765               nSize[indexMap[i]]  = 1; 
    1766               nBeginGlobal[indexMap[i]] = 0; 
    1767               nGlob[indexMap[i]] = 1; 
    1768               globalIndex[i].resize(1); 
    1769               globalIndex[i](0) = 0; 
    1770               ++scalarId; 
    1771             } 
    1772           } 
    1773           dataSize = 1; 
    1774  
    1775           for (int i = 0; i < nSize.size(); ++i) 
    1776             dataSize *= nSize[i]; 
    1777           serverDistribution_ = new CDistributionServer(server->intraCommRank,  
    1778                                                         globalIndex, axis_domain_order, 
    1779                                                         nBegin, nSize, nBeginGlobal, nGlob); 
    1780         } 
    1781  
    1782         CArray<size_t,1> outIndex; 
    1783         buffer >> outIndex; 
    1784         outGlobalIndexFromClient.insert(std::make_pair(rank, outIndex)); 
    1785         connectedDataSizeRead_[rank] = outIndex.numElements(); 
    1786  
    1787         if (doGridHaveDataDistributed(client)) 
    1788         {} 
    1789         else 
    1790         { 
    1791           // THE PROBLEM HERE IS THAT DATA CAN BE NONDISTRIBUTED ON CLIENT AND DISTRIBUTED ON SERVER 
    1792           // BELOW IS THE TEMPORARY FIX only for a single type of element (domain, asix, scalar) 
    1793           dataSize = serverDistribution_->getGridSize(); 
    1794         } 
    1795         writtenDataSize_ += dataSize; 
    1796       } 
    1797  
    1798  
    1799       // Compute mask of the current grid 
     1662    int idx = 0, numElement = axis_domain_order.numElements(); 
     1663    int ssize = numElement; 
     1664    std::vector<int> indexMap(numElement); 
     1665    for (int i = 0; i < numElement; ++i) 
     1666    { 
     1667      indexMap[i] = idx; 
     1668      if (2 == axis_domain_order(i)) 
     1669      { 
     1670        ++ssize; 
     1671        idx += 2; 
     1672      } 
     1673      else 
     1674        ++idx; 
     1675    } 
     1676 
     1677    for (int n = 0; n < ranks.size(); n++) 
     1678    { 
     1679      int rank = ranks[n]; 
     1680      CBufferIn& buffer = *buffers[n]; 
     1681 
     1682      buffer >> isDataDistributed_ >> isCompressible_; 
     1683      size_t dataSize = 0; 
     1684 
     1685      if (0 == serverDistribution_) 
    18001686      { 
    18011687        int axisId = 0, domainId = 0, scalarId = 0, globalSize = 1; 
    18021688        std::vector<CDomain*> domainList = getDomains(); 
    18031689        std::vector<CAxis*> axisList = getAxis(); 
    1804         int dimSize = 2 * domainList.size() + axisList.size(); 
    1805         std::vector<int> nBegin(dimSize), nSize(dimSize), nGlob(dimSize), nBeginGlobal(dimSize);         
     1690        std::vector<int> nBegin(ssize), nSize(ssize), nGlob(ssize), nBeginGlobal(ssize), nGlobElement(numElement); 
     1691        std::vector<CArray<int,1> > globalIndex(numElement); 
    18061692        for (int i = 0; i < numElement; ++i) 
    1807         {           
     1693        { 
     1694          nGlobElement[i] = globalSize; 
    18081695          if (2 == axis_domain_order(i)) //domain 
    18091696          { 
    18101697            nBegin[indexMap[i]] = domainList[domainId]->ibegin; 
    18111698            nSize[indexMap[i]]  = domainList[domainId]->ni; 
    1812             nBeginGlobal[indexMap[i]] = 0;               
     1699            nBeginGlobal[indexMap[i]] = 0; 
    18131700            nGlob[indexMap[i]] = domainList[domainId]->ni_glo; 
    18141701 
    18151702            nBegin[indexMap[i] + 1] = domainList[domainId]->jbegin; 
    18161703            nSize[indexMap[i] + 1] = domainList[domainId]->nj; 
    1817             nBeginGlobal[indexMap[i] + 1] = 0;               
     1704            nBeginGlobal[indexMap[i] + 1] = 0; 
    18181705            nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; 
     1706 
     1707            { 
     1708              int count = 0; 
     1709              globalIndex[i].resize(nSize[indexMap[i]]*nSize[indexMap[i]+1]); 
     1710              for (int jdx = 0; jdx < nSize[indexMap[i]+1]; ++jdx) 
     1711                for (int idx = 0; idx < nSize[indexMap[i]]; ++idx) 
     1712                { 
     1713                  globalIndex[i](count) = (nBegin[indexMap[i]] + idx) + (nBegin[indexMap[i]+1] + jdx) * nGlob[indexMap[i]]; 
     1714                  ++count; 
     1715                } 
     1716            } 
    18191717 
    18201718            ++domainId; 
     
    18241722            nBegin[indexMap[i]] = axisList[axisId]->begin; 
    18251723            nSize[indexMap[i]]  = axisList[axisId]->n; 
    1826             nBeginGlobal[indexMap[i]] = 0;               
    1827             nGlob[indexMap[i]] = axisList[axisId]->n_glo;               
     1724            nBeginGlobal[indexMap[i]] = 0; 
     1725            nGlob[indexMap[i]] = axisList[axisId]->n_glo;      
     1726            globalIndex[i].resize(nSize[indexMap[i]]); 
     1727            for (int idx = 0; idx < nSize[indexMap[i]]; ++idx) 
     1728              globalIndex[i](idx) = nBegin[indexMap[i]] + idx; 
     1729 
    18281730            ++axisId; 
    18291731          } 
    18301732          else // scalar 
    1831           {   
     1733          {  
     1734            nBegin[indexMap[i]] = 0; 
     1735            nSize[indexMap[i]]  = 1; 
     1736            nBeginGlobal[indexMap[i]] = 0; 
     1737            nGlob[indexMap[i]] = 1; 
     1738            globalIndex[i].resize(1); 
     1739            globalIndex[i](0) = 0; 
     1740            ++scalarId; 
    18321741          } 
    18331742        } 
    1834          
    1835         if (nSize.empty()) // Scalar grid 
    1836         { 
    1837           nBegin.push_back(0); 
    1838           nSize.push_back(1); 
    1839           nBeginGlobal.push_back(0);               
    1840           nGlob.push_back(1);   
    1841         } 
    1842       } 
    1843  
    1844       if (isScalarGrid()) return; 
    1845  
    1846       nbReadSenders[client] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); 
    1847     } 
     1743        dataSize = 1; 
     1744 
     1745        for (int i = 0; i < nSize.size(); ++i) 
     1746        dataSize *= nSize[i]; 
     1747        serverDistribution_ = new CDistributionServer(server->intraCommRank,  
     1748                                                      globalIndex, axis_domain_order, 
     1749                                                      nBegin, nSize, nBeginGlobal, nGlob); 
     1750      } 
     1751 
     1752      CArray<size_t,1> outIndex; 
     1753      buffer >> outIndex; 
     1754      outGlobalIndexFromClient.insert(std::make_pair(rank, outIndex)); 
     1755      connectedDataSizeRead_[rank] = outIndex.numElements(); 
     1756 
     1757      if (doGridHaveDataDistributed(client)) 
     1758      {} 
     1759      else 
     1760      { 
     1761        // THE PROBLEM HERE IS THAT DATA CAN BE NONDISTRIBUTED ON CLIENT AND DISTRIBUTED ON SERVER 
     1762        // BELOW IS THE TEMPORARY FIX only for a single type of element (domain, asix, scalar) 
     1763        dataSize = serverDistribution_->getGridSize(); 
     1764      } 
     1765      writtenDataSize_ += dataSize; 
     1766    } 
     1767 
     1768 
     1769    // Compute mask of the current grid 
     1770    { 
     1771      int axisId = 0, domainId = 0, scalarId = 0, globalSize = 1; 
     1772      std::vector<CDomain*> domainList = getDomains(); 
     1773      std::vector<CAxis*> axisList = getAxis(); 
     1774      int dimSize = 2 * domainList.size() + axisList.size(); 
     1775      std::vector<int> nBegin(dimSize), nSize(dimSize), nGlob(dimSize), nBeginGlobal(dimSize);         
     1776      for (int i = 0; i < numElement; ++i) 
     1777      {           
     1778        if (2 == axis_domain_order(i)) //domain 
     1779        { 
     1780          nBegin[indexMap[i]] = domainList[domainId]->ibegin; 
     1781          nSize[indexMap[i]]  = domainList[domainId]->ni; 
     1782          nBeginGlobal[indexMap[i]] = 0;               
     1783          nGlob[indexMap[i]] = domainList[domainId]->ni_glo; 
     1784 
     1785          nBegin[indexMap[i] + 1] = domainList[domainId]->jbegin; 
     1786          nSize[indexMap[i] + 1] = domainList[domainId]->nj; 
     1787          nBeginGlobal[indexMap[i] + 1] = 0;               
     1788          nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; 
     1789          ++domainId; 
     1790        } 
     1791        else if (1 == axis_domain_order(i)) // axis 
     1792        { 
     1793          nBegin[indexMap[i]] = axisList[axisId]->begin; 
     1794          nSize[indexMap[i]]  = axisList[axisId]->n; 
     1795          nBeginGlobal[indexMap[i]] = 0;               
     1796          nGlob[indexMap[i]] = axisList[axisId]->n_glo;               
     1797          ++axisId; 
     1798        } 
     1799        else // scalar 
     1800        {   
     1801        } 
     1802      } 
     1803      
     1804      if (nSize.empty()) // Scalar grid 
     1805      { 
     1806        nBegin.push_back(0); 
     1807        nSize.push_back(1); 
     1808        nBeginGlobal.push_back(0);               
     1809        nGlob.push_back(1);   
     1810      } 
     1811    } 
     1812 
     1813    if (isScalarGrid()) return; 
     1814 
     1815    nbReadSenders[client] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); 
     1816 
    18481817  } 
    18491818  CATCH_DUMP_ATTR 
     
    21222091   \param[in] id String identity of domain that will be created on server 
    21232092   */ 
    2124    void CGrid::sendAddDomain(const string& id) 
    2125    TRY 
    2126   { 
    2127       sendAddItem(id, (int)EVENT_ID_ADD_DOMAIN); 
     2093   void CGrid::sendAddDomain(const string& id, CContextClient* contextClient) 
     2094   TRY 
     2095  { 
     2096      sendAddItem(id, (int)EVENT_ID_ADD_DOMAIN, contextClient); 
    21282097   } 
    21292098   CATCH_DUMP_ATTR 
     
    21332102   \param[in] id String identity of axis that will be created on server 
    21342103   */ 
    2135    void CGrid::sendAddAxis(const string& id) 
    2136    TRY 
    2137    { 
    2138       sendAddItem(id, (int)EVENT_ID_ADD_AXIS); 
     2104   void CGrid::sendAddAxis(const string& id, CContextClient* contextClient) 
     2105   TRY 
     2106   { 
     2107      sendAddItem(id, (int)EVENT_ID_ADD_AXIS, contextClient); 
    21392108   } 
    21402109   CATCH_DUMP_ATTR 
     
    21442113   \param[in] id String identity of scalar that will be created on server 
    21452114   */ 
    2146    void CGrid::sendAddScalar(const string& id) 
    2147    TRY 
    2148    { 
    2149       sendAddItem(id, (int)EVENT_ID_ADD_SCALAR); 
     2115   void CGrid::sendAddScalar(const string& id, CContextClient* contextClient) 
     2116   TRY 
     2117   { 
     2118      sendAddItem(id, (int)EVENT_ID_ADD_SCALAR, contextClient); 
    21502119   } 
    21512120   CATCH_DUMP_ATTR 
     
    26542623    Send all attributes of domains from client to server 
    26552624  */ 
    2656   void CGrid::sendAllDomains() 
     2625  void CGrid::sendAllDomains(CContextClient* contextClient) 
    26572626  TRY 
    26582627  { 
     
    26612630    for (int i = 0; i < dSize; ++i) 
    26622631    { 
    2663       sendAddDomain(domList[i]->getId()); 
    2664       domList[i]->sendAllAttributesToServer(); 
     2632      sendAddDomain(domList[i]->getId(),contextClient); 
     2633      domList[i]->sendAllAttributesToServer(contextClient); 
    26652634    } 
    26662635  } 
     
    26702639    Send all attributes of axis from client to server 
    26712640  */ 
    2672   void CGrid::sendAllAxis() 
     2641  void CGrid::sendAllAxis(CContextClient* contextClient) 
    26732642  TRY 
    26742643  { 
     
    26782647    for (int i = 0; i < aSize; ++i) 
    26792648    { 
    2680       sendAddAxis(aList[i]->getId()); 
    2681       aList[i]->sendAllAttributesToServer(); 
     2649      sendAddAxis(aList[i]->getId(),contextClient); 
     2650      aList[i]->sendAllAttributesToServer(contextClient); 
    26822651    } 
    26832652  } 
     
    26872656    Send all attributes of scalars from client to server 
    26882657  */ 
    2689   void CGrid::sendAllScalars() 
     2658  void CGrid::sendAllScalars(CContextClient* contextClient) 
    26902659  TRY 
    26912660  { 
     
    26952664    for (int i = 0; i < sSize; ++i) 
    26962665    { 
    2697       sendAddScalar(sList[i]->getId()); 
    2698       sList[i]->sendAllAttributesToServer(); 
     2666      sendAddScalar(sList[i]->getId(),contextClient); 
     2667      sList[i]->sendAllAttributesToServer(contextClient); 
    26992668    } 
    27002669  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp

    r1637 r1784  
    144144         CAxis* addAxis(const std::string& id=StdString()); 
    145145         CScalar* addScalar(const std::string& id=StdString()); 
    146          void sendAddDomain(const std::string& id=""); 
    147          void sendAddAxis(const std::string& id=""); 
    148          void sendAddScalar(const std::string& id=""); 
    149          void sendAllDomains(); 
    150          void sendAllAxis(); 
    151          void sendAllScalars(); 
     146         void sendAddDomain(const std::string& id,CContextClient* contextClient); 
     147         void sendAddAxis(const std::string& id,CContextClient* contextClient); 
     148         void sendAddScalar(const std::string& id,CContextClient* contextClient); 
     149         void sendAllDomains(CContextClient* contextClient); 
     150         void sendAllAxis(CContextClient* contextClient); 
     151         void sendAllScalars(CContextClient* contextClient); 
    152152 
    153153         static void recvAddDomain(CEventServer& event); 
     
    219219         map<int, CArray<int, 1> > storeIndex_fromSrv; // Support, for now, reading with level-1 server 
    220220 
    221          map<int, CArray<size_t, 1> > outIndexFromClient;  // Deprecated 
    222  
    223221         map<int, CArray<size_t, 1> > compressedOutIndexFromClient; 
    224222 
     
    365363 
    366364 
    367 /** List order of axis and domain in a grid, if there is a domain, it will take value 1 (true), axis 0 (false) */ 
     365/** List order of axis and domain in a grid, if there is a domain, it will take value 2, axis 1, scalar 0 */ 
    368366        std::vector<int> order_; 
    369367 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/variable.cpp

    r1158 r1784  
    9494   * 
    9595   */ 
    96    void CVariable::sendValue() 
    97    { 
    98      CContext* context=CContext::getCurrent() ; 
    99  
    100      if (context->hasClient) 
    101      { 
    102        // Use correct context client to send message 
    103        // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    104       int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 
    105        for (int i = 0; i < nbSrvPools; ++i) 
    106        { 
    107 //       CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer 
    108          CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] 
    109                                                                              : context->client; 
    110  
    111          CEventClient event(this->getType(),EVENT_ID_VARIABLE_VALUE) ; 
    112          if (contextClientTmp->isServerLeader()) 
    113          { 
    114            CMessage msg ; 
    115            msg<<this->getId() ; 
    116            msg<<content ; 
    117            const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    118            for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    119              event.push(*itRank,1,msg); 
    120            contextClientTmp->sendEvent(event) ; 
    121          } 
    122          else contextClientTmp->sendEvent(event) ; 
    123       } 
    124      } 
    125    } 
    126  
    127    void CVariable::sendValue(CContextClient* client, bool clientPrim /*= false*/) 
     96 
     97   void CVariable::sendValue(CContextClient* client) 
    12898   { 
    12999     CEventClient event(this->getType(),EVENT_ID_VARIABLE_VALUE) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/variable.hpp

    r1158 r1784  
    7979 
    8080            //! Sending a request to set up variable data 
    81             void sendValue(); 
    82             void sendValue(CContextClient* client, bool clientPrim = false); 
     81            void sendValue(CContextClient* client); 
    8382 
    8483            static void recvValue(CEventServer& event) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp

    r1542 r1784  
    5656         static void ClearAllAttributes(void); 
    5757         std::map<int, size_t> getMinimumBufferSizeForAttributes(CContextClient* client); 
    58          void sendAttributToServer(const string& id); 
    5958         void sendAttributToServer(const string& id, CContextClient* client); 
    60          void sendAttributToServer(CAttribute& attr) ; 
    6159         void sendAttributToServer(CAttribute& attr, CContextClient* client) ; 
    62          void sendAllAttributesToServer(); 
    6360         void sendAllAttributesToServer(CContextClient* client); 
    64          void sendAddItem(const string& id, int itemType); 
    6561         void sendAddItem(const string& id, int itemType, CContextClient* client); 
    6662         static void recvAttributFromClient(CEventServer& event) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template_impl.hpp

    r1761 r1784  
    215215   } 
    216216 
    217  
    218    template<typename T> 
    219    void CObjectTemplate<T>::sendAllAttributesToServer() 
    220    { 
    221      CAttributeMap& attrMap = *this; 
    222      CAttributeMap::const_iterator it = attrMap.begin(), itE = attrMap.end(); 
    223      for (; it != itE; ++it) 
    224      { 
    225        if (it->second->doSend() && !(it->second)->isEmpty()) sendAttributToServer(*(it->second)); 
    226      } 
    227    } 
    228  
    229217   template<typename T> 
    230218   void CObjectTemplate<T>::sendAllAttributesToServer(CContextClient* client) 
     
    239227 
    240228   template <class T> 
    241    void CObjectTemplate<T>::sendAttributToServer(const string& id) 
    242    { 
    243       CAttributeMap & attrMap = *this; 
    244       CAttribute* attr=attrMap[id]; 
    245       sendAttributToServer(*attr); 
    246    } 
    247  
    248    template <class T> 
    249229   void CObjectTemplate<T>::sendAttributToServer(const string& id, CContextClient* client) 
    250230   { 
     
    253233      sendAttributToServer(*attr, client); 
    254234   } 
    255  
    256   template <class T> 
    257   void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr) 
    258   { 
    259      // Use correct context client to send message 
    260     CContext* context=CContext::getCurrent(); 
    261     if (context->hasClient) 
    262     { 
    263       // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    264       int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 
    265       for (int i = 0; i < nbSrvPools; ++i) 
    266       { 
    267         CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    268         CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); 
    269         if (contextClientTmp->isServerLeader()) 
    270         { 
    271           CMessage msg; 
    272           if (context->hasServer)  msg<<this->getIdServer(i); 
    273           else  msg<<this->getIdServer();  
    274  
    275           msg << attr.getName(); 
    276           msg << attr; 
    277           const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    278           for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    279             event.push(*itRank,1,msg); 
    280           contextClientTmp->sendEvent(event); 
    281         } 
    282         else contextClientTmp->sendEvent(event); 
    283       } 
    284     } 
    285   } 
    286235 
    287236  template <class T> 
     
    309258    \param [in] itemType type of added item 
    310259  */ 
    311   template<class T> 
    312   void CObjectTemplate<T>::sendAddItem(const StdString& id, int itemType) 
    313   { 
    314     CContext* context = CContext::getCurrent(); 
    315     typedef typename T::EEventId ItemType; 
    316     if (context->hasClient) 
    317     { 
    318       // Use correct context client to send message 
    319       // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    320       int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 
    321       for (int i = 0; i < nbSrvPools; ++i) 
    322       { 
    323          CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    324          CEventClient event(this->getType(),ItemType(itemType)); 
    325          if (contextClientTmp->isServerLeader()) 
    326          { 
    327            CMessage msg; 
    328            msg << this->getId(); 
    329            msg << id; 
    330            const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    331            for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    332              event.push(*itRank,1,msg); 
    333            contextClientTmp->sendEvent(event); 
    334          } 
    335          else contextClientTmp->sendEvent(event); 
    336       } 
    337     } 
    338   } 
    339260 
    340261  template<class T> 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_interpolate.cpp

    r1639 r1784  
    7272  CTimer::get("CAxisAlgorithmInterpolate::computeIndexSourceMapping_").resume() ; 
    7373  CContext* context = CContext::getCurrent(); 
    74   CContextClient* client=context->client; 
    75   int nbClient = client->clientSize; 
     74  int nbClient = context->intraCommSize_; 
    7675  CArray<bool,1>& axisMask = axisSrc_->mask; 
    7776  int srcSize  = axisSrc_->n_glo.getValue(); 
     
    227226{ 
    228227  CContext* context = CContext::getCurrent(); 
    229   CContextClient* client=context->client; 
    230   int nbClient = client->clientSize; 
     228  int nbClient = context->intraCommSize_; 
    231229 
    232230  int srcSize  = axisSrc_->n_glo.getValue(); 
     
    272270 
    273271    int* recvCount=new int[nbClient]; 
    274     MPI_Allgather(&numValue,1,MPI_INT,recvCount,1,MPI_INT,client->intraComm); 
     272    MPI_Allgather(&numValue,1,MPI_INT,recvCount,1,MPI_INT,context->intraComm_); 
    275273 
    276274    int* displ=new int[nbClient]; 
     
    279277 
    280278    // Each client have enough global info of axis 
    281     MPI_Allgatherv(sendIndexBuff,numValue,MPI_INT,recvIndexBuff,recvCount,displ,MPI_INT,client->intraComm); 
    282     MPI_Allgatherv(sendValueBuff,numValue,MPI_DOUBLE,&(recvBuff[0]),recvCount,displ,MPI_DOUBLE,client->intraComm); 
     279    MPI_Allgatherv(sendIndexBuff,numValue,MPI_INT,recvIndexBuff,recvCount,displ,MPI_INT,context->intraComm_); 
     280    MPI_Allgatherv(sendValueBuff,numValue,MPI_DOUBLE,&(recvBuff[0]),recvCount,displ,MPI_DOUBLE,context->intraComm_); 
    283281 
    284282    for (int idx = 0; idx < srcSize; ++idx) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_inverse.cpp

    r1639 r1784  
    9898{ 
    9999  CContext* context = CContext::getCurrent(); 
    100   CContextClient* client=context->client; 
    101   int clientRank = client->clientRank; 
    102   int nbClient = client->clientSize; 
     100  int clientRank = context->intraCommRank_; 
     101  int nbClient = context->intraCommSize_; 
    103102 
    104103  int niSrc     = axisSrc_->n.getValue(); 
     
    131130  } 
    132131 
    133   CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     132  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_); 
    134133  dhtIndexProcRank.computeIndexInfoMapping(globalSrcIndex); 
    135134  CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     
    161160    sendRankSizeMap[itIndex->first] = sendSize; 
    162161  } 
    163   MPI_Allgather(&connectedClient,1,MPI_INT,recvCount,1,MPI_INT,client->intraComm); 
     162  MPI_Allgather(&connectedClient,1,MPI_INT,recvCount,1,MPI_INT,context->intraComm_); 
    164163 
    165164  displ[0]=0 ; 
     
    168167  int* recvRankBuff=new int[recvSize]; 
    169168  int* recvSizeBuff=new int[recvSize]; 
    170   MPI_Allgatherv(sendRankBuff,connectedClient,MPI_INT,recvRankBuff,recvCount,displ,MPI_INT,client->intraComm); 
    171   MPI_Allgatherv(sendSizeBuff,connectedClient,MPI_INT,recvSizeBuff,recvCount,displ,MPI_INT,client->intraComm); 
     169  MPI_Allgatherv(sendRankBuff,connectedClient,MPI_INT,recvRankBuff,recvCount,displ,MPI_INT,context->intraComm_); 
     170  MPI_Allgatherv(sendSizeBuff,connectedClient,MPI_INT,recvSizeBuff,recvCount,displ,MPI_INT,context->intraComm_); 
    172171  for (int i = 0; i < nbClient; ++i) 
    173172  { 
     
    193192 
    194193    requests.push_back(MPI_Request()); 
    195     MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, MPI_UNSIGNED_LONG, recvRank, 46, client->intraComm, &requests.back()); 
     194    MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, MPI_UNSIGNED_LONG, recvRank, 46, context->intraComm_, &requests.back()); 
    196195  } 
    197196 
     
    215214    // Send global index source and mask 
    216215    requests.push_back(MPI_Request()); 
    217     MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, MPI_UNSIGNED_LONG, sendRank, 46, client->intraComm, &requests.back()); 
     216    MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, MPI_UNSIGNED_LONG, sendRank, 46, context->intraComm_, &requests.back()); 
    218217  } 
    219218 
     
    232231 
    233232    requests.push_back(MPI_Request()); 
    234     MPI_Irecv(recvValueFromSrc[recvRank], recvSize, MPI_DOUBLE, recvRank, 48, client->intraComm, &requests.back()); 
     233    MPI_Irecv(recvValueFromSrc[recvRank], recvSize, MPI_DOUBLE, recvRank, 48, context->intraComm_, &requests.back()); 
    235234  } 
    236235 
     
    250249    // Okie, now inform the destination which source index are masked 
    251250    requests.push_back(MPI_Request()); 
    252     MPI_Isend(sendValueToDest[recvRank], recvSize, MPI_DOUBLE, recvRank, 48, client->intraComm, &requests.back()); 
     251    MPI_Isend(sendValueToDest[recvRank], recvSize, MPI_DOUBLE, recvRank, 48, context->intraComm_, &requests.back()); 
    253252  } 
    254253  status.resize(requests.size()); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm_transformation.cpp

    r1622 r1784  
    7676{ 
    7777  CContext* context = CContext::getCurrent(); 
    78   CContextClient* client=context->client; 
    79   int clientRank = client->clientRank; 
    80   int clientSize = client->clientSize; 
     78  int clientRank = context->intraCommRank_; 
     79  int clientSize = context->intraCommSize_; 
    8180 
    8281  size_t globalIndex; 
     
    127126  } 
    128127 
    129   CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     128  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_); 
    130129  dhtIndexProcRank.computeIndexInfoMapping(globalAxisIndex); 
    131130 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_expand.cpp

    r1622 r1784  
    9494{ 
    9595  CContext* context = CContext::getCurrent(); 
    96   CContextClient* client=context->client; 
    97  
     96  
    9897  int type = 1; // For edge 
    9998  CMesh mesh; 
     
    103102  switch (domainSource->type) { 
    104103   case CDomain::type_attr::unstructured:       
    105       mesh.getGlobalNghbFaces(type, client->intraComm, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); 
     104      mesh.getGlobalNghbFaces(type, context->intraComm_, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); 
    106105      updateUnstructuredDomainAttributes(domainDestination, domainSource, neighborsSrc); 
    107106      break; 
     
    123122{ 
    124123  CContext* context = CContext::getCurrent(); 
    125   CContextClient* client=context->client; 
    126124 
    127125  int type = 1; // For edge 
     
    132130  switch (domainSource->type) { 
    133131   case CDomain::type_attr::unstructured:       
    134       mesh.getGlobalNghbFaces(type, client->intraComm, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); 
     132      mesh.getGlobalNghbFaces(type, context->intraComm_, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); 
    135133      updateUnstructuredDomainAttributes(domainDestination, domainSource, neighborsSrc); 
    136134      break; 
     
    158156  int iindexSrc, jindexSrc, globIndexSrc; 
    159157  CContext* context = CContext::getCurrent(); 
    160   CContextClient* client=context->client; 
    161158 
    162159  // First of all, "copy" all attributes of domain source to domain destination 
     
    341338  } 
    342339 
    343   CClientClientDHTDouble dhtData(localData,client->intraComm); 
     340  CClientClientDHTDouble dhtData(localData,context->intraComm_); 
    344341  dhtData.computeIndexInfoMapping(globalIndexSrcOnDstDomain); 
    345342  CClientClientDHTDouble::Index2VectorInfoTypeMap& neighborData = dhtData.getInfoIndexMap(); 
     
    482479 
    483480  CContext* context = CContext::getCurrent(); 
    484   CContextClient* client=context->client; 
    485481 
    486482  // First of all, "copy" all attributes of domain source to domain destination 
     
    606602  } 
    607603 
    608   CClientClientDHTDouble dhtData(localData,client->intraComm); 
     604  CClientClientDHTDouble dhtData(localData, context->intraComm_); 
    609605  CArray<size_t,1> neighborInd(nbNeighbor); 
    610606  for (int idx = 0; idx < nbNeighbor; ++idx) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_generate_rectilinear.cpp

    r1639 r1784  
    4848{ 
    4949  CContext* context = CContext::getCurrent(); 
    50   CContextClient* client = context->client; 
    51  
     50  int clientSize = context->intraCommSize_ ; 
     51  int clientRank = context->intraCommRank_ ; 
     52   
    5253  std::vector<CDomain*> domListSrcP = gridSrc->getDomains(); 
    5354  std::vector<CAxis*> axisListSrcP = gridSrc->getAxis(); 
     
    5657  { 
    5758    // First, find (roundly) distribution of associated axis (if any) 
    58     if (axisListSrcP.empty()) nbDomainDistributedPart_ = client->clientSize; 
     59    if (axisListSrcP.empty()) nbDomainDistributedPart_ = clientSize; 
    5960    else 
    6061    { 
     
    6970        HashXIOS<int> hashFunc; 
    7071        StdSize hashValue = hashFunc.hashVec(globalAxisIndex); 
    71         std::vector<StdSize> recvBuff(client->clientSize); 
     72        std::vector<StdSize> recvBuff(clientSize); 
    7273        MPI_Gather(&hashValue, 1, MPI_UNSIGNED_LONG, 
    7374                   &recvBuff[0], 1, MPI_UNSIGNED_LONG, 
    7475                   0, 
    75                    client->intraComm); 
    76         if (0 == client->clientRank) 
     76                   context->intraComm_); 
     77        if (0 == clientRank) 
    7778        { 
    7879          std::set<StdSize> setTmp; 
     
    8889 
    8990        MPI_Bcast(&nbLocalAxis[0], nbAxis, MPI_INT, 
    90                   0, client->intraComm); 
     91                  0, context->intraComm_); 
    9192      } 
    9293 
    9394      int nbAxisDistributedPart = 1; 
    9495      for (int j = 0; j < nbAxis; ++j) nbAxisDistributedPart *= nbLocalAxis[j]; 
    95       nbDomainDistributedPart_ = client->clientSize/nbAxisDistributedPart; 
     96      nbDomainDistributedPart_ = clientSize/nbAxisDistributedPart; 
    9697    } 
    9798  } 
     
    118119 
    119120  CContext* context = CContext::getCurrent(); 
    120   CContextClient* client = context->client; 
    121   int modPart = (client->clientSize) % nbPartition; 
     121  int modPart = (context->intraCommSize_) % nbPartition; 
    122122  if (0 != modPart) 
    123123    ERROR("CDomainAlgorithmGenerateRectilinear::computeDistributionGridDestination(CGrid* gridDest)", 
    124124       << "The grid " <<gridDest->getId() << " is not well-distributed. There is an incompatibility between distribution of axis and domain."); 
    125   nbDomainDistributedPart_ = client->clientSize/nbPartition; 
     125  nbDomainDistributedPart_ = context->intraCommSize_/nbPartition; 
    126126 
    127127} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_interpolate.cpp

    r1639 r1784  
    109109 
    110110  CContext* context = CContext::getCurrent(); 
    111   CContextClient* client=context->client; 
    112   int clientRank = client->clientRank; 
     111  int clientRank = context->intraCommRank_; 
    113112  int i, j, k, idx; 
    114113  std::vector<double> srcPole(3,0), dstPole(3,0); 
     
    300299 
    301300  // Calculate weight index 
    302   Mapper mapper(client->intraComm); 
     301  Mapper mapper(context->intraComm_); 
    303302  mapper.setVerbosity(PROGRESS) ; 
    304303 
     
    432431{ 
    433432  CContext* context = CContext::getCurrent(); 
    434   CContextClient* client=context->client; 
    435  
     433   
    436434  MPI_Comm poleComme(MPI_COMM_NULL); 
    437   MPI_Comm_split(client->intraComm, interMapValuePole.empty() ? MPI_UNDEFINED : 1, 0, &poleComme); 
     435  MPI_Comm_split(context->intraComm_, interMapValuePole.empty() ? MPI_UNDEFINED : 1, 0, &poleComme); 
    438436  if (MPI_COMM_NULL != poleComme) 
    439437  { 
     
    534532{ 
    535533  CContext* context = CContext::getCurrent(); 
    536   CContextClient* client=context->client; 
    537   int clientRank = client->clientRank; 
     534  int clientRank = context->intraCommRank_; 
    538535 
    539536  this->transformationMapping_.resize(1); 
     
    800797{ 
    801798  CContext* context = CContext::getCurrent(); 
    802   CContextClient* client=context->client; 
    803  
     799   
    804800  size_t n_src = domainSrc_->ni_glo * domainSrc_->nj_glo; 
    805801  size_t n_dst = domainDest_->ni_glo * domainDest_->nj_glo; 
     
    835831  } 
    836832 
    837   MPI_Allreduce(&localNbWeight, &globalNbWeight, 1, MPI_LONG, MPI_SUM, client->intraComm); 
    838   MPI_Scan(&localNbWeight, &startIndex, 1, MPI_LONG, MPI_SUM, client->intraComm); 
     833  MPI_Allreduce(&localNbWeight, &globalNbWeight, 1, MPI_LONG, MPI_SUM, context->intraComm_); 
     834  MPI_Scan(&localNbWeight, &startIndex, 1, MPI_LONG, MPI_SUM, context->intraComm_); 
    839835   
    840836  if (0 == globalNbWeight) 
     
    850846  std::vector<StdSize> count(1, localNbWeight); 
    851847   
    852   WriteNetCdf netCdfWriter(filename, client->intraComm);   
     848  WriteNetCdf netCdfWriter(filename, context->intraComm_);   
    853849 
    854850  // Define some dimensions 
     
    895891 
    896892  CContext* context = CContext::getCurrent(); 
    897   CContextClient* client=context->client; 
    898   int clientRank = client->clientRank; 
    899   int clientSize = client->clientSize; 
     893  int clientRank = context->intraCommRank_; 
     894  int clientSize = context->intraCommSize_; 
    900895 
    901896 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_transformation.cpp

    r1622 r1784  
    3939{ 
    4040  CContext* context = CContext::getCurrent(); 
    41   CContextClient* client=context->client; 
    42   int clientRank = client->clientRank; 
    43   int clientSize = client->clientSize; 
     41  int clientRank = context->intraCommRank_; 
     42  int clientSize = context->intraCommSize_; 
    4443 
    4544  int niGlob = domainSrc_->ni_glo.getValue(); 
     
    6261  } 
    6362 
    64   CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     63  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_); 
    6564  dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex); 
    6665  globalDomainIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.cpp

    r1639 r1784  
    124124    { 
    125125      CContext* context = CContext::getCurrent(); 
    126       CContextClient* client = context->client; 
    127    
     126         
    128127      computePositionElements(gridSrc, gridDst); 
    129128      std::vector<CScalar*> scalarListSrcP  = gridSrc->getScalars(); 
     
    136135      { 
    137136        distributed=domainListSrcP[elementPositionInGridSrc2DomainPosition_[elementPositionInGrid]]->isDistributed() ; 
    138         MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, client->intraComm) ; 
     137        MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, context->intraComm_) ; 
    139138     
    140139      } 
     
    142141      { 
    143142        distributed=axisListSrcP[elementPositionInGridSrc2AxisPosition_[elementPositionInGrid]]->isDistributed() ; 
    144         MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, client->intraComm) ; 
     143        MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, context->intraComm_) ; 
    145144      } 
    146145      else //it's a scalar 
     
    170169 { 
    171170  CContext* context = CContext::getCurrent(); 
    172   CContextClient* client = context->client; 
    173   int nbClient = client->clientSize; 
     171  int nbClient = context->intraCommSize_; 
    174172 
    175173  typedef std::unordered_map<int, std::vector<std::pair<int,double> > > SrcToDstMap; 
     
    238236  int sendValue = (computeGlobalIndexOnProc) ? 1 : 0; 
    239237  int recvValue = 0; 
    240   MPI_Allreduce(&sendValue, &recvValue, 1, MPI_INT, MPI_SUM, client->intraComm); 
     238  MPI_Allreduce(&sendValue, &recvValue, 1, MPI_INT, MPI_SUM, context->intraComm_); 
    241239  computeGlobalIndexOnProc = (0 < recvValue); 
    242240 
     
    475473   
    476474  CContext* context = CContext::getCurrent(); 
    477   CContextClient* client=context->client; 
    478   int clientRank = client->clientRank; 
     475  int clientRank = context->intraCommRank_; 
    479476   
    480477  std::vector<CDomain*> domainListSrcP = gridSrc->getDomains(); 
     
    667664{ 
    668665  CContext* context = CContext::getCurrent(); 
    669   CContextClient* client=context->client; 
    670   int clientRank = client->clientRank; 
    671   int clientSize = client->clientSize; 
     666  int clientRank = context->intraCommRank_; 
     667  int clientSize = context->intraCommSize_; 
    672668 
    673669  globalScalarIndexOnProc.rehash(std::ceil(clientSize/globalScalarIndexOnProc.max_load_factor())); 
     
    693689{ 
    694690  CContext* context = CContext::getCurrent(); 
    695   CContextClient* client=context->client; 
    696   int clientRank = client->clientRank; 
    697   int clientSize = client->clientSize; 
     691  int clientRank = context->intraCommRank_; 
     692  int clientSize = context->intraCommSize_; 
    698693 
    699694  size_t globalIndex; 
     
    710705  } 
    711706 
    712   CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     707  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_); 
    713708  CArray<size_t,1> globalAxisIndex(axisDst->index.numElements()); 
    714709  for (int idx = 0; idx < globalAxisIndex.numElements(); ++idx) 
     
    764759{ 
    765760  CContext* context = CContext::getCurrent(); 
    766   CContextClient* client=context->client; 
    767   int clientRank = client->clientRank; 
    768   int clientSize = client->clientSize; 
     761  int clientRank = context->intraCommRank_; 
     762  int clientSize = context->intraCommSize_; 
    769763 
    770764  int niGlobSrc = domainSrc->ni_glo.getValue(); 
     
    820814  } 
    821815 
    822   CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     816  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_); 
    823817  dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex); 
    824818 
     
    862856 
    863857  CContext* context = CContext::getCurrent(); 
    864   CContextClient* client = context->client; 
    865   int nbClient = client->clientSize; 
     858  int nbClient = context->intraCommSize_; 
    866859 
    867860  computePositionElements(gridDst, gridSrc); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_transformation.cpp

    r1639 r1784  
    365365 
    366366  CContext* context = CContext::getCurrent(); 
    367   CContextClient* client = context->client; 
    368367 
    369368  ListAlgoType::const_iterator itb = listAlgos_.begin(), 
     
    419418        CTimer::get("computeTransformationMappingConvert").resume();   
    420419        nbLocalIndexOnGridDest_.push_back(nbLocalIndexOnGridDest) ; 
    421         int clientRank=client->clientRank ; 
     420        int clientRank=context->intraCommRank_ ; 
    422421        { 
    423422          SendingIndexGridSourceMap tmp; 
     
    475474{ 
    476475  CContext* context = CContext::getCurrent(); 
    477   CContextClient* client = context->client; 
    478   int nbClient = client->clientSize; 
    479   int clientRank = client->clientRank; 
     476  int nbClient = context->intraCommSize_; 
     477  int clientRank = context->intraCommRank_; 
    480478 
    481479  // Recalculate the distribution of grid destination 
    482   CDistributionClient distributionClientDest(client->clientRank, tmpGridDestination_); 
     480  CDistributionClient distributionClientDest(clientRank, tmpGridDestination_); 
    483481  CDistributionClient::GlobalLocalDataMap& globalLocalIndexGridDestSendToServer = distributionClientDest.getGlobalLocalDataSendToServer(); 
    484482 
     
    514512    sendRankSizeMap[itIndex->first] = sendSize; 
    515513  } 
    516   MPI_Allgather(&connectedClient,1,MPI_INT,recvCount,1,MPI_INT,client->intraComm); 
     514  MPI_Allgather(&connectedClient,1,MPI_INT,recvCount,1,MPI_INT, context->intraComm_); 
    517515 
    518516  displ[0]=0 ; 
     
    521519  int* recvRankBuff=new int[recvSize]; 
    522520  int* recvSizeBuff=new int[recvSize]; 
    523   MPI_Allgatherv(sendRankBuff,connectedClient,MPI_INT,recvRankBuff,recvCount,displ,MPI_INT,client->intraComm); 
    524   MPI_Allgatherv(sendSizeBuff,connectedClient,MPI_INT,recvSizeBuff,recvCount,displ,MPI_INT,client->intraComm); 
     521  MPI_Allgatherv(sendRankBuff,connectedClient,MPI_INT,recvRankBuff,recvCount,displ,MPI_INT,context->intraComm_); 
     522  MPI_Allgatherv(sendSizeBuff,connectedClient,MPI_INT,recvSizeBuff,recvCount,displ,MPI_INT,context->intraComm_); 
    525523  for (int i = 0; i < nbClient; ++i) 
    526524  { 
     
    546544 
    547545    requests.push_back(MPI_Request()); 
    548     MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, MPI_UNSIGNED_LONG, recvRank, 46, client->intraComm, &requests.back()); 
     546    MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, MPI_UNSIGNED_LONG, recvRank, 46, context->intraComm_, &requests.back()); 
    549547    requests.push_back(MPI_Request()); 
    550     MPI_Irecv(recvMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 47, client->intraComm, &requests.back()); 
     548    MPI_Irecv(recvMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 47, context->intraComm_, &requests.back()); 
    551549  } 
    552550 
     
    584582    // Send global index source and mask 
    585583    requests.push_back(MPI_Request()); 
    586     MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, MPI_UNSIGNED_LONG, sendRank, 46, client->intraComm, &requests.back()); 
     584    MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, MPI_UNSIGNED_LONG, sendRank, 46, context->intraComm_, &requests.back()); 
    587585    requests.push_back(MPI_Request()); 
    588     MPI_Isend(sendMaskDst[sendRank], sendSize, MPI_UNSIGNED_CHAR, sendRank, 47, client->intraComm, &requests.back()); 
     586    MPI_Isend(sendMaskDst[sendRank], sendSize, MPI_UNSIGNED_CHAR, sendRank, 47, context->intraComm_, &requests.back()); 
    589587  } 
    590588 
     
    602600 
    603601    requests.push_back(MPI_Request()); 
    604     MPI_Irecv(sendMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests.back()); 
     602    MPI_Irecv(sendMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 48, context->intraComm_, &requests.back()); 
    605603  } 
    606604 
    607605  // Ok, now we fill in local index of grid source (we even count for masked index) 
    608   CDistributionClient distributionClientSrc(client->clientRank, gridSource_); 
     606  CDistributionClient distributionClientSrc(clientRank, gridSource_); 
    609607  CDistributionClient::GlobalLocalDataMap& globalLocalIndexGridSrcSendToServer = distributionClientSrc.getGlobalLocalDataSendToServer(); 
    610608  localIndexToSendFromGridSource_.push_back(SendingIndexGridSourceMap()); 
     
    639637    // Okie, now inform the destination which source index are masked 
    640638    requests.push_back(MPI_Request()); 
    641     MPI_Isend(recvMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests.back()); 
     639    MPI_Isend(recvMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 48, context->intraComm_, &requests.back()); 
    642640  } 
    643641  status.resize(requests.size()); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm_transformation.cpp

    r1622 r1784  
    6060{ 
    6161  CContext* context = CContext::getCurrent(); 
    62   CContextClient* client=context->client; 
    63   int clientRank = client->clientRank; 
    64   int clientSize = client->clientSize; 
     62  int clientRank = context->intraCommRank_; 
     63  int clientSize = context->intraCommSize_; 
    6564 
    6665  if (2 == elementSourceType) // Source is a domain 
     
    8483    } 
    8584 
    86     CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     85    CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_); 
    8786    dhtIndexProcRank.computeIndexInfoMapping(globalIndexElementSource); 
    8887    globalIndexElementSourceOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     
    106105    } 
    107106 
    108     CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     107    CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_); 
    109108    dhtIndexProcRank.computeIndexInfoMapping(globalIndexElementSource); 
    110109    globalIndexElementSourceOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     
    117116    globalIndex2ProcRank[globalIndex][0] = clientRank; 
    118117 
    119     CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     118    CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_); 
    120119    dhtIndexProcRank.computeIndexInfoMapping(globalIndexElementSource); 
    121120    globalIndexElementSourceOnProc = dhtIndexProcRank.getInfoIndexMap(); 
Note: See TracChangeset for help on using the changeset viewer.