From c8b052b498d8495acaf1b21235c4b0cef38dff2b Mon Sep 17 00:00:00 2001 From: Tijs Alleman Date: Fri, 30 Aug 2024 15:45:24 -0400 Subject: [PATCH] move it to the models init --- src/pySODM/__init__.py | 17 ----------------- src/pySODM/models/__init__.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/pySODM/__init__.py b/src/pySODM/__init__.py index c6b4d278..e69de29b 100644 --- a/src/pySODM/__init__.py +++ b/src/pySODM/__init__.py @@ -1,17 +0,0 @@ -""" -By setting the following environment variables, pySODM prohibits Numpy, Torch & Tensorflow from automatically multithreading large matrix operations -This does not play nice with the pySODM feature of running the model N times in parallel using multiprocessing -""" - -import os - -# Numpy & Torch -os.environ['VECLIB_MAXIMUM_THREADS'] = '1' -os.environ['OPENBLAS_NUM_THREADS'] = '1' -os.environ['MKL_NUM_THREADS'] = '1' -os.environ['BLIS_NUM_THREADS'] = '1' -os.environ['NUMEXPR_NUM_THREADS'] = '1' - -# Tensorflow -os.environ['TF_NUM_INTEROP_THREADS'] = '1' -os.environ['TF_NUM_INTRAOP_THREADS'] = '1' \ No newline at end of file diff --git a/src/pySODM/models/__init__.py b/src/pySODM/models/__init__.py index e69de29b..c6b4d278 100644 --- a/src/pySODM/models/__init__.py +++ b/src/pySODM/models/__init__.py @@ -0,0 +1,17 @@ +""" +By setting the following environment variables, pySODM prohibits Numpy, Torch & Tensorflow from automatically multithreading large matrix operations +This does not play nice with the pySODM feature of running the model N times in parallel using multiprocessing +""" + +import os + +# Numpy & Torch +os.environ['VECLIB_MAXIMUM_THREADS'] = '1' +os.environ['OPENBLAS_NUM_THREADS'] = '1' +os.environ['MKL_NUM_THREADS'] = '1' +os.environ['BLIS_NUM_THREADS'] = '1' +os.environ['NUMEXPR_NUM_THREADS'] = '1' + +# Tensorflow +os.environ['TF_NUM_INTEROP_THREADS'] = '1' +os.environ['TF_NUM_INTRAOP_THREADS'] = '1' \ No newline at end of file