From 8b68b5d782239c1e8df34be884a0e60e28d9912e Mon Sep 17 00:00:00 2001 From: ianchb Date: Mon, 9 Feb 2026 22:57:17 +0800 Subject: [PATCH] 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. --- plot_binary_data.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plot_binary_data.py b/plot_binary_data.py index 78b5a4c..2aca1c7 100755 --- a/plot_binary_data.py +++ b/plot_binary_data.py @@ -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) -## 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. import os 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 scipy