Fix miscounting of threadpool size on Linux with OMP_PROC_BIND=TRUE (#3437)

*  return OMP places (if available, or SC_NPROCESSORS_CONF) for maximum thread count when built with OpenMP
This commit is contained in:
Martin Kroeker 2021-11-04 12:11:16 +01:00 committed by GitHub
parent abf45f7235
commit efb16fafb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions

View File

@ -246,6 +246,14 @@ int get_num_procs(void) {
#endif
if (!nums) nums = sysconf(_SC_NPROCESSORS_CONF);
#if defined(USE_OPENMP)
#if _OPENMP >= 201511
nums = omp_get_num_places();
#endif
return nums;
#endif
#if !defined(OS_LINUX)
return nums;
#endif
@ -1806,10 +1814,19 @@ int get_num_procs(void) {
#endif
if (!nums) nums = sysconf(_SC_NPROCESSORS_CONF);
#if defined(USE_OPENMP)
/* if (omp_get_proc_bind() != omp_proc_bind_false) */
#if _OPENMP >= 201511
nums = omp_get_num_places();
#endif
return nums;
#endif
#if !defined(OS_LINUX)
return nums;
#endif
#if !defined(__GLIBC_PREREQ)
return nums;
#else