diff --git a/eessi/testsuite/eessi_mixin.py b/eessi/testsuite/eessi_mixin.py index e87d5311..9396fff6 100644 --- a/eessi/testsuite/eessi_mixin.py +++ b/eessi/testsuite/eessi_mixin.py @@ -4,7 +4,7 @@ from reframe.utility.sanity import make_performance_function from eessi.testsuite import hooks -from eessi.testsuite.constants import DEVICE_TYPES, SCALES, COMPUTE_UNIT +from eessi.testsuite.constants import DEVICE_TYPES, SCALES, COMPUTE_UNIT, TAGS # Hooks from the Mixin class seem to be executed _before_ those of the child class @@ -38,6 +38,8 @@ class EESSI_Mixin(RegressionMixin): # Set defaults for these class variables, can be overwritten by child class if desired measure_memory_usage = False scale = parameter(SCALES.keys()) + bench_name = None + bench_name_ci = None # Note that the error for an empty parameter is a bit unclear for ReFrame 4.6.2, but that will hopefully improve # see https://github.com/reframe-hpc/reframe/issues/3254 @@ -113,6 +115,16 @@ def measure_mem_usage(self): # instead of the @performance_function decorator self.perf_variables['memory'] = make_performance_function(hooks.extract_memory_usage, 'MiB', self) + @run_after('init', always_last=True) + def set_tag_ci(self): + "Set CI tag if bench_name_ci and bench_name are set and are equal" + if 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']) + @run_after('setup') def validate_setup(self): """Check that all variables that have to be set for subsequent hooks in the setup phase have been set""" diff --git a/eessi/testsuite/tests/apps/cp2k/cp2k.py b/eessi/testsuite/tests/apps/cp2k/cp2k.py index 30fe0867..14a65bad 100644 --- a/eessi/testsuite/tests/apps/cp2k/cp2k.py +++ b/eessi/testsuite/tests/apps/cp2k/cp2k.py @@ -6,11 +6,12 @@ from eessi.testsuite import hooks from eessi.testsuite.constants import SCALES, TAGS, COMPUTE_UNIT, DEVICE_TYPES, CPU +from eessi.testsuite.eessi_mixin import EESSI_Mixin from eessi.testsuite.utils import find_modules, log @rfm.simple_test -class EESSI_CP2K(rfm.RunOnlyRegressionTest): +class EESSI_CP2K(rfm.RunOnlyRegressionTest, EESSI_Mixin): benchmark_info = parameter([ # (bench_name, energy_ref, energy_tol) @@ -24,8 +25,18 @@ class EESSI_CP2K(rfm.RunOnlyRegressionTest): executable = 'cp2k.popt' time_limit = '2h' - valid_systems = ['*'] - valid_prog_environs = ['default'] + device_type = DEVICE_TYPES[CPU] + compute_unit = COMPUTE_UNIT[CPU] + bench_name_ci = 'QS/H2O-32' # set CI on smallest benchmark + + def required_mem_per_node(self): + mems = { + 'QS/H2O-32': {'intercept': 0.5, 'slope': 0.15}, + 'QS/H2O-128': {'intercept': 5, 'slope': 0.15}, + 'QS/H2O-512': {'intercept': 34, 'slope': 0.20}, + } + mem = mems[self.bench_name] + return (self.num_tasks_per_node * mem['slope'] + mem['intercept']) * 1024 @run_after('init') def prepare_test(self): @@ -51,39 +62,9 @@ def assert_energy(self): def time(self): return sn.extractsingle(r'^ CP2K(\s+[\d\.]+){4}\s+(?P