Closed
Description
Consider the following C code:
#include <cblas.h>
#include <stdio.h>
int main() {
int initial_thread_count = openblas_get_num_threads();
if(initial_thread_count >= 2) {
int new_thread_count = initial_thread_count/2;
openblas_set_num_threads(new_thread_count);
printf("Initially: #threads = %d\n", initial_thread_count);
printf("Setting #threads to %d: ", new_thread_count);
int reported_threads = openblas_get_num_threads();
if(reported_threads == new_thread_count) {
printf("passed!\n");
}
else {
printf("failed (#threads = %d)\n", reported_threads);
}
}
}
On my MacPro, it prints
OpenBLAS build configuration:
DYNAMIC_ARCH NO_AFFINITY Nehalem
Initially: #threads = 6
Setting #threads to 3: failed (#threads = 6)
So openblas_set_num_threads
failed to reduce the number of threads. My machine is a MacPro 2010 with 6 physical cores and I compiled OpenBLAS with
make CC=clang FC=gfortran USE_THREAD=1 NUM_THREADS=16 DYNAMIC_ARCH=1 NO_STATIC=1
I specified NUM_THREADS because I wanted libopenblas.dylib to be usable on other machines with more cores. Here are the versions of the compilers:
~> clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix
~> gfortran --version
GNU Fortran (MacPorts gcc5 5.3.0_0) 5.3.0
Either I am missing something badly or this is a bug!
Metadata
Metadata
Assignees
Labels
No labels