Skip to content

Commit

Permalink
inner_max_num_threads only for loky backend
Browse files Browse the repository at this point in the history
  • Loading branch information
wpreimes committed May 2, 2024
1 parent 3813102 commit 9e16f25
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/repurpose/process.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import time
import os

# Note: Must be set BEFORE the first numpy import!!
os.environ['MKL_NUM_THREADS'] = '1'
os.environ['NUMEXPR_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_DYNAMIC'] = 'FALSE'
os.environ['OPENBLAS_NUM_THREADS'] = '1'

import traceback
import numpy as np
from tqdm import tqdm
Expand Down Expand Up @@ -341,7 +349,8 @@ def parallel_process_async(
log_level = None
listener = None

with parallel_config(backend=backend, inner_max_num_threads=1):
n = 1 if backend == 'loky' else None
with parallel_config(backend=backend, inner_max_num_threads=n):
results: list = ProgressParallel(
use_tqdm=show_progress_bars,
n_jobs=n_proc,
Expand Down

0 comments on commit 9e16f25

Please sign in to comment.