Open mrghg opened 3 years ago
We have this problem with the MCMC code too... There we limit the number of threads in the shell, e.g.: export OMP_NUM_THREADS=2 export OPENBLAS_NUM_THREADS=2
But it looks like a better workaround is: https://github.com/joblib/threadpoolctl
Not sure how this affects the pooling for the sensitivity calculations though, i.e. if you limit numpy to 2 threads, and have 8 calculations in parallel, will this force numpy to use only 2 threads for all jobs, or 2 for each job? It says: "Contrary to smp, threadpoolctl does not attempt to limit the size of Python multiprocessing pools (threads or processes) or set operating system-level CPU affinity constraints: threadpoolctl only interacts with native libraries via their public runtime APIs." which I think means it's OK?
Not sure what that means! But it'd be great if you could investigate.
I think we also need to limit the MKL threads too?
Currently, numpy uses all available threads, which will be inefficient when launching array jobs