Skip to content

Commit

Permalink
move it to the models init
Browse files Browse the repository at this point in the history
  • Loading branch information
twallema committed Aug 30, 2024
1 parent eb70e14 commit c8b052b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/pySODM/__init__.py
Original file line number Diff line number Diff line change
@@ -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'
17 changes: 17 additions & 0 deletions src/pySODM/models/__init__.py
Original file line number Diff line number Diff line change
@@ -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'

0 comments on commit c8b052b

Please sign in to comment.