Skip to content

Commit

Permalink
Adding the latest commit with minor modifications to Sam's PR #97 within
Browse files Browse the repository at this point in the history
hooks.
  • Loading branch information
Satish Kamath committed Dec 13, 2023
1 parent 378c9e7 commit 57d6e52
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
6 changes: 6 additions & 0 deletions eessi/testsuite/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ def _assign_num_tasks_per_node(test: rfm.RegressionTest, num_per: int = 1):
- num_tasks_per_node = num_per
- num_cpus_per_task = test.default_num_cpus_per_node / num_tasks_per_node
"""

# OSU test inherits a default num_tasks_per_node = 1 from hpctestlib.
# There has to be a condition where a non-default value of num_per replaces the original num_tasks_per_node.
if test.num_tasks_per_node and num_per != 1:
if test.num_tasks_per_node != num_per:
test.num_tasks_per_node = num_per
# neither num_tasks_per_node nor num_cpus_per_task are set
if not test.num_tasks_per_node and not test.num_cpus_per_task:
test.num_tasks_per_node = num_per
Expand Down
22 changes: 9 additions & 13 deletions eessi/testsuite/tests/apps/osu.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,18 @@ def set_num_tasks(self):
""" Setting scales as tags. """
hooks.set_tag_scale(self)

@run_after('init')
@run_after('setup')
def set_num_tasks_per_node(self):
""" Setting number of tasks per node and cpus per task in this function.
This function sets num_cpus_per_task for 1 node and 2 node options where
the request is for full nodes."""
if(SCALES.get(self.scale).get('num_nodes') == 1):
self.num_tasks_per_node = 2
print("test: ", self.num_tasks_per_node)
hooks.assign_tasks_per_compute_unit(self,
COMPUTE_UNIT.get(NODE,
'node'), 2)
else:
self.num_tasks_per_node = 1

@run_after('setup')
def set_num_cpus_per_task(self):
""" Since num_tasks_per_node is already set. This function sets
num_cpus_per_task for 1 node and 2 node options where the request is
for full nodes."""
if(SCALES.get(self.scale).get('num_nodes') >= 1 and
SCALES.get(self.scale).get('node_part', 0) == 1):
hooks.assign_one_task_per_compute_unit(self,
COMPUTE_UNIT.get(CPU, 'cpu'))
hooks.assign_tasks_per_compute_unit(self, COMPUTE_UNIT.get(NODE, 'node'))

@run_after('setup')
def set_num_gpus_per_node(self):
Expand Down

0 comments on commit 57d6e52

Please sign in to comment.