The author recommends the following: https://github.com/xianyi/OpenBLAS
Setting the number of threads using environment variables
Environment variables are used to specify a maximum number of threads. For example,
export OPENBLAS_NUM_THREADS=4
export GOTO_NUM_THREADS=4
export OMP_NUM_THREADS=4
The priorities are OPENBLAS_NUM_THREADS > GOTO_NUM_THREADS > OMP_NUM_THREADS.
If you compile this library with USE_OPENMP=1, you should set the OMP_NUM_THREADS environment variable; OpenBLAS ignores OPENBLAS_NUM_THREADS and GOTO_NUM_THREADS when compiled with USE_OPENMP=1.
When I use "export OPENBLAS_NUM_THREADS=16" in my main.cpp, I get an error about templates.
So, I changed my CMakeList.txt file to include:
set($ENV{OPENBLAS_NUM_THREADS} 16)
This seemed to have no effect on the threading of my application. I only see 1 CPU core at 100%.