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

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