File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,16 @@ def test_step(self):
223223 run_tests += [self .cfg ['runtest' ]]
224224
225225 for runtest in run_tests :
226- cmd = f"{ self .cfg ['pretestopts' ]} make { runtest } { self .cfg ['testopts' ]} "
226+ # Try to limit parallelism for the tests. If OMP_NUM_THREADS or OPENBLAS_NUM_THREADS is already set,
227+ # use the existing value. If not, we'll set OMP_NUM_THREADS for OpenBLAS built with OpenMP, and
228+ # OPENBLAS_NUM_THREADS if built with threads.
229+ parallelism_env = ''
230+ if "USE_OPENMP='1'" in self .cfg ['testopts' ] and 'OMP_NUM_THREADS' not in self .cfg ['pretestopts' ]:
231+ parallelism_env += f'OMP_NUM_THREADS={ self .cfg .parallel } '
232+ if "USE_THREAD='1'" in self .cfg ['testopts' ] and 'OPENBLAS_NUM_THREADS' not in self .cfg ['pretestopts' ]:
233+ parallelism_env += f'OPENBLAS_NUM_THREADS={ self .cfg .parallel } '
234+
235+ cmd = f"{ parallelism_env } { self .cfg ['pretestopts' ]} make { runtest } { self .cfg ['testopts' ]} "
227236 res = run_shell_cmd (cmd )
228237
229238 # Raise an error if any test failed
You can’t perform that action at this time.
0 commit comments