Browse Source

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
tags/v0.3.19
Martin Kroeker GitHub 4 years ago
parent
commit
efb16fafb0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions
  1. +18
    -1
      driver/others/memory.c

+ 18
- 1
driver/others/memory.c 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


Loading…
Cancel
Save