I have been using some prebuilt linear algebra libraries that use OpenMP to parallelize their execution.
Right now I am working in a project with OpenMP to parallelize some tasks. So I set the environment variable OMP_NUM_THREADS.
Some threads make use of BLAS and LAPACK linear algebra routines. These libraries are also parallel and take a look at the environment variable OMP_NUM_THREADS to see the number of threads that they have to use.
For requirements of my project. I need to avoid this nested parallelization by making use of a non parallel BLAS and LAPACK implementation.
What is the best library and how can it be built?
Thank you very much in advance.
You can use OpenBLAS. This library includes its one version of LAPACK routines and is quite flexible with respect to threading.
The number of threads can be defined either at compile time:
$shell> make USE_THREAD=0
or using explicit environment variable:
export OPENBLAS_NUM_THREADS=4
or using library API at runtime:
void openblas_set_num_threads(int num_threads);