fixup! Fix load explosion: use subprocess for binary data plots to avoid thread conflict

* Seems we don't have to set so many variables, `OMP_NUM_THREADS` is enough.

Test: Annotate the code for setting other environment variables. It runs normally.
This commit is contained in:
2026-02-09 22:57:17 +08:00
parent dd2443c926
commit 8b68b5d782

View File

@@ -8,16 +8,12 @@
## ##
################################################# #################################################
## Restrict BLAS/OpenMP to one thread per process so that running ## Restrict OpenMP to one thread per process so that running
## many workers in parallel does not create an O(workers * BLAS_threads) ## many workers in parallel does not create an O(workers * BLAS_threads)
## thread explosion. These variables MUST be set before numpy/scipy ## thread explosion. The variable MUST be set before numpy/scipy
## are imported, because the BLAS library reads them only at load time. ## are imported, because the BLAS library reads them only at load time.
import os import os
os.environ.setdefault("OMP_NUM_THREADS", "1") os.environ.setdefault("OMP_NUM_THREADS", "1")
os.environ.setdefault("OPENBLAS_NUM_THREADS", "1")
os.environ.setdefault("MKL_NUM_THREADS", "1")
os.environ.setdefault("VECLIB_MAXIMUM_THREADS", "1")
os.environ.setdefault("NUMEXPR_NUM_THREADS", "1")
import numpy import numpy
import scipy import scipy