I’m running exciting_smp (the shared-memory multiprocessing version) and trying to control the number of processors it uses. I’ve set OMP_NUM_THREADS=4 in my .bashrc to limit it to 4 threads. However, when I monitor the system while it’s running, I notice it seems to use more than that—around 6 or 7 processors at times.
Is there a way to ensure it only uses the specified number of processors, or am I missing something in the configuration? Any insights on controlling processor usage for exciting_smp would be greatly appreciated!
Hi @sareh , setting OMP_NUM_THREADS in the .bashrc is a bad idea. This is going to affect all apps launched from your shell. It’s better to just export OMP_NUM_THREADS=4 on a per-session basis.
In my experience, openBLAS is extremely greedy when it comes to threads, and doesn’t necessarily respect OMP_NUM_THREADS. Try setting export OPENBLAS_NUM_THREADS=1. Similarly, MKL threads can be controlled with MKL_NUM_THREADS.
It’s likely to be whatever BLAS flavour you’re using that’s using the extra threads.