Skip to content

Commit

Permalink
Merge pull request #110 from satishskamath/osu_followup
Browse files Browse the repository at this point in the history
Two changes I made in this commit/PR:
  • Loading branch information
smoors authored Feb 16, 2024
2 parents d516f05 + 1c65a3c commit 00c4bd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
6 changes: 5 additions & 1 deletion eessi/testsuite/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,15 @@ def filter_valid_systems_by_device_type(test: rfm.RegressionTest, required_devic
# GPU_VENDOR=GPU_VENDORS[NVIDIA] extras
valid_systems = f'+{FEATURES[GPU]} %{GPU_VENDOR}={GPU_VENDORS[NVIDIA]}'

elif required_device_type == DEVICE_TYPES[CPU]:
elif not is_cuda_module and required_device_type == DEVICE_TYPES[CPU]:
# Using the CPU requires partitions with FEATURES[CPU] feature
# Note: making FEATURES[CPU] an explicit feature allows e.g. skipping CPU-based tests on GPU partitions
valid_systems = f'+{FEATURES[CPU]}'

elif is_cuda_module and required_device_type == DEVICE_TYPES[CPU]:
# Note: This applies for CUDA module tests that want to test only on cpus on gpu partitions.
valid_systems = f'+{FEATURES[CPU]} +{FEATURES[GPU]} %{GPU_VENDOR}={GPU_VENDORS[NVIDIA]}'

elif not is_cuda_module and required_device_type == DEVICE_TYPES[GPU]:
# Invalid combination: a module without GPU support cannot use a GPU
valid_systems = ''
Expand Down
25 changes: 6 additions & 19 deletions eessi/testsuite/tests/apps/osu.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ class EESSI_OSU_Micro_Benchmarks_pt2pt(osu_benchmark):
device_type = parameter([DEVICE_TYPES[CPU], DEVICE_TYPES[GPU]])
# unset num_tasks_per_node from the hpctestlib.
num_tasks_per_node = None
# Note: device_buffers variable is inherited from the hpctestlib class and adds options to the launcher
# commands based on what device is set.
device_buffers = 'cpu'

@run_after('init')
def run_after_init(self):
"""hooks to run after init phase"""
# Note: device_buffers variable is inherited from the hpctestlib class and adds options to the launcher
# commands (before setup) if not equal to 'cpu'. We set it to 'cpu' initially and change it later in this hook depending on the test.
self.device_buffers = 'cpu'
# Filter on which scales are supported by the partitions defined in the ReFrame configuration
hooks.filter_supported_scales(self)

Expand Down Expand Up @@ -113,14 +113,6 @@ def set_num_tasks(self):
""" Setting scales as tags. """
hooks.set_tag_scale(self)

@run_after('setup')
def set_environment(self):
""" Setting environment variable for CUDA module tests that run on pure cpu nodes."""
is_cuda_module = utils.is_cuda_required_module(self.module_name)
if (is_cuda_module and self.device_type == DEVICE_TYPES[CPU] and
(not FEATURES[GPU] in self.current_partition.features)):
self.env_vars = {'LD_LIBRARY_PATH': '$EBROOTCUDA/stubs/lib64:$LD_LIBRARY_PATH'}

@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
Expand Down Expand Up @@ -174,6 +166,9 @@ class EESSI_OSU_Micro_Benchmarks_coll(osu_benchmark):
@run_after('init')
def run_after_init(self):
"""hooks to run after init phase"""
# Note: device_buffers variable is inherited from the hpctestlib class and adds options to the launcher
# commands based on what device is set.
self.device_buffers = 'cpu'
hooks.filter_valid_systems_by_device_type( self, required_device_type=self.device_type)
is_cuda_module = utils.is_cuda_required_module(self.module_name)
if is_cuda_module and self.device_type == DEVICE_TYPES[GPU]:
Expand Down Expand Up @@ -213,14 +208,6 @@ def set_mem(self):
def set_num_tasks(self):
hooks.set_tag_scale(self)

@run_after('setup')
def set_environment(self):
""" Setting environment variable for CUDA module tests that run on pure cpu nodes."""
is_cuda_module = utils.is_cuda_required_module(self.module_name)
if (is_cuda_module and self.device_type == DEVICE_TYPES[CPU] and
(not FEATURES[GPU] in self.current_partition.features)):
self.env_vars = {'LD_LIBRARY_PATH': '$EBROOTCUDA/stubs/lib64:$LD_LIBRARY_PATH'}

@run_after('setup')
def set_num_tasks_per_node(self):
""" Setting number of tasks per node, cpus per task and gpus per node in this function. This function sets
Expand Down

0 comments on commit 00c4bd3

Please sign in to comment.