Skip to content

Commit 5ca6529

Browse files
committed
Set implicit multithreading variables to 1.
1 parent 80c3e6a commit 5ca6529

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

python/lsst/sconsUtils/state.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,22 @@ def _initEnvironment():
215215
CC_LOGGER_BIN
216216
""".split()
217217

218+
# The list of implicit multithreading environment variables here
219+
# is taken from lsst.utils.disable_implicit_threading(), but
220+
# has to be put here for dependency ordering reasons, and
221+
# to ensure these are set prior to any instantiation of pytest
222+
# or any code that may implicitly spawn threads.
223+
implicitMultithreadingVars = """
224+
OPENBLAS_NUM_THREADS
225+
GOTO_NUM_THREADS
226+
OMP_NUM_THREADS
227+
MKL_NUM_THREADS
228+
MKL_DOMAIN_NUM_THREADS
229+
MPI_NUM_THREADS
230+
NUMEXPR_NUM_THREADS
231+
NUMEXPR_MAX_THREADS
232+
""".split()
233+
218234
for key in preserveVars:
219235
if key in os.environ:
220236
ourEnv[key] = os.environ[key]
@@ -225,6 +241,10 @@ def _initEnvironment():
225241
if key in os.environ:
226242
ourEnv[key] = os.environ[key]
227243

244+
# Turn off implicit multithreading.
245+
for key in implicitMultithreadingVars:
246+
ourEnv[key] = "1"
247+
228248
# Find and propagate EUPS environment variables.
229249
cfgPath = []
230250
for k in os.environ:

0 commit comments

Comments
 (0)