6 #include "cetlib/HorizontalRule.h" 8 #include "tbb/global_control.h" 17 adjust_num_threads(
unsigned const specified_num_threads)
19 char const* p = std::getenv(
"OMP_NUM_THREADS");
21 return specified_num_threads;
24 auto const max_threads = std::stoul(p);
25 if (specified_num_threads == 0) {
28 if (specified_num_threads <= max_threads) {
29 return specified_num_threads;
32 cet::HorizontalRule
const rule{80};
35 <<
"The specified number of threads (" << specified_num_threads
36 <<
") exceeds the allowed number (" << max_threads <<
").\n" 37 <<
"The allowed number of threads (" << max_threads
38 <<
") will be used for this job.\n" 43 constexpr
auto max_parallelism = tbb::global_control::max_allowed_parallelism;
44 constexpr
auto thread_stack_size = tbb::global_control::thread_stack_size;
50 : actionTable_{ps().actionTable()}
65 std::unique_ptr<GlobalTaskGroup>
68 using tbb::global_control;
69 auto value_of = [](
auto const field) {
70 return global_control::active_value(field);
74 <<
"TBB has been configured to use:\n" 75 <<
" - a maximum of " << value_of(max_parallelism) <<
" threads\n" 76 <<
" - a stack size of " << value_of(thread_stack_size) <<
" bytes";
std::unique_ptr< GlobalTaskGroup > global_task_group()
unsigned num_threads() const noexcept
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::string const dataDependencyGraph_
bool const errorOnMissingConsumes_
unsigned const stackSize_
unsigned const nSchedules_
bool const handleEmptySubRuns_
bool const handleEmptyRuns_
static Globals * instance()
MaybeLogger_< ELseverityLevel::ELsev_severe, true > LogAbsolute