Changeset 927 for XIOS/trunk/src


Ignore:
Timestamp:
09/08/16 11:18:51 (8 years ago)
Author:
rlacroix
Message:

Fix: Ensure that the buffer sizes needed to send the axis attributes are evaluated before actually sending any data.

This should avoid unexpected buffer requests (which would not cause any real issue most of the times since XIOS tries to recover from those).

Location:
XIOS/trunk/src/node
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/axis.cpp

    r906 r927  
    2424      : CObjectTemplate<CAxis>() 
    2525      , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) 
     26      , isClientAfterTransformationChecked(false) 
    2627      , isDistributed_(false), hasBounds_(false), isCompressible_(false) 
    2728      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
     
    3334      : CObjectTemplate<CAxis>(id) 
    3435      , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) 
     36      , isClientAfterTransformationChecked(false) 
    3537      , isDistributed_(false), hasBounds_(false), isCompressible_(false) 
    3638      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
     
    362364   } 
    363365 
     366   void CAxis::checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid, 
     367                                                          CServerDistributionDescription::ServerDistributionType distType) 
     368   { 
     369     CContext* context=CContext::getCurrent() ; 
     370 
     371     if (this->isClientAfterTransformationChecked) return; 
     372     if (context->hasClient) 
     373     { 
     374       if (n.getValue() != n_glo.getValue()) computeConnectedServer(globalDim, orderPositionInGrid, distType); 
     375     } 
     376 
     377     this->isClientAfterTransformationChecked = true; 
     378   } 
     379 
    364380   // Send all checked attributes to server 
    365381   void CAxis::sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 
     
    367383   { 
    368384     if (!this->areClientAttributesChecked_) checkAttributesOnClient(); 
     385     if (!this->isClientAfterTransformationChecked) checkAttributesOnClientAfterTransformation(globalDim, orderPositionInGrid, distType); 
    369386     CContext* context = CContext::getCurrent(); 
    370387 
     
    373390     { 
    374391       sendServerAttribut(globalDim, orderPositionInGrid, distType); 
    375        if (hasValue) sendValue(globalDim, orderPositionInGrid, distType); 
     392       if (hasValue) sendValue(); 
    376393     } 
    377394 
     
    379396   } 
    380397 
    381   void CAxis::sendValue(const std::vector<int>& globalDim, int orderPositionInGrid, 
    382                         CServerDistributionDescription::ServerDistributionType distType) 
     398  void CAxis::sendValue() 
    383399  { 
    384400     if (n.getValue() == n_glo.getValue()) 
    385      { 
    386401       sendNonDistributedValue(); 
    387      } 
    388402     else 
    389      { 
    390        computeConnectedServer(globalDim, orderPositionInGrid, distType); 
    391403       sendDistributedValue(); 
    392      } 
    393404  } 
    394405 
  • XIOS/trunk/src/node/axis.hpp

    r836 r927  
    104104         void recvServerAttribut(CBufferIn& buffer) ; 
    105105         void checkAttributesOnClient(); 
     106         void checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid, 
     107                                                         CServerDistributionDescription::ServerDistributionType distType = CServerDistributionDescription::BAND_DISTRIBUTION); 
    106108         void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 
    107109                                    CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); 
     
    129131         void checkBounds(); 
    130132         void checkTransformations(); 
    131          void computeServerIndex(const std::vector<int>& globalDim, int orderPositionInGrid, 
    132                                  CServerDistributionDescription::ServerDistributionType disType); 
    133          void sendValue(const std::vector<int>& globalDim, int orderPositionInGrid, 
    134                         CServerDistributionDescription::ServerDistributionType distType); 
     133         void sendValue(); 
    135134         void computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid, 
    136135                                     CServerDistributionDescription::ServerDistributionType distType); 
     
    150149         bool isChecked; 
    151150         bool areClientAttributesChecked_; 
     151         bool isClientAfterTransformationChecked; 
    152152         std::set<StdString> relFiles, relFilesCompressed; 
    153153         TransMapTypes transformationMap_; 
  • XIOS/trunk/src/node/grid.cpp

    r926 r927  
    166166   void CGrid::checkAttributesAfterTransformation() 
    167167   { 
    168      setDomainList(); 
    169      std::vector<CDomain*> domListP = this->getDomains(); 
    170      if (!domListP.empty()) 
    171      { 
    172        for (int i = 0; i < domListP.size(); ++i) 
    173        { 
    174          domListP[i]->checkAttributesOnClientAfterTransformation(); 
    175        } 
    176      } 
     168      setAxisList(); 
     169      std::vector<CAxis*> axisListP = this->getAxis(); 
     170      if (!axisListP.empty()) 
     171      { 
     172        int idx = 0; 
     173        axisPositionInGrid_.resize(0); 
     174        for (int i = 0; i < axis_domain_order.numElements(); ++i) 
     175        { 
     176          int elementDimension = axis_domain_order(i); 
     177          if (1 == elementDimension) 
     178          { 
     179            axisPositionInGrid_.push_back(idx); 
     180            ++idx; 
     181          } 
     182          else if (2 == elementDimension) idx += 2; 
     183        } 
     184 
     185        for (int i = 0; i < axisListP.size(); ++i) 
     186        { 
     187          axisListP[i]->checkAttributesOnClientAfterTransformation(globalDim_,axisPositionInGrid_[i]); 
     188        } 
     189      } 
     190 
     191      setDomainList(); 
     192      std::vector<CDomain*> domListP = this->getDomains(); 
     193      if (!domListP.empty()) 
     194      { 
     195        for (int i = 0; i < domListP.size(); ++i) 
     196        { 
     197          domListP[i]->checkAttributesOnClientAfterTransformation(); 
     198        } 
     199      } 
    177200   } 
    178201 
Note: See TracChangeset for help on using the changeset viewer.