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/domain.cpp

    r727 r731  
    102102   { 
    103103     return offsetWrittenIndexes_; 
     104   } 
     105 
     106   //---------------------------------------------------------------- 
     107 
     108   /*! 
     109    * Compute the minimum buffer size required to send the attributes to the server(s). 
     110    * 
     111    * \return A map associating the server rank with its minimum buffer size. 
     112    */ 
     113   std::map<int, StdSize> CDomain::getAttributesBufferSize() 
     114   { 
     115     CContextClient* client = CContext::getCurrent()->client; 
     116 
     117     std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(); 
     118 
     119     if (client->isServerLeader()) 
     120     { 
     121       // size estimation for sendServerAttribut 
     122       size_t size = 11 * sizeof(size_t); 
     123 
     124       const std::list<int>& ranks = client->getRanksServerLeader(); 
     125       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     126       { 
     127         if (size > attributesSizes[*itRank]) 
     128           attributesSizes[*itRank] = size; 
     129       } 
     130     } 
     131 
     132     std::map<int, std::vector<size_t> >::const_iterator it, ite = indSrv_.end(); 
     133     for (it = indSrv_.begin(); it != ite; ++it) 
     134     { 
     135       // 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()); 
     137       if (isCompressible_) 
     138         sizeIndexEvent += CArray<int,1>::size(indWrittenSrv_[it->first].size()); 
     139 
     140       // size estimation for sendLonLat 
     141       size_t sizeLonLatEvent = CArray<double,1>::size(it->second.size()); 
     142       if (hasBounds) 
     143         sizeLonLatEvent += CArray<double,2>::size(it->second.size()); 
     144 
     145       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; 
     148     } 
     149 
     150     return attributesSizes; 
    104151   } 
    105152 
Note: See TracChangeset for help on using the changeset viewer.