Skip to content

Commit 101779b

Browse files
author
Lea Northcote
committed
Fix no-op os.system() call in be_func_parallel and be_func_parallel_u: OMP_NUM_THREADS must be set via os.environ in the parent process before Pool creation for forked workers to inherit it
1 parent 9311888 commit 101779b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/quemb/molbe/be_parallel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def be_func_parallel(
469469
the error norm, error vector, and the computed energy.
470470
"""
471471
# Set the number of OpenMP threads
472-
os.system("export OMP_NUM_THREADS=" + str(ompnum))
472+
os.environ["OMP_NUM_THREADS"] = str(ompnum)
473473
nprocs = nproc // ompnum
474474

475475
# Update the effective Hamiltonian with potentials
@@ -601,7 +601,7 @@ def be_func_parallel_u(
601601
Returns the computed energy
602602
"""
603603
# Set the number of OpenMP threads
604-
os.system("export OMP_NUM_THREADS=" + str(ompnum))
604+
os.environ["OMP_NUM_THREADS"] = str(ompnum)
605605
nprocs = nproc // ompnum
606606

607607
with Pool(nprocs) as pool_:

0 commit comments

Comments
 (0)