From cfa9392ffa1903c309fb2d8c9ad74831475b778d Mon Sep 17 00:00:00 2001 From: Zhang Xianyi Date: Sun, 8 Feb 2015 01:30:12 -0600 Subject: [PATCH] Fix openblas_get_num_threads and openblas_get_num_procs bug with single thread. --- driver/others/memory.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/driver/others/memory.c b/driver/others/memory.c index e245d9e..0316155 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -241,9 +241,6 @@ void set_stack_limit(int limitMB){ */ #endif -int openblas_get_num_procs(void) { - return get_num_procs(); -} /* OpenBLAS uses the numbers of CPU cores in multithreading. @@ -327,8 +324,21 @@ int blas_get_cpu_number(void){ } #endif + +int openblas_get_num_procs(void) { +#ifndef SMP + return 1; +#else + return get_num_procs(); +#endif +} + int openblas_get_num_threads(void) { +#ifndef SMP + return 1; +#else return blas_get_cpu_number(); +#endif } struct release_t { -- 2.7.4