Changeset 1200
- Timestamp:
- 07/07/17 15:52:44 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/context.cpp
r1191 r1200 268 268 void CContext::setClientServerBuffer() 269 269 { 270 size_t minBufferSize = CXios::minBufferSize; 270 // Estimated minimum event size for small events (10 is an arbitrary constant just for safety) 271 const size_t minEventSize = CEventClient::headerSize + getIdServer().size() + 10 * sizeof(int); 272 // Ensure there is at least some room for 20 of such events in the buffers 273 size_t minBufferSize = std::max(CXios::minBufferSize, 20 * minEventSize); 271 274 #define DECLARE_NODE(Name_, name_) \ 272 275 if (minBufferSize < sizeof(C##Name_##Definition)) minBufferSize = sizeof(C##Name_##Definition); … … 276 279 #undef DECLARE_NODE_PAR 277 280 281 // Compute the buffer sizes needed to send the attributes and data corresponding to fields 278 282 std::map<int, StdSize> maxEventSize; 279 283 std::map<int, StdSize> bufferSize = getAttributesBufferSize(maxEventSize); … … 284 288 if (it->second > bufferSize[it->first]) bufferSize[it->first] = it->second; 285 289 290 // Apply the buffer size factor and check that we are above the minimum buffer size 286 291 ite = bufferSize.end(); 287 292 for (it = bufferSize.begin(); it != ite; ++it) … … 289 294 it->second *= CXios::bufferSizeFactor; 290 295 if (it->second < minBufferSize) it->second = minBufferSize; 296 } 297 298 // Leaders will have to send some control events so ensure there is some room for those in the buffers 299 if (client->isServerLeader()) 300 { 301 const std::list<int>& ranks = client->getRanksServerLeader(); 302 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 303 { 304 if (!bufferSize.count(*itRank)) 305 { 306 bufferSize[*itRank] = minBufferSize; 307 maxEventSize[*itRank] = minEventSize; 308 } 309 } 291 310 } 292 311
Note: See TracChangeset
for help on using the changeset viewer.