Closed calchoo closed 5 years ago
It looks like the newer numpy versions are using an openBLAS version that spawns a thread count equal to the number of processors on the machine by default.
Possible fixes include:
export OMP_NUM_THREADS=1
Is there a way to set this from where we import numpy? or does it have to be the environment variable? it will be hard to incorporate the env variable and ensure it is used
Looks like maybe? https://stackoverflow.com/questions/30791550/limit-number-of-threads-in-numpy
Try setting the env variable just before we import numpy
yeah, it looks like we could set it in the script itself
import os
os.environ["OMP_NUM_THREADS"] = "4" # export OMP_NUM_THREADS=4
os.environ["OPENBLAS_NUM_THREADS"] = "4" # export OPENBLAS_NUM_THREADS=4
os.environ["MKL_NUM_THREADS"] = "6" # export MKL_NUM_THREADS=6
os.environ["VECLIB_MAXIMUM_THREADS"] = "4" # export VECLIB_MAXIMUM_THREADS=4
os.environ["NUMEXPR_NUM_THREADS"] = "6" # export NUMEXPR_NUM_THREADS=6
Fixed.
MAVIS version: 2.2.3
Python version: 3.6.0
OS: Centos 6.7
Jobs are failing with thread count errors due to OpenBLAS (a part of numpy):
This seems to happen when too many jobs are running at the same time and when mavis is using numpy v1.16.0+.