Changeset 1201 for XIOS/dev/dev_olga/src/node/context.cpp
- Timestamp:
- 07/07/17 18:17:49 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/context.cpp
r1194 r1201 291 291 void CContext::setClientServerBuffer(CContextClient* contextClient) 292 292 { 293 size_t minBufferSize = CXios::minBufferSize; 293 // Estimated minimum event size for small events (10 is an arbitrary constant just for safety) 294 const size_t minEventSize = CEventClient::headerSize + getIdServer().size() + 10 * sizeof(int); 295 296 // Ensure there is at least some room for 20 of such events in the buffers 297 size_t minBufferSize = std::max(CXios::minBufferSize, 20 * minEventSize); 298 294 299 #define DECLARE_NODE(Name_, name_) \ 295 300 if (minBufferSize < sizeof(C##Name_##Definition)) minBufferSize = sizeof(C##Name_##Definition); … … 299 304 #undef DECLARE_NODE_PAR 300 305 306 // Compute the buffer sizes needed to send the attributes and data corresponding to fields 301 307 std::map<int, StdSize> maxEventSize; 302 308 std::map<int, StdSize> bufferSize = getAttributesBufferSize(maxEventSize, contextClient); … … 307 313 if (it->second > bufferSize[it->first]) bufferSize[it->first] = it->second; 308 314 315 // Apply the buffer size factor and check that we are above the minimum buffer size 309 316 ite = bufferSize.end(); 310 317 for (it = bufferSize.begin(); it != ite; ++it) … … 314 321 } 315 322 316 // We consider that the minimum buffer size is also the minimum event size 317 ite = maxEventSize.end(); 318 for (it = maxEventSize.begin(); it != ite; ++it) 319 if (it->second < minBufferSize) it->second = minBufferSize; 320 323 // Leaders will have to send some control events so ensure there is some room for those in the buffers 321 324 if (contextClient->isServerLeader()) 322 325 { 323 326 const std::list<int>& ranks = contextClient->getRanksServerLeader(); 324 327 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 325 if (!bufferSize.count(*itRank)) bufferSize[*itRank] = maxEventSize[*itRank] = minBufferSize; 328 { 329 if (!bufferSize.count(*itRank)) 330 { 331 bufferSize[*itRank] = minBufferSize; 332 maxEventSize[*itRank] = minEventSize; 333 } 334 } 326 335 } 327 336 contextClient->setBufferSize(bufferSize, maxEventSize);
Note: See TracChangeset
for help on using the changeset viewer.