Setup I/O thread pool that is shared across all models
| 363 | |
| 364 | // Setup I/O thread pool that is shared across all models |
| 365 | std::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 | |
| 401 | std::unique_ptr<model> build_model_from_prototext( |
| 402 | int argc, |
no test coverage detected