now the number of threads per run is restricted to what the user asks

This commit is contained in:
Guillaume Raffy 2022-06-01 12:06:58 +02:00
parent 0ecddcf8f8
commit ddcb9f1175
1 changed files with 6 additions and 1 deletions

View File

@ -104,7 +104,12 @@ class StarBencher():
stdout = open(stdout_filepath, 'w')
if stderr_filepath is not None:
stderr = open(stderr_filepath, 'w')
proc = subprocess.Popen(popen_args, cwd=cwd, stdout=stdout, stderr=stderr)
env = os.environ.copy()
# restrict the number of threads used by openmp
env['OMP_NUM_THREADS'] = '%d' % self.num_cores_per_run
# restrict the nu,ber of threads used by intel math kernel library
env['MKL_NUM_THREADS'] = '%d' % self.num_cores_per_run
proc = subprocess.Popen(popen_args, cwd=cwd, stdout=stdout, stderr=stderr, env=env)
proc.wait()
if stderr is not None:
stderr.close()