diff --git a/cscs-checks/microbenchmarks/cpu/fft/fftw_benchmark.py b/cscs-checks/microbenchmarks/cpu/fft/fftw_benchmark.py index f1bcbfaa68..2e9ab0bf72 100644 --- a/cscs-checks/microbenchmarks/cpu/fft/fftw_benchmark.py +++ b/cscs-checks/microbenchmarks/cpu/fft/fftw_benchmark.py @@ -7,28 +7,40 @@ import reframe.utility.sanity as sn -@rfm.parameterized_test(['nompi'], ['mpi']) +@rfm.simple_test class FFTWTest(rfm.RegressionTest): - def __init__(self, exec_mode): - self.sourcepath = 'fftw_benchmark.c' - self.build_system = 'SingleSource' - self.valid_systems = ['daint:gpu', 'dom:gpu'] + exec_mode = parameter(['nompi', 'mpi']) + sourcepath = 'fftw_benchmark.c' + build_system = 'SingleSource' + valid_systems = ['daint:gpu', 'dom:gpu'] + # Cray FFTW library is not officially supported for the PGI + valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu'] + modules = ['cray-fftw'] + num_tasks_per_node = 12 + num_gpus_per_node = 0 + maintainers = ['AJ'] + tags = {'benchmark', 'scs', 'craype'} - # Cray FFTW library is not officially supported for the PGI - self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu'] - self.modules = ['cray-fftw'] - self.num_tasks_per_node = 12 - self.num_gpus_per_node = 0 - self.sanity_patterns = sn.assert_eq( - sn.count(sn.findall(r'execution time', self.stdout)), 1) + @performance_function('s') + def fftw_exec_time(self): + return sn.extractsingle( + r'execution time:\s+(?P\S+)', self.stdout, + 'exec_time', float + ) + + @sanity_function + def assert_finished(self): + return sn.assert_eq( + sn.count(sn.findall(r'execution time', self.stdout)), 1 + ) + + @run_before('compile') + def set_cflags(self): self.build_system.cflags = ['-O2'] - self.perf_patterns = { - 'fftw_exec_time': sn.extractsingle( - r'execution time:\s+(?P\S+)', self.stdout, - 'exec_time', float), - } - if exec_mode == 'nompi': + @run_before('run') + def configure_exec_mode(self): + if self.exec_mode == 'nompi': self.num_tasks = 12 self.executable_opts = ['72 12 1000 0'] self.reference = { @@ -50,6 +62,3 @@ def __init__(self, exec_mode): 'fftw_exec_time': (0.47, None, 0.50, 's'), }, } - - self.maintainers = ['AJ'] - self.tags = {'benchmark', 'scs', 'craype'}