Changeset 1258


Ignore:
Timestamp:
09/11/17 17:02:48 (7 years ago)
Author:
ymipsl
Message:

Fix problem of axis distribution. When a grid is composed of a distributed axis and an non distributed axis on client side , on server side the first axis will be non distributed and second axis will be distributed. In this case, attributes (value, bounds, etc) was not sent in correct distribution.

YM

Location:
XIOS/dev/XIOS_DEV_CMIP6/src
Files:
3 edited

Legend:

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

    r1249 r1258  
    453453     if (context->hasClient) 
    454454     {         
    455        if ((orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType)) 
    456          || (index.numElements() != n_glo)) 
    457           computeConnectedClients(globalDim, orderPositionInGrid, distType); 
     455       if (orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType)) 
     456         computeConnectedClients(globalDim, orderPositionInGrid, distType); 
     457       else if (index.numElements() != n_glo) computeConnectedClients(globalDim, orderPositionInGrid,  CServerDistributionDescription::ROOT_DISTRIBUTION); 
    458458     } 
    459459 
     
    589589 
    590590      // Describe the distribution of server side 
    591       CServerDistributionDescription serverDescription(nGlobAxis, nbServer); 
     591 
     592      CServerDistributionDescription serverDescription(nGlobAxis, nbServer, distType); 
     593       
    592594      std::vector<int> serverZeroIndex; 
    593595      serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 0);       
     
    606608 
    607609      indSrv_[client].swap(globalIndexAxisOnServer); 
     610 
     611      if (distType==CServerDistributionDescription::ROOT_DISTRIBUTION) 
     612      { 
     613        for(int i=1; i<nbServer; ++i) indSrv_[client].insert(pair<int, vector<size_t> >(i,indSrv_[client][0]) ) ; 
     614        serverZeroIndexLeader.clear() ; 
     615      } 
     616          
    608617      CClientServerMapping::GlobalIndexMap::const_iterator it  = indSrv_[client].begin(), 
    609618                                                           ite = indSrv_[client].end(); 
    610        
    611       for (it = indSrv_[client].begin(); it != ite; ++it) { 
    612         connectedServerRank_[client].push_back(it->first); 
    613       } 
     619 
     620      for (it = indSrv_[client].begin(); it != ite; ++it) connectedServerRank_[client].push_back(it->first); 
    614621 
    615622      for (std::list<int>::const_iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) 
  • XIOS/dev/XIOS_DEV_CMIP6/src/server_distribution_description.cpp

    r1235 r1258  
    117117{ 
    118118  int nBand  = 0; 
    119   switch (serverType_) { 
     119  switch (serverType_) 
     120  { 
    120121    case BAND_DISTRIBUTION: 
    121122      nBand = computeBandDistribution(nServer_, positionDimensionDistributed); 
    122123      break; 
     124    case ROOT_DISTRIBUTION: 
     125      nBand = computeRootDistribution(nServer_); 
    123126    default: 
    124127      break; 
     
    397400} 
    398401 
     402 
     403/*! 
     404  Compute global index of servers with root distribution : only root server will received data 
     405  \param [in] nServer number of server 
     406*/ 
     407int CServerDistributionDescription::computeRootDistribution(int nServer, int positionDimensionDistributed) 
     408{ 
     409  int dim = nGlobal_.size(); 
     410  positionDimensionDistributed_ = positionDimensionDistributed; 
     411  if (1 == dim) positionDimensionDistributed_ = 0; 
     412  if (positionDimensionDistributed_ > dim) 
     413    ERROR("CServerDistributionDescription::computeBandDistribution(int nServer, int positionDimensionDistributed)", 
     414          << "Position of distributed dimension is invalid" << std::endl 
     415          << "Position of distributed dimension is " << positionDimensionDistributed_ 
     416          << "Dimension " << dim) 
     417 
     418  indexBegin_.resize(nServer); 
     419  dimensionSizes_.resize(nServer); 
     420 
     421  for (int i = 0; i< nServer; ++i) 
     422  { 
     423    indexBegin_[i].resize(dim); 
     424    dimensionSizes_[i].resize(dim); 
     425  } 
     426 
     427  int nGlobTemp = 0; 
     428 
     429  int positionDistributed = (1<dim) ? positionDimensionDistributed_ : 0; 
     430  nGlobTemp = nGlobal_[positionDistributed]; 
     431  int nbBand = 1 ; 
     432 
     433 
     434  for (int i = 0; i < nServer; ++i) 
     435  { 
     436    for (int j = 0; j < dim; ++j) 
     437    { 
     438      if (positionDistributed != j) // bad coding, need to be rewrite 
     439      { 
     440        if (1 == dim) 
     441        { 
     442          if (i==0) 
     443          { 
     444            indexBegin_[i][j] = 0; 
     445            dimensionSizes_[i][j] = nGlobTemp; 
     446          } 
     447          else 
     448          { 
     449            indexBegin_[i][j] = nGlobTemp-1; 
     450            dimensionSizes_[i][j] = 0; 
     451          } 
     452        } 
     453        else 
     454        { 
     455          indexBegin_[i][j] = 0; 
     456          dimensionSizes_[i][j] = nGlobal_[j]; 
     457        } 
     458      } 
     459      else 
     460      { 
     461        if (i==0) 
     462        { 
     463          indexBegin_[i][j] = 0; 
     464          dimensionSizes_[i][j] = nGlobTemp; 
     465        } 
     466        else 
     467        { 
     468          indexBegin_[i][j] = nGlobTemp-1; 
     469          dimensionSizes_[i][j] = 0; 
     470        } 
     471      } 
     472    } 
     473  } 
     474 
     475  return nbBand; 
     476} 
     477 
     478 
     479 
     480 
    399481/*! 
    400482  Get size of each dimension on distributed server 
  • XIOS/dev/XIOS_DEV_CMIP6/src/server_distribution_description.hpp

    r1235 r1258  
    2626    enum ServerDistributionType 
    2727    { 
    28       BAND_DISTRIBUTION, PLAN_DISTRIBUTION 
     28      BAND_DISTRIBUTION, PLAN_DISTRIBUTION, ROOT_DISTRIBUTION 
    2929    }; 
    3030 
     
    5656  protected: 
    5757    int computeBandDistribution(int nServer, int positionDimensionDistributed = 1); 
     58    int computeRootDistribution(int nServer, int positionDimensionDistributed = 1); 
    5859    void computePlanDistribution(int nServer); 
    5960    void computeRangeProcIndex(int clientRank, 
Note: See TracChangeset for help on using the changeset viewer.