More robust NMC_NUM_THREADS parsing (#198)
fixes #197 * Add functions that can find thread affinity and the number of available cores on linux systems via `sched_getaffinity`. * On other systems they default to "unknown affinity" and return 0 to indicate that the number of cores is unknown. * Set the default number of threads according to the new functions above if no environment variable explicitly setting the number of threads is set. * Validate environment variable value against regex and range check; terminate if improper. * Terminate if no number of threads is provided and the library is unable to determine a sensible number automatically.
Showing
- src/CMakeLists.txt 1 addition, 0 deletionssrc/CMakeLists.txt
- src/threading/affinity.cpp 60 additions, 0 deletionssrc/threading/affinity.cpp
- src/threading/affinity.hpp 29 additions, 0 deletionssrc/threading/affinity.hpp
- src/threading/cthread.cpp 37 additions, 38 deletionssrc/threading/cthread.cpp
Please register or sign in to comment