Changeset 1294


Ignore:
Timestamp:
10/06/17 13:41:57 (7 years ago)
Author:
oabramkina
Message:

Improvements for the secondary server: each grid is only sent to secondary-server pools that need it.

Location:
XIOS/dev/XIOS_DEV_CMIP6/src/node
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp

    r1292 r1294  
    951951     { 
    952952        if (!instantDataFilter) 
     953//          instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false, 
     954//                                                                                                      detectMissingValues, defaultValue)); 
    953955          instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,true)); 
    954956 
    955              // If the field data is to be read by the client or/and written to a file 
     957 
     958       // If the field data is to be read by the client or/and written to a file 
    956959       if (enableOutput && !storeFilter && !fileWriterFilter) 
    957960       { 
     
    966969     { 
    967970       if (!instantDataFilter) 
     971//         instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false, 
     972//                                                                                                     detectMissingValues, defaultValue)); 
    968973         instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true)); 
    969974 
     
    15021507   } 
    15031508 
     1509   void CField::setContextClient(CContextClient* contextClient) 
     1510   { 
     1511     client = contextClient; 
     1512     grid->setContextClient(contextClient); 
     1513   } 
     1514 
     1515   CContextClient* CField::getContextClient() 
     1516   { 
     1517     return client; 
     1518   } 
     1519 
    15041520   void CField::sendAddAllVariables(CContextClient* client) 
    15051521   { 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/field.hpp

    r1278 r1294  
    102102         std::map<int, StdSize> getGridAttributesBufferSize(CContextClient* client); 
    103103         std::map<int, StdSize> getGridDataBufferSize(CContextClient* client); // Grid data buffer size for each connection of contextclient 
     104 
     105         void setContextClient(CContextClient* newContextClient); 
     106         CContextClient* getContextClient(); 
    104107 
    105108       public: 
     
    236239 
    237240      private: 
     241         CContextClient* client; 
     242 
    238243         bool areAllReferenceSolved; 
    239244         bool isReferenceSolved; 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/file.cpp

    r1278 r1294  
    944944   { 
    945945     client = newContextClient; 
     946     size_t size = this->enabledFields.size(); 
     947     for (size_t i = 0; i < size; ++i) 
     948     { 
     949       this->enabledFields[i]->setContextClient(newContextClient); 
     950     } 
    946951   } 
    947952 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.cpp

    r1263 r1294  
    3636      , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 
    3737      , computedWrittenIndex_(false) 
     38      , clients() 
    3839   { 
    3940     setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); 
     
    5556      , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 
    5657      , computedWrittenIndex_(false) 
     58      , clients() 
    5759   { 
    5860     setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); 
     
    643645        }  
    644646      } 
    645  
    646647   } 
    647648 
     
    649650 
    650651   /* 
    651      Compute the global index and its local index on taking account of mask, data index. 
    652      These global index then will be used to compute the connection of this client to other clients in the different group 
     652     Compute the global index and its local index taking account mask and data index. 
     653     These global indexes will be used to compute the connection of this client (sender) to its servers (receivers) 
    653654     (via function computeConnectedClient) 
    654      These global index also corresponding to data sent to other clients (if any) 
     655     These global indexes also correspond to data sent to servers (if any) 
    655656   */ 
    656657   void CGrid::computeClientIndex() 
     
    13471348  { 
    13481349    CContext* context = CContext::getCurrent(); 
    1349     int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 
    13501350    storeIndex_toSrv.clear(); 
    1351  
    1352     for (int p = 0; p < nbSrvPools; ++p) 
    1353     { 
    1354       CContextClient* client = context->hasServer ? context->clientPrimServer[p] : context->client; 
     1351    std::set<CContextClient*>::iterator it; 
     1352 
     1353    for (it=clients.begin(); it!=clients.end(); ++it) 
     1354    { 
     1355      CContextClient* client = *it; 
    13551356      int receiverSize = client->serverSize; 
    13561357 
     
    14121413  { 
    14131414    CContext* context = CContext::getCurrent(); 
    1414     int nbSrvPools = (context->clientPrimServer.size() == 0) ? 1 : context->clientPrimServer.size(); 
    14151415    storeIndex_toSrv.clear(); 
    1416     for (int p = 0; p < nbSrvPools; ++p) 
    1417     { 
    1418       CContextClient* client = (context->clientPrimServer.size() == 0) ? context->client : context->clientPrimServer[p]; 
     1416    std::set<CContextClient*>::iterator it; 
     1417 
     1418    for (it=clients.begin(); it!=clients.end(); ++it) 
     1419    { 
     1420      CContextClient* client = *it; 
    14191421      int receiverSize = client->serverSize; 
    14201422 
     
    25022504  } 
    25032505 
     2506  void CGrid::setContextClient(CContextClient* contextClient) 
     2507  { 
     2508    clients.insert(contextClient); 
     2509  } 
     2510 
    25042511  /*! 
    25052512    Parse a grid, for now, it contains only domain, axis and scalar 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.hpp

    r1263 r1294  
    161161         void sendIndex(void); 
    162162         void sendIndexScalarGrid(); 
     163 
     164         void setContextClient(CContextClient* contextClient); 
    163165 
    164166         void computeDomConServer(); 
     
    215217         map<int, CArray<int, 1> > storeIndex_fromSrv; // Support, for now, reading with level-1 server 
    216218 
    217  
    218          map<int, CArray<size_t, 1> > outIndexFromClient, compressedOutIndexFromClient, outGlobalIndexFromClient; 
    219  
    220          // A client receives global index from other clients (via recvIndex) 
    221          // then does mapping these index into local index of STORE_CLIENTINDEX 
    222          // In this way, store_clientIndex can be used as an input of a source filter 
    223          // Maybe we need a flag to determine whether a client wants to write. TODO 
     219         map<int, CArray<size_t, 1> > outIndexFromClient;  // Deprecated 
     220 
     221         map<int, CArray<size_t, 1> > compressedOutIndexFromClient; 
     222 
     223/** Map storing received indexes. Key = sender rank, value = index array. */ 
     224         map<int, CArray<size_t, 1> > outGlobalIndexFromClient; 
     225 
     226// Manh Ha's comment: " A client receives global index from other clients (via recvIndex) 
     227// then does mapping these index into local index of STORE_CLIENTINDEX 
     228// In this way, store_clientIndex can be used as an input of a source filter 
     229// Maybe we need a flag to determine whether a client wants to write. TODO " 
     230 
     231/** Map storing received data. Key = sender rank, value = data array. 
     232 *  The map is created in CGrid::computeClientIndex and filled upon receiving data in CField::recvUpdateData() */ 
    224233         map<int, CArray<size_t, 1> > outLocalIndexStoreOnClient;  
    225234 
    226 /** Indexes calculated based on server distribution (serverDistribution_). They are used for writing data into a file. */ 
     235/** Indexes calculated based on server-like distribution. 
     236 *  They are used for writing/reading data and only calculated for server level that does the writing/reading. 
     237 *  Along with localIndexToWriteOnClient, these indexes are used to correctly place incoming data. */ 
    227238         CArray<size_t,1> localIndexToWriteOnServer; 
    228239 
    229 /** Indexes calculated based on client distribution (clientDistribution_). They are not used at all. 
    230     They should be the same as localIndexToWriteOnServer and potentially can be used as an additional check.*/ 
     240/** Indexes calculated based on client-like distribution. 
     241 *  They are used for writing/reading data and only calculated for server level that does the writing/reading. 
     242 *  Along with localIndexToWriteOnServer, these indexes are used to correctly place incoming data. */ 
    231243         CArray<size_t,1> localIndexToWriteOnClient; 
    232244 
    233245         CArray<size_t,1> indexFromClients; 
     246 
    234247         void checkMask(void); 
    235248         void createMask(void); 
     
    289302 
    290303      private: 
    291          bool isChecked; 
    292          bool isDomainAxisChecked; 
    293          bool isIndexSent; 
     304 
     305/** Clients that have to send a grid. There can be multiple clients in case of secondary server, otherwise only one client. */ 
     306        std::set<CContextClient*> clients; 
     307 
     308        bool isChecked; 
     309        bool isDomainAxisChecked; 
     310        bool isIndexSent; 
    294311 
    295312        CDomainGroup* vDomainGroup_; 
     
    299316        bool isAxisListSet, isDomListSet, isScalarListSet; 
    300317 
    301 /** Distribution calculated in computeClientIndex() based on the knowledge of the entire grid */ 
     318/** Client-like distribution calculated based on the knowledge of the entire grid */ 
    302319        CDistributionClient* clientDistribution_; 
    303320 
    304 /** Distribution calculated upon receiving indexes */ 
     321/** Server-like distribution calculated upon receiving indexes */ 
    305322        CDistributionServer* serverDistribution_; 
    306323 
     
    345362   void CGrid::inputField(const CArray<double,n>& field, CArray<double,1>& stored) const 
    346363   { 
     364//#ifdef __XIOS_DEBUG 
    347365      if (this->getDataSize() != field.numElements()) 
    348366         ERROR("void CGrid::inputField(const  CArray<double,n>& field, CArray<double,1>& stored) const", 
     
    351369                << "The data array does not have the right size! " 
    352370                << "Grid = " << this->GetName()) 
     371//#endif 
    353372      this->storeField_arr(field.dataFirst(), stored); 
    354373   } 
     
    357376   void CGrid::outputField(const CArray<double,1>& stored, CArray<double,n>& field) const 
    358377   { 
     378//#ifdef __XIOS_DEBUG 
    359379      if (this->getDataSize() != field.numElements()) 
    360380         ERROR("void CGrid::outputField(const CArray<double,1>& stored, CArray<double,n>& field) const", 
     
    363383                << "The ouput array does not have the right size! " 
    364384                << "Grid = " << this->GetName()) 
     385//#endif 
    365386      this->restoreField_arr(stored, field.dataFirst()); 
    366387   } 
Note: See TracChangeset for help on using the changeset viewer.