16 std::size_t result = 0;
17 const char* ttg_num_threads_cstr = std::getenv(
"TTG_NUM_THREADS");
18 if (ttg_num_threads_cstr) {
19 const auto result_long = std::atol(ttg_num_threads_cstr);
21 result =
static_cast<std::size_t
>(result_long);
23 throw std::runtime_error(
"ttg: invalid value of environment variable TTG_NUM_THREADS");
25 result = std::thread::hardware_concurrency();
27 if (result > std::numeric_limits<int>::max())
28 throw std::runtime_error(
"ttg: number of threads exceeds the maximum limit");
30 return static_cast<int>(result);
35 const char* ttg_force_device_comm_cstr = std::getenv(
"TTG_FORCE_DEVICE_COMM");
36 if (ttg_force_device_comm_cstr) {
37 const auto result_int = std::atoi(ttg_force_device_comm_cstr);
int num_threads()
Determine the number of compute threads to use by TTG when not given to ttg::initialize
top-level TTG namespace contains runtime-neutral functionality