Changeset 1205 for XIOS/dev/branch_yushan_merged/src/node/context.cpp
- Timestamp:
- 07/10/17 18:17:04 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan_merged/src/node/context.cpp
r1160 r1205 14 14 #include "type.hpp" 15 15 #include "xios_spl.hpp" 16 #include "timer.hpp" 17 #include "memtrack.hpp" 18 16 19 17 20 namespace xios { … … 278 281 void CContext::setClientServerBuffer() 279 282 { 280 size_t minBufferSize = CXios::minBufferSize; 283 // Estimated minimum event size for small events (10 is an arbitrary constant just for safety) 284 const size_t minEventSize = CEventClient::headerSize + getIdServer().size() + 10 * sizeof(int); 285 // Ensure there is at least some room for 20 of such events in the buffers 286 size_t minBufferSize = std::max(CXios::minBufferSize, 20 * minEventSize); 281 287 #define DECLARE_NODE(Name_, name_) \ 282 288 if (minBufferSize < sizeof(C##Name_##Definition)) minBufferSize = sizeof(C##Name_##Definition); … … 286 292 #undef DECLARE_NODE_PAR 287 293 294 // Compute the buffer sizes needed to send the attributes and data corresponding to fields 288 295 std::map<int, StdSize> maxEventSize; 289 296 std::map<int, StdSize> bufferSize = getAttributesBufferSize(maxEventSize); … … 294 301 if (it->second > bufferSize[it->first]) bufferSize[it->first] = it->second; 295 302 303 // Apply the buffer size factor and check that we are above the minimum buffer size 296 304 ite = bufferSize.end(); 297 305 for (it = bufferSize.begin(); it != ite; ++it) … … 301 309 } 302 310 303 // We consider that the minimum buffer size is also the minimum event size 304 ite = maxEventSize.end(); 305 for (it = maxEventSize.begin(); it != ite; ++it) 306 if (it->second < minBufferSize) it->second = minBufferSize; 307 311 // Leaders will have to send some control events so ensure there is some room for those in the buffers 308 312 if (client->isServerLeader()) 309 313 { 310 314 const std::list<int>& ranks = client->getRanksServerLeader(); 311 315 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 312 if (!bufferSize.count(*itRank)) bufferSize[*itRank] = maxEventSize[*itRank] = minBufferSize; 316 { 317 if (!bufferSize.count(*itRank)) 318 { 319 bufferSize[*itRank] = minBufferSize; 320 maxEventSize[*itRank] = minEventSize; 321 } 322 } 313 323 } 314 324 … … 401 411 void CContext::closeDefinition(void) 402 412 { 413 CTimer::get("Context : close definition").resume() ; 403 414 // There is nothing client need to send to server 404 415 if (hasClient) … … 454 465 startPrefetchingOfEnabledReadModeFiles(); 455 466 } 467 CTimer::get("Context : close definition").suspend() ; 456 468 } 457 469 … … 1206 1218 void CContext::updateCalendar(int step) 1207 1219 { 1220 #pragma omp critical (_output) 1221 {info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl;} 1208 1222 calendar->update(step); 1209 1210 1223 #pragma omp critical (_output) 1224 {info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl;} 1225 #ifdef XIOS_MEMTRACK_LIGHT 1226 #pragma omp critical (_output) 1227 {info(50) << " Current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ;} 1228 #endif 1211 1229 if (hasClient) 1212 1230 { … … 1255 1273 CContext* context = CObjectFactory::CreateObject<CContext>(id).get(); 1256 1274 getRoot(); 1257 //if (!hasctxt) CGroupFactory::AddChild(root, context->getShared());1258 1275 if (!hasctxt) CGroupFactory::AddChild(*root_ptr, context->getShared()); 1259 1276
Note: See TracChangeset
for help on using the changeset viewer.