Skip to content

Commit

Permalink
[grid] Fix running the benchmark with a non supported system
Browse files Browse the repository at this point in the history
In certain cases, e.g. when running on a non supported system, attributes like
`current_partition.processor.num_cpus` and
`current_partition.processor.num_cpus_per_core` have value `None`, which breaks
some arithmetic operations, so we use `VAR or 1` to give it a "default" value of
1.  Note that all these attributes are used to the set the default values of
other attributes, but they can all be overridden on the command line.
  • Loading branch information
giordano committed Dec 4, 2024
1 parent 610c241 commit 4d92589
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions benchmarks/apps/grid/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ def setup_num_tasks(self):
self.num_tasks = reduce(mul, list(map(int, self.mpi.split("."))), 1)
self.set_var_default(
'num_cpus_per_task',
self.current_partition.processor.num_cpus //
min(1, self.current_partition.processor.num_cpus_per_core))
(self.current_partition.processor.num_cpus or 1) //
min(1, self.current_partition.processor.num_cpus_per_core or 1))
self.set_var_default('num_tasks_per_node',
self.current_partition.processor.num_cpus //
(self.current_partition.processor.num_cpus or 1) //
self.num_cpus_per_task)
self.executable_opts = [f'--mpi {self.mpi}', f'--shm {self.shm}', '--shm-hugetlb']
self.env_vars['OMP_NUM_THREADS'] = f'{self.num_cpus_per_task}'
Expand Down

0 comments on commit 4d92589

Please sign in to comment.