From 4cea5ad9865a7da1811d0d4262643ea7737813b0 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Wed, 15 Aug 2018 19:52:34 +0200 Subject: [PATCH 1/3] Adapt stream microbenchmark test to build systems * Adapt the stream microbenchmark regression test to use build systems. * Use the new regression test syntax. --- cscs-checks/microbenchmarks/stream/stream.py | 36 ++++++++------------ 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/cscs-checks/microbenchmarks/stream/stream.py b/cscs-checks/microbenchmarks/stream/stream.py index c9f6c95d80..e082aa71ac 100644 --- a/cscs-checks/microbenchmarks/stream/stream.py +++ b/cscs-checks/microbenchmarks/stream/stream.py @@ -1,13 +1,11 @@ -import os +import reframe as rfm import reframe.utility.sanity as sn -from reframe.core.pipeline import RegressionTest - -class StreamTest(RegressionTest): - def __init__(self, **kwargs): - super().__init__('stream_benchmark', - os.path.dirname(__file__), **kwargs) +@rfm.simple_test +class StreamTest(rfm.RegressionTest): + def __init__(self): + super().__init__() self.descr = 'STREAM Benchmark' self.exclusive_access = True # All available systems are supported @@ -17,13 +15,13 @@ def __init__(self, **kwargs): self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', 'PrgEnv-intel', 'PrgEnv-pgi'] self.prgenv_flags = { - 'PrgEnv-cray': ' -homp ', - 'PrgEnv-gnu': ' -fopenmp -O3', - 'PrgEnv-intel': ' -qopenmp -O3', - 'PrgEnv-pgi': ' -mp -O3' + 'PrgEnv-cray': ['-homp'], + 'PrgEnv-gnu': ['-fopenmp', '-O3'], + 'PrgEnv-intel': ['-qopenmp', '-O3'], + 'PrgEnv-pgi': ['-mp', '-O3'] } self.sourcepath = 'stream.c' - self.tags = {'production', 'monch_acceptance'} + self.build_system = 'SingleSource' self.sanity_patterns = sn.assert_found( r'Solution Validates: avg error less than', self.stdout) self.num_tasks = 1 @@ -82,6 +80,7 @@ def __init__(self, **kwargs): self.stdout, 'triad', float) } + self.tags = {'production', 'monch_acceptance'} self.maintainers = ['RS', 'VK'] def setup(self, partition, environ, **job_opts): @@ -91,16 +90,9 @@ def setup(self, partition, environ, **job_opts): self.reference = self.stream_bw_reference[self.current_environ.name] # On SLURM there is no need to set OMP_NUM_THREADS if one defines # num_cpus_per_task, but adding for completeness and portability - self.current_environ.variables['OMP_NUM_THREADS'] = \ - str(self.num_cpus_per_task) + self.current_environ.variables['OMP_NUM_THREADS'] = str( + self.num_cpus_per_task) if self.current_environ.name == 'PrgEnv-pgi': self.current_environ.variables['OMP_PROC_BIND'] = 'true' - def compile(self): - prgenv_flags = self.prgenv_flags[self.current_environ.name] - self.current_environ.cflags = prgenv_flags - super().compile() - - -def _get_checks(**kwargs): - return [StreamTest(**kwargs)] + self.build_system.cflags = self.prgenv_flags[self.current_environ.name] From 30166d34693eb1e24e25b868d3bce740b8ad8033 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 16 Aug 2018 18:26:00 +0200 Subject: [PATCH 2/3] Address PR comments --- cscs-checks/microbenchmarks/stream/stream.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cscs-checks/microbenchmarks/stream/stream.py b/cscs-checks/microbenchmarks/stream/stream.py index e082aa71ac..8f295adc45 100644 --- a/cscs-checks/microbenchmarks/stream/stream.py +++ b/cscs-checks/microbenchmarks/stream/stream.py @@ -39,7 +39,7 @@ def __init__(self): self.variables = { 'OMP_PLACES': 'threads', - 'OMP_PROC_BIND': 'spread', + 'OMP_PROC_BIND': 'spread' } self.stream_bw_reference = { 'PrgEnv-cray': { @@ -85,14 +85,13 @@ def __init__(self): def setup(self, partition, environ, **job_opts): self.num_cpus_per_task = self.stream_cpus_per_task[partition.fullname] - super().setup(partition, environ, **job_opts) - - self.reference = self.stream_bw_reference[self.current_environ.name] + self.reference = self.stream_bw_reference[environ.name] # On SLURM there is no need to set OMP_NUM_THREADS if one defines # num_cpus_per_task, but adding for completeness and portability - self.current_environ.variables['OMP_NUM_THREADS'] = str( + self.variables['OMP_NUM_THREADS'] = str( self.num_cpus_per_task) - if self.current_environ.name == 'PrgEnv-pgi': - self.current_environ.variables['OMP_PROC_BIND'] = 'true' + if environ.name == 'PrgEnv-pgi': + self.variables['OMP_PROC_BIND'] = 'true' - self.build_system.cflags = self.prgenv_flags[self.current_environ.name] + self.build_system.cflags = self.prgenv_flags[environ.name] + super().setup(partition, environ, **job_opts) From 4f9e2484e25d5c0d41f0761418760fd0c4a98883 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 23 Aug 2018 10:39:43 +0200 Subject: [PATCH 3/3] Address PR comments (version 2) --- cscs-checks/microbenchmarks/stream/stream.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cscs-checks/microbenchmarks/stream/stream.py b/cscs-checks/microbenchmarks/stream/stream.py index 8f295adc45..05c144c3a7 100644 --- a/cscs-checks/microbenchmarks/stream/stream.py +++ b/cscs-checks/microbenchmarks/stream/stream.py @@ -88,8 +88,7 @@ def setup(self, partition, environ, **job_opts): self.reference = self.stream_bw_reference[environ.name] # On SLURM there is no need to set OMP_NUM_THREADS if one defines # num_cpus_per_task, but adding for completeness and portability - self.variables['OMP_NUM_THREADS'] = str( - self.num_cpus_per_task) + self.variables['OMP_NUM_THREADS'] = str(self.num_cpus_per_task) if environ.name == 'PrgEnv-pgi': self.variables['OMP_PROC_BIND'] = 'true'