MCPcopy Create free account
hub / github.com/LBANN/lbann / construct_io_thread_pool

Function construct_io_thread_pool

src/utils/lbann_library.cpp:365–399  ·  view source on GitHub ↗

Setup I/O thread pool that is shared across all models

Source from the content-addressed store, hash-verified

363
364// Setup I/O thread pool that is shared across all models
365std::unique_ptr<thread_pool> construct_io_thread_pool(lbann_comm* comm,
366 bool serialized_io)
367{
368 int max_io_threads = num_free_cores_per_process(comm);
369 // Allow the trainer to override the command-line option or environment
370 // variable
371 if (serialized_io) {
372 max_io_threads = 1;
373 }
374
375 auto& arg_parser = global_argument_parser();
376 int req_io_threads = arg_parser.get<int>(LBANN_OPTION_NUM_IO_THREADS);
377 int max_io_rng_banks = arg_parser.get<int>(LBANN_OPTION_MAX_IO_RNG_BANKS);
378 // Limit the number of I/O threads to:
379 // < number of available free cores per process
380 // < number of RNG banks provisioned
381 // and at least one
382 int num_io_threads = std::max(
383 std::min(max_io_rng_banks, std::min(max_io_threads, req_io_threads)),
384 1);
385
386 auto io_threads_offset = free_core_offset(comm);
387
388 if (comm->am_world_master()) {
389 std::cout << "\tNum. I/O Threads: " << num_io_threads
390 << " (Limited to # Unused Compute Cores [" << max_io_threads
391 << "] # of RNG banks [" << max_io_rng_banks
392 << "] or 1) at offset " << io_threads_offset << std::endl;
393 }
394
395 auto io_thread_pool = std::make_unique<thread_pool>();
396 io_thread_pool->launch_pinned_threads(num_io_threads, io_threads_offset);
397
398 return io_thread_pool;
399}
400
401std::unique_ptr<model> build_model_from_prototext(
402 int argc,

Callers 3

lbann_library.cppFile · 0.85
do_preload_data_storeMethod · 0.85
do_preload_data_storeMethod · 0.85

Calls 6

free_core_offsetFunction · 0.85
am_world_masterMethod · 0.80
launch_pinned_threadsMethod · 0.80
maxFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected