From 46cc347633e82520f60dd3d163bab878959a6516 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 2 Nov 2021 23:51:51 +0100 Subject: [PATCH] sched_getaffinity will not return all accessible cores with OMP_PROC_BIND --- driver/others/memory.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/driver/others/memory.c b/driver/others/memory.c index 0185fa683..477efd664 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -249,6 +249,10 @@ int get_num_procs(void) { #if !defined(OS_LINUX) return nums; #endif +#if defined(USE_OPENMP) + if (omp_get_proc_bind() != omp_proc_bind_false) + return nums; +#endif #if !defined(__GLIBC_PREREQ) return nums; @@ -1809,6 +1813,10 @@ int get_num_procs(void) { #if !defined(OS_LINUX) return nums; #endif +#if defined(USE_OPENMP) + if (omp_get_proc_bind() != omp_proc_bind_false) + return nums; +#endif #if !defined(__GLIBC_PREREQ) return nums;