Ignore:
Timestamp:
10/13/15 15:14:23 (9 years ago)
Author:
rlacroix
Message:

Correctly estimate the needed buffer sizes.

The attributes were not considered which could lead to incorrect estimations.

File:
1 edited

Legend:

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

    r713 r731  
    116116   { 
    117117     return offsetWrittenIndexes_; 
     118   } 
     119 
     120   //---------------------------------------------------------------- 
     121 
     122   /*! 
     123    * Compute the minimum buffer size required to send the attributes to the server(s). 
     124    * 
     125    * \return A map associating the server rank with its minimum buffer size. 
     126    */ 
     127   std::map<int, StdSize> CAxis::getAttributesBufferSize() 
     128   { 
     129     CContextClient* client = CContext::getCurrent()->client; 
     130 
     131     std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(); 
     132 
     133     bool isNonDistributed = (n == n_glo); 
     134 
     135     if (client->isServerLeader()) 
     136     { 
     137       // size estimation for sendServerAttribut 
     138       size_t size = 6 * sizeof(size_t); 
     139       // size estimation for sendNonDistributedValue 
     140       if (isNonDistributed) 
     141         size = std::max(size, CArray<double,1>::size(n_glo) + (isCompressible_ ? CArray<int,1>::size(n_glo) : 0)); 
     142       size += CEventClient::headerSize + getId().size() + sizeof(size_t); 
     143 
     144       const std::list<int>& ranks = client->getRanksServerLeader(); 
     145       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     146       { 
     147         if (size > attributesSizes[*itRank]) 
     148           attributesSizes[*itRank] = size; 
     149       } 
     150     } 
     151 
     152     if (!isNonDistributed) 
     153     { 
     154       // size estimation for sendDistributedValue 
     155       std::map<int, std::vector<size_t> >::const_iterator it, ite = indSrv_.end(); 
     156       for (it = indSrv_.begin(); it != ite; ++it) 
     157       { 
     158         size_t sizeIndexEvent = CArray<int,1>::size(it->second.size()); 
     159         if (isCompressible_) 
     160           sizeIndexEvent += CArray<int,1>::size(indWrittenSrv_[it->first].size()); 
     161 
     162         size_t sizeValEvent = CArray<double,1>::size(it->second.size()); 
     163         if (hasBounds_) 
     164           sizeValEvent += CArray<double,2>::size(it->second.size()); 
     165 
     166         size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeValEvent); 
     167         if (size > attributesSizes[it->first]) 
     168           attributesSizes[it->first] = size; 
     169       } 
     170     } 
     171 
     172     return attributesSizes; 
    118173   } 
    119174 
Note: See TracChangeset for help on using the changeset viewer.