Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 4, 2021
19 changes: 18 additions & 1 deletion driver/others/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down