From ff1da01476340b6e80e082f25ab4cfb9e5d25ec8 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Thu, 13 Oct 2016 12:37:50 +0000 Subject: [PATCH] USE NPROCESSOR_CONF instaed of NPORCESSOR_ONLN to determine the number of CPU. In ARM platform, online CPU will increasing when there is more workload. while configure cpu is the max number of CPU. --- driver/others/init.c | 4 ++-- driver/others/memory.c | 4 ++-- getarch.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/driver/others/init.c b/driver/others/init.c index 801f93991..9be6f52b0 100644 --- a/driver/others/init.c +++ b/driver/others/init.c @@ -814,7 +814,7 @@ void gotoblas_affinity_init(void) { #endif //returns the number of processors which are currently online - common -> num_procs = sysconf(_SC_NPROCESSORS_ONLN);; + common -> num_procs = sysconf(_SC_NPROCESSORS_CONF);; if(common -> num_procs > MAX_CPUS) { fprintf(stderr, "\nOpenBLAS Warining : The number of CPU/Cores(%d) is beyond the limit(%d). Terminated.\n", common->num_procs, MAX_CPUS); @@ -923,7 +923,7 @@ void gotoblas_set_affinity2(int threads) {}; void gotoblas_affinity_reschedule(void) {}; -int get_num_procs(void) { return sysconf(_SC_NPROCESSORS_ONLN); } +int get_num_procs(void) { return sysconf(_SC_NPROCESSORS_CONF); } int get_num_nodes(void) { return 1; } diff --git a/driver/others/memory.c b/driver/others/memory.c index e89f5c328..ba1941dbd 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -175,7 +175,7 @@ int get_num_procs(void); #else int get_num_procs(void) { static int nums = 0; - if (!nums) nums = sysconf(_SC_NPROCESSORS_ONLN); + if (!nums) nums = sysconf(_SC_NPROCESSORS_CONF); return nums; } #endif @@ -184,7 +184,7 @@ int get_num_procs(void) { #ifdef OS_ANDROID int get_num_procs(void) { static int nums = 0; - if (!nums) nums = sysconf(_SC_NPROCESSORS_ONLN); + if (!nums) nums = sysconf(_SC_NPROCESSORS_CONF); return nums; } #endif diff --git a/getarch.c b/getarch.c index f8069e507..0c5f4def3 100644 --- a/getarch.c +++ b/getarch.c @@ -971,7 +971,7 @@ static int get_num_cores(void) { #if defined(linux) || defined(__sun__) //returns the number of processors which are currently online - return sysconf(_SC_NPROCESSORS_ONLN); + return sysconf(_SC_NPROCESSORS_CONF); #elif defined(OS_WINDOWS)