Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions eessi/testsuite/eessi_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class EESSI_Mixin(RegressionMixin):
That definition needs to be done 'on time', i.e. early enough in the execution of the ReFrame pipeline.
Here, we list which class attributes must be defined by the child class, and by (the end of) what phase:

- Init phase: device_type, scale, module_name, bench_name (if bench_name_ci is set)
- Init phase: device_type, scale, module_name, bench_name
- Setup phase: compute_unit, required_mem_per_node

The child class may also overwrite the following attributes:

- Init phase: time_limit, measure_memory_usage, bench_name_ci, all_readonly_files
- Init phase: time_limit, measure_memory_usage, all_readonly_files
"""

# Defaults for ReFrame variables that can be overwritten on the cmd line
Expand All @@ -51,7 +51,6 @@ class EESSI_Mixin(RegressionMixin):
# Set defaults for these class variables, can be overwritten by child class if desired
scale = parameter(SCALES.keys())
bench_name = None
bench_name_ci = None
is_ci_test = False
num_tasks_per_compute_unit = 1
always_request_gpus = None
Expand Down Expand Up @@ -172,20 +171,13 @@ def EESSI_mixin_measure_mem_usage(self):
@run_after('init', always_last=True)
def EESSI_mixin_set_tag_ci(self):
"""
Set CI tag if is_ci_test is True or (bench_name_ci and bench_name are set and are equal)
Set CI tag if is_ci_test is True
Also set tag on bench_name if set
"""
tags_added = False
if self.is_ci_test:
self.tags.add(TAGS.CI)
tags_added = True
elif self.bench_name_ci:
if not self.bench_name:
msg = "Attribute bench_name_ci is set, but bench_name is not set"
raise ReframeFatalError(msg)
if self.bench_name == self.bench_name_ci:
self.tags.add(TAGS.CI)
tags_added = True
if self.bench_name:
self.tags.add(self.bench_name)
tags_added = True
Expand Down
6 changes: 5 additions & 1 deletion eessi/testsuite/tests/apps/PyTorch/PyTorch_torchvision.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class EESSI_PyTorch_torchvision(rfm.RunOnlyRegressionTest, EESSI_Mixin):
descr = 'Benchmark that runs a selected torchvision model on synthetic data'

nn_model = parameter(['vgg16', 'resnet50', 'resnet152', 'densenet121', 'mobilenet_v3_large'])
bench_name_ci = 'resnet50'
parallel_strategy = parameter([None, 'ddp'])
# Both torchvision and PyTorch-bundle modules have everything needed to run this test
module_name = parameter(chain(find_modules('torchvision'), find_modules('PyTorch-bundle')))
Expand All @@ -34,6 +33,11 @@ def prepare_test(self):
if self.device_type != DEVICE_TYPES.GPU:
self.executable_opts += ['--no-cuda']

@run_after('init')
def set_ci_tag(self):
if self.bench_name == 'resnet50':
self.is_ci_test = True

@run_after('setup')
def set_ddp_options(self):
"Set environment variables for PyTorch DDP"
Expand Down
2 changes: 1 addition & 1 deletion eessi/testsuite/tests/apps/QuantumESPRESSO.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def set_ci(self):
min_ecut = min(QEspressoPWCheck.ecut.values)
min_nbnd = min(QEspressoPWCheck.nbnd.values)
if self.ecut == min_ecut and self.nbnd == min_nbnd:
self.bench_name = self.bench_name_ci = 'bench_ci'
self.is_ci_test = True

@run_after('init')
def set_increased_walltime(self):
Expand Down
6 changes: 5 additions & 1 deletion eessi/testsuite/tests/apps/cp2k/cp2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class EESSI_CP2K(rfm.RunOnlyRegressionTest, EESSI_Mixin):
time_limit = '2h'
device_type = DEVICE_TYPES.CPU
compute_unit = COMPUTE_UNITS.CPU
bench_name_ci = 'QS/H2O-32' # set CI on smallest benchmark
readonly_files = ['QS']

def required_mem_per_node(self):
Expand All @@ -41,6 +40,11 @@ def set_bench_name(self):
self.bench_name, self.energy_ref, self.energy_tol = self.benchmark_info
self.descr = f'EESSI_CP2K {self.bench_name} benchmark'

@run_after('init')
def set_ci_tag(self):
if self.bench_name == 'QS/H2O-32':
self.is_ci_test = True

@run_after('setup')
def prepare_test(self):
self.executable_opts += ['-i', f'{self.bench_name}.inp']
Expand Down
4 changes: 1 addition & 3 deletions eessi/testsuite/tests/apps/espresso/espresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def set_ci_tag(self):
# TODO: revisit this for more recent versions of ESPResSo
# see also: https://github.com/EESSI/test-suite/issues/154
if SCALES[self.scale]['num_nodes'] < 2:
self.bench_name_ci = self.bench_name
self.is_ci_test = True

@sanity_function
def assert_sanity(self):
Expand All @@ -71,7 +71,6 @@ class EESSI_ESPRESSO_P3M_IONIC_CRYSTALS(EESSI_ESPRESSO_base, EESSI_Mixin):
executable = 'python3 madelung.py'
sourcesdir = 'src/p3m'
readonly_files = ['madelung.py']
bench_name = 'ionic_crystals_p3m'

default_weak_scaling_system_size = 6

Expand Down Expand Up @@ -106,7 +105,6 @@ class EESSI_ESPRESSO_LJ_PARTICLES(EESSI_ESPRESSO_base, EESSI_Mixin):
executable = 'python3 lj.py'
sourcesdir = 'src/lj'
readonly_files = ['lj.py']
bench_name = 'particles_lj'

def required_mem_per_node(self):
"LJ requires 200 MB per core"
Expand Down
6 changes: 5 additions & 1 deletion eessi/testsuite/tests/apps/gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class EESSI_GROMACS(EESSI_GROMACS_base, EESSI_Mixin):
scale = parameter(SCALES.keys())
time_limit = '30m'
module_name = parameter(find_modules('GROMACS'))
bench_name_ci = 'HECBioSim/Crambin'
# input files are downloaded
readonly_files = ['']
# executable_opts in addition to those set by the hpctestlib
Expand All @@ -64,6 +63,11 @@ def __init__(self):
# self.device_type must be set before the @run_after('init') hooks of the EESSI_Mixin class
self.device_type = self.nb_impl

@run_after('init')
def set_ci_tag(self):
if self.bench_name == 'HECBioSim/Crambin':
self.is_ci_test = True

@run_after('init')
def set_compute_unit(self):
"""
Expand Down
6 changes: 1 addition & 5 deletions eessi/testsuite/tests/apps/openfoam/openfoam.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ class EESSI_OPENFOAM_LID_DRIVEN_CAVITY_1M(rfm.RunOnlyRegressionTest, EESSI_Mixin
module_name = parameter(find_modules('OpenFOAM/v', name_only=False))
valid_systems = ['*']
scale = parameter(filter_scales_1M())
is_ci_test = True

@run_after('init')
def set_compute_unit(self):
Expand All @@ -333,11 +334,6 @@ def set_compute_unit(self):
def required_mem_per_node(self):
return self.num_tasks_per_node * 1700

@run_after('init')
def select_ci(self):
" Select the CI variants "
self.bench_name = self.bench_name_ci = 'icoFoam_1M_CI'

@run_after('setup')
def check_launcher_options(self):
# We had to get the launcher command and prepend this to the prerun steps (func prepare_environment) because:
Expand Down
4 changes: 2 additions & 2 deletions eessi/testsuite/tests/apps/osu.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def filter_benchmark_pt2pt(self):
def select_ci(self):
" Select the CI variants "
if (self.bench_name in ['mpi.pt2pt.osu_latency', 'mpi.pt2pt.osu_bw']):
self.bench_name_ci = self.bench_name
self.is_ci_test = True

@run_after('init')
def set_num_tasks_per_compute_unit(self):
Expand Down Expand Up @@ -178,7 +178,7 @@ def filter_benchmark_coll(self):
def select_ci(self):
" Select the CI variants "
if (self.bench_name in ['mpi.collective.osu_allreduce', 'mpi.collective.osu_alltoall']):
self.bench_name_ci = self.bench_name
self.is_ci_test = True

@run_after('init')
def set_compute_unit(self):
Expand Down
2 changes: 1 addition & 1 deletion eessi/testsuite/tests/apps/tensorflow/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class EESSI_TensorFlow(rfm.RunOnlyRegressionTest, EESSI_Mixin):
time_limit = '30m'

# This test should be run as part of EESSI CI
bench_name = bench_name_ci = 'bench_ci'
is_ci_test = True

readonly_files = ['mnist_setup.py', 'tf_test.py']

Expand Down
14 changes: 6 additions & 8 deletions tutorial/mpi4py/mpi4py_portable_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class EESSI_MPI4PY(rfm.RunOnlyRegressionTest, EESSI_Mixin):
# One task is launched per compute unit. In this case, one task per (physical) CPU core
compute_unit = COMPUTE_UNITS.CPU

# ReFrame will generate a test for each module that matches the regex `mpi4py`
# ReFrame will generate a test for each module that matches the regex `mpi4py`.
# This means we implicitly assume that any module matching this name provides the required functionality
# to run this test
# to run this test.
module_name = parameter(find_modules('mpi4py'))

# Our script has two arguments, --n_iter and --n_warmup. By defining these as ReFrame variables, we can
Expand All @@ -54,13 +54,11 @@ class EESSI_MPI4PY(rfm.RunOnlyRegressionTest, EESSI_Mixin):
# https://reframe-hpc.readthedocs.io/en/stable/regression_test_api.html#reframe.core.pipeline.RegressionTest.time_limit
time_limit = '5m00s'

# Define the benchmarks that are available in the test.
# In this test (`EESSI_MPI4PY`) there is only one benchmark. If there are more than one,
# define them using the `parameter()` function.
bench_name = 'mpi4pi'
# Optionally define the test variants that are available in the test with the `parameter()` function
# In this test (`EESSI_MPI4PY`) there is only one variant, so we don't have to define anything.

# Specify the benchmark to be tested in CI (will be marked with a `CI` tag).
bench_name_ci = 'mpi4pi'
# Indicate that the test should run in CI (will be marked with a `CI` tag).
is_ci_test = True

# Define the files and/or dirs inside sourcesdir (default=src) that should be symlinked into the stage dir
readonly_files = ['mpi4py_reduce.py']
Expand Down