Skip to content

Commit 71d0461

Browse files
authored
Merge pull request #420 from teojgo/regression_test/stream_build_systems
[test] Adapt stream microbenchmark test to build systems
2 parents 84a93d5 + fb028c6 commit 71d0461

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

cscs-checks/microbenchmarks/stream/stream.py

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import os
1+
import reframe as rfm
22
import reframe.utility.sanity as sn
33

4-
from reframe.core.pipeline import RegressionTest
54

6-
7-
class StreamTest(RegressionTest):
8-
def __init__(self, **kwargs):
9-
super().__init__('stream_benchmark',
10-
os.path.dirname(__file__), **kwargs)
5+
@rfm.simple_test
6+
class StreamTest(rfm.RegressionTest):
7+
def __init__(self):
8+
super().__init__()
119
self.descr = 'STREAM Benchmark'
1210
self.exclusive_access = True
1311
# All available systems are supported
@@ -17,13 +15,13 @@ def __init__(self, **kwargs):
1715
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu',
1816
'PrgEnv-intel', 'PrgEnv-pgi']
1917
self.prgenv_flags = {
20-
'PrgEnv-cray': ' -homp ',
21-
'PrgEnv-gnu': ' -fopenmp -O3',
22-
'PrgEnv-intel': ' -qopenmp -O3',
23-
'PrgEnv-pgi': ' -mp -O3'
18+
'PrgEnv-cray': ['-homp'],
19+
'PrgEnv-gnu': ['-fopenmp', '-O3'],
20+
'PrgEnv-intel': ['-qopenmp', '-O3'],
21+
'PrgEnv-pgi': ['-mp', '-O3']
2422
}
2523
self.sourcepath = 'stream.c'
26-
self.tags = {'production', 'monch_acceptance'}
24+
self.build_system = 'SingleSource'
2725
self.sanity_patterns = sn.assert_found(
2826
r'Solution Validates: avg error less than', self.stdout)
2927
self.num_tasks = 1
@@ -41,7 +39,7 @@ def __init__(self, **kwargs):
4139

4240
self.variables = {
4341
'OMP_PLACES': 'threads',
44-
'OMP_PROC_BIND': 'spread',
42+
'OMP_PROC_BIND': 'spread'
4543
}
4644
self.stream_bw_reference = {
4745
'PrgEnv-cray': {
@@ -82,25 +80,17 @@ def __init__(self, **kwargs):
8280
self.stdout, 'triad', float)
8381
}
8482

83+
self.tags = {'production', 'monch_acceptance'}
8584
self.maintainers = ['RS', 'VK']
8685

8786
def setup(self, partition, environ, **job_opts):
8887
self.num_cpus_per_task = self.stream_cpus_per_task[partition.fullname]
89-
super().setup(partition, environ, **job_opts)
90-
91-
self.reference = self.stream_bw_reference[self.current_environ.name]
88+
self.reference = self.stream_bw_reference[environ.name]
9289
# On SLURM there is no need to set OMP_NUM_THREADS if one defines
9390
# num_cpus_per_task, but adding for completeness and portability
94-
self.current_environ.variables['OMP_NUM_THREADS'] = \
95-
str(self.num_cpus_per_task)
96-
if self.current_environ.name == 'PrgEnv-pgi':
97-
self.current_environ.variables['OMP_PROC_BIND'] = 'true'
98-
99-
def compile(self):
100-
prgenv_flags = self.prgenv_flags[self.current_environ.name]
101-
self.current_environ.cflags = prgenv_flags
102-
super().compile()
91+
self.variables['OMP_NUM_THREADS'] = str(self.num_cpus_per_task)
92+
if environ.name == 'PrgEnv-pgi':
93+
self.variables['OMP_PROC_BIND'] = 'true'
10394

104-
105-
def _get_checks(**kwargs):
106-
return [StreamTest(**kwargs)]
95+
self.build_system.cflags = self.prgenv_flags[environ.name]
96+
super().setup(partition, environ, **job_opts)

0 commit comments

Comments
 (0)