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.

File:
1 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; 
Note: See TracChangeset for help on using the changeset viewer.