Changeset 1371 for XIOS


Ignore:
Timestamp:
12/12/17 14:09:06 (6 years ago)
Author:
oabramkina
Message:

Fixing a bug in buffer evaluation: previously axis attributes were not evaluated correctly.

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

Legend:

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

    r1353 r1371  
    155155    * \return A map associating the server rank with its minimum buffer size. 
    156156    */ 
    157    std::map<int, StdSize> CAxis::getAttributesBufferSize(CContextClient* client, bool bufferForWriting /*= false*/) 
     157   std::map<int, StdSize> CAxis::getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, 
     158                                                         CServerDistributionDescription::ServerDistributionType distType) 
    158159   { 
    159160 
    160161     std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(client); 
    161162 
    162      bool isNonDistributed = (n = n_glo);      
     163//     bool isNonDistributed = (n_glo == n); 
     164     bool isDistributed = (orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType)) 
     165                                 || (index.numElements() != n_glo); 
    163166 
    164167     if (client->isServerLeader()) 
     
    167170       size_t size = 6 * sizeof(size_t); 
    168171       // size estimation for sendNonDistributedValue 
    169        if (isNonDistributed) 
    170          size = std::max(size, CArray<double,1>::size(n_glo) + (isCompressible_ ? CArray<int,1>::size(n_glo) : 0)); 
     172       if (!isDistributed) 
     173       { 
     174//         size = std::max(size, CArray<double,1>::size(n_glo) + (isCompressible_ ? CArray<int,1>::size(n_glo) : 0)); 
     175         size += CArray<int,1>::size(n_glo); 
     176         size += CArray<int,1>::size(n_glo); 
     177         size += CArray<bool,1>::size(n_glo); 
     178         size += CArray<double,1>::size(n_glo); 
     179         if (hasBounds) 
     180           size += CArray<double,2>::size(2*n_glo); 
     181         if (hasLabel) 
     182          size += CArray<StdString,1>::size(n_glo); 
     183       } 
    171184       size += CEventClient::headerSize + getId().size() + sizeof(size_t); 
    172185 
     
    177190           attributesSizes[*itRank] = size; 
    178191       } 
     192       const std::list<int>& ranksNonLeaders = client->getRanksServerNotLeader(); 
     193       for (std::list<int>::const_iterator itRank = ranksNonLeaders.begin(), itRankEnd = ranksNonLeaders.end(); itRank != itRankEnd; ++itRank) 
     194       { 
     195         if (size > attributesSizes[*itRank]) 
     196           attributesSizes[*itRank] = size; 
     197       } 
     198 
    179199     } 
    180200 
    181      if (!isNonDistributed) 
     201     if (isDistributed) 
    182202     { 
    183203       // size estimation for sendDistributedValue 
     
    185205       for (it = indSrv_[client->serverSize].begin(); it != ite; ++it) 
    186206       { 
    187          size_t sizeIndexEvent = CArray<int,1>::size(it->second.size()); 
    188          // if (isCompressible_) 
    189          //   sizeIndexEvent += CArray<int,1>::size(indWrittenSrv_[it->first].size()); 
    190  
    191          size_t sizeValEvent = CArray<double,1>::size(it->second.size()); 
     207         size_t size = 6 * sizeof(size_t); 
     208         size += CArray<int,1>::size(it->second.size()); 
     209         size += CArray<int,1>::size(it->second.size()); 
     210         size += CArray<bool,1>::size(it->second.size()); 
     211         size += CArray<double,1>::size(it->second.size()); 
    192212         if (hasBounds) 
    193            sizeValEvent += CArray<double,2>::size(2 * it->second.size()); 
    194   
     213           size += CArray<double,2>::size(2 * it->second.size()); 
    195214         if (hasLabel) 
    196            sizeValEvent += CArray<StdString,1>::size(it->second.size()); 
    197  
    198          size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeValEvent); 
     215           size += CArray<StdString,1>::size(it->second.size()); 
     216 
     217         size += CEventClient::headerSize + getId().size() + sizeof(size_t); 
    199218         if (size > attributesSizes[it->first]) 
    200219           attributesSizes[it->first] = size; 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.hpp

    r1353 r1371  
    7474         CArray<int, 1>& getCompressedIndexToWriteOnServer(MPI_Comm writtenCom); 
    7575 
    76          std::map<int, StdSize> getAttributesBufferSize(CContextClient* client, bool bufferForWriting = false); 
     76         std::map<int, StdSize> getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, 
     77                                                        CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); 
    7778 
    7879         /// Test /// 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.cpp

    r1353 r1371  
    111111     // The grid indexes require a similar size as the actual data 
    112112     std::map<int, StdSize> dataSizes = getDataBufferSize(client, "", bufferForWriting); 
    113      // for (size_t i = 0; i < dataSizes.size(); ++i) 
    114      // { 
    115        std::map<int, StdSize>::iterator it, itE = dataSizes.end(); 
    116        for (it = dataSizes.begin(); it != itE; ++it) 
    117        { 
    118          it->second += 2 * sizeof(bool); 
    119          if (it->second > attributesSizes[it->first]) 
    120            attributesSizes[it->first] = it->second; 
    121        } 
    122      // } 
    123  
     113     std::map<int, StdSize>::iterator it, itE = dataSizes.end(); 
     114     for (it = dataSizes.begin(); it != itE; ++it) 
     115     { 
     116       it->second += 2 * sizeof(bool); 
     117       if (it->second > attributesSizes[it->first]) 
     118         attributesSizes[it->first] = it->second; 
     119     } 
    124120      
    125121     // Account for the axis attributes 
     
    127123     for (size_t i = 0; i < axisList.size(); ++i) 
    128124     { 
    129        std::map<int, StdSize> axisAttBuffSize = axisList[i]->getAttributesBufferSize(client);        
     125       std::map<int, StdSize> axisAttBuffSize = axisList[i]->getAttributesBufferSize(client, getGlobalDimension(),axisPositionInGrid_[i]); 
    130126       for (it = axisAttBuffSize.begin(), itE = axisAttBuffSize.end(); it != itE; ++it) 
    131127       { 
     128         it->second += 2 * sizeof(bool); 
    132129         if (it->second > attributesSizes[it->first]) 
    133130           attributesSizes[it->first] = it->second; 
     
    142139       for (it = domAttBuffSize.begin(), itE = domAttBuffSize.end(); it != itE; ++it) 
    143140       { 
     141         it->second += 2 * sizeof(bool); 
    144142         if (it->second > attributesSizes[it->first]) 
    145143           attributesSizes[it->first] = it->second; 
Note: See TracChangeset for help on using the changeset viewer.