Changeset 764


Ignore:
Timestamp:
10/26/15 17:05:07 (5 years ago)
Author:
rlacroix
Message:

Fix the buffer size estimation to avoid requests for unexpected buffers.

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

Legend:

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

    r763 r764  
    130130     } 
    131131 
    132      std::map<int, std::vector<size_t> >::const_iterator it, ite = indSrv_.end(); 
    133      for (it = indSrv_.begin(); it != ite; ++it) 
    134      { 
     132     std::map<int, std::vector<size_t> >::const_iterator itIndexEnd = indSrv_.end(); 
     133     std::map<int, std::vector<int> >::const_iterator itWrittenIndexEnd = indWrittenSrv_.end(); 
     134     for (size_t k = 0; k < connectedServerRank_.size(); ++k) 
     135     { 
     136       int rank = connectedServerRank_[k]; 
     137       std::map<int, std::vector<size_t> >::const_iterator it = indSrv_.find(rank); 
     138       size_t idxCount = (it != itIndexEnd) ? it->second.size() : 0; 
     139 
    135140       // size estimation for sendIndex (and sendArea which is always smaller or equal) 
    136        size_t sizeIndexEvent = 2 * sizeof(size_t) + 2 * CArray<int,1>::size(it->second.size()); 
     141       size_t sizeIndexEvent = 2 * sizeof(size_t) + 2 * CArray<int,1>::size(idxCount); 
    137142       if (isCompressible_) 
    138          sizeIndexEvent += CArray<int,1>::size(indWrittenSrv_[it->first].size()); 
     143       { 
     144         std::map<int, std::vector<int> >::const_iterator itWritten = indWrittenSrv_.find(rank); 
     145         size_t writtenIdxCount = (itWritten != itWrittenIndexEnd) ? itWritten->second.size() : 0; 
     146         sizeIndexEvent += CArray<int,1>::size(writtenIdxCount); 
     147       } 
    139148 
    140149       // size estimation for sendLonLat 
    141        size_t sizeLonLatEvent = CArray<double,1>::size(it->second.size()); 
     150       size_t sizeLonLatEvent = CArray<double,1>::size(idxCount); 
    142151       if (hasBounds) 
    143          sizeLonLatEvent += CArray<double,2>::size(nvertex * it->second.size()); 
     152         sizeLonLatEvent += CArray<double,2>::size(nvertex * idxCount); 
    144153 
    145154       size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeLonLatEvent); 
    146        if (size > attributesSizes[it->first]) 
    147          attributesSizes[it->first] = size; 
     155       if (size > attributesSizes[rank]) 
     156         attributesSizes[rank] = size; 
    148157     } 
    149158 
  • XIOS/trunk/src/node/grid.cpp

    r763 r764  
    143143     const size_t extraSize = CEventClient::headerSize + (id.empty() ? getId() : id).size() + 2 * sizeof(size_t); 
    144144 
    145      std::map<int, size_t>::const_iterator itb = connectedDataSize_.begin(), it, itE = connectedDataSize_.end(); 
    146      for (it = itb; it != itE; ++it) 
    147        dataSizes.insert(std::make_pair(it->first, extraSize + CArray<double,1>::size(it->second))); 
     145     std::map<int, size_t>::const_iterator itEnd = connectedDataSize_.end(); 
     146     for (size_t k = 0; k < connectedServerRank_.size(); ++k) 
     147     { 
     148       int rank = connectedServerRank_[k]; 
     149       std::map<int, size_t>::const_iterator it = connectedDataSize_.find(rank); 
     150       size_t count = (it != itEnd) ? it->second : 0; 
     151 
     152       dataSizes.insert(std::make_pair(rank, extraSize + CArray<double,1>::size(count))); 
     153     } 
    148154 
    149155     return dataSizes; 
Note: See TracChangeset for help on using the changeset viewer.