Set max number of threads at runtime on numpy/openblas
问题 I'd like to know if it's possible to change at (Python) runtime the maximum number of threads used by OpenBLAS behind numpy? I know it's possible to set it before running the interpreter through the environment variable OMP_NUM_THREADS , but I'd like to change it at runtime. Typically, when using MKL instead of OpenBLAS, it is possible: import mkl mkl.set_num_threads(n) 回答1: You can do this by calling the openblas_set_num_threads function using ctypes . I often find myself wanting to do this,