Skip to content

Commit fe31d9d

Browse files
authored
Merge branch 'master' into regresstion_test/gpu_bandwidth_build_systems
2 parents d55bb51 + 0e26e8c commit fe31d9d

File tree

9 files changed

+119
-112
lines changed

9 files changed

+119
-112
lines changed

cscs-checks/prgenv/helloworld.py

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
import os
21
from datetime import datetime
32

3+
import reframe as rfm
44
import reframe.utility.sanity as sn
5-
from reframe.core.pipeline import RegressionTest
65

76

8-
class HelloWorldBaseTest(RegressionTest):
9-
def __init__(self, name, lang, linkage, **kwargs):
10-
super().__init__('hello_world_%s_%s_%s' % (name, linkage, lang),
11-
os.path.dirname(__file__), **kwargs)
12-
7+
class HelloWorldBaseTest(rfm.RegressionTest):
8+
def __init__(self, variant, lang, linkage):
9+
super().__init__()
1310
if self.current_system.name in ['dom', 'daint']:
1411
self.modules += ['gcc/6.1.0']
1512

@@ -20,10 +17,9 @@ def __init__(self, name, lang, linkage, **kwargs):
2017
'cpp': 'C++',
2118
'f90': 'Fortran 90'
2219
}
23-
2420
self.descr = self.lang_names[lang] + ' Hello World'
2521
self.sourcepath = 'hello_world'
26-
22+
self.build_system = 'SingleSource'
2723
self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc',
2824
'kesch:cn', 'kesch:pn', 'leone:normal',
2925
'monch:compute']
@@ -49,18 +45,30 @@ def setup(self, partition, environ, **job_opts):
4945
self.sanity_patterns = sn.all(
5046
sn.chain([sn.assert_eq(sn.count(result), self.num_tasks *
5147
self.num_cpus_per_task)],
52-
sn.map(lambda x: sn.assert_lt(int(x.group(1)), int(x.group(2))),
53-
result),
54-
sn.map(lambda x: sn.assert_lt(int(x.group(3)), int(x.group(4))),
55-
result),
56-
sn.map(lambda x: sn.assert_lt(int(x.group(1)),
57-
self.num_cpus_per_task), result),
58-
sn.map(lambda x: sn.assert_eq(int(x.group(2)),
59-
self.num_cpus_per_task), result),
60-
sn.map(lambda x: sn.assert_lt(int(x.group(3)),
61-
self.num_tasks), result),
62-
sn.map(lambda x: sn.assert_eq(int(x.group(4)), self.num_tasks),
63-
result),
48+
sn.map(
49+
lambda x: sn.assert_lt(int(x.group(1)),
50+
int(x.group(2))),
51+
result),
52+
sn.map(
53+
lambda x: sn.assert_lt(int(x.group(3)),
54+
int(x.group(4))),
55+
result),
56+
sn.map(
57+
lambda x: sn.assert_lt(int(x.group(1)),
58+
self.num_cpus_per_task),
59+
result),
60+
sn.map(
61+
lambda x: sn.assert_eq(int(x.group(2)),
62+
self.num_cpus_per_task),
63+
result),
64+
sn.map(
65+
lambda x: sn.assert_lt(int(x.group(3)),
66+
self.num_tasks),
67+
result),
68+
sn.map(
69+
lambda x: sn.assert_eq(int(x.group(4)),
70+
self.num_tasks),
71+
result),
6472
)
6573
)
6674

@@ -73,46 +81,51 @@ def setup(self, partition, environ, **job_opts):
7381
}
7482
}
7583
super().setup(partition, environ, **job_opts)
76-
77-
def compile(self):
7884
prgenv_flags = self.prgenv_flags[self.current_environ.name]
79-
self.current_environ.cflags = prgenv_flags
80-
self.current_environ.cxxflags = prgenv_flags
81-
self.current_environ.fflags = prgenv_flags
85+
self.build_system.cflags = prgenv_flags
86+
self.build_system.cxxflags = prgenv_flags
87+
self.build_system.fflags = prgenv_flags
8288

89+
def compile(self):
8390
self.compilation_time_seconds = datetime.now()
8491
super().compile()
8592
self.compilation_time_seconds = (
8693
datetime.now() - self.compilation_time_seconds).total_seconds()
8794

8895

96+
@rfm.parameterized_test(*([lang, linkage]
97+
for lang in ['cpp', 'c', 'f90']
98+
for linkage in ['dynamic', 'static']))
8999
class HelloWorldTestSerial(HelloWorldBaseTest):
90100
def __init__(self, lang, linkage, **kwargs):
91101
super().__init__('serial', lang, linkage, **kwargs)
92102

93103
self.sourcepath += '_serial.' + lang
94104
self.descr += ' Serial ' + linkage.capitalize()
95105
self.prgenv_flags = {
96-
'PrgEnv-cray': '',
97-
'PrgEnv-gnu': '',
98-
'PrgEnv-intel': '',
99-
'PrgEnv-pgi': ''
106+
'PrgEnv-cray': [],
107+
'PrgEnv-gnu': [],
108+
'PrgEnv-intel': [],
109+
'PrgEnv-pgi': []
100110
}
101111
self.num_tasks = 1
102112
self.num_tasks_per_node = 1
103113
self.num_cpus_per_task = 1
104114

105115

116+
@rfm.parameterized_test(*([lang, linkage]
117+
for lang in ['cpp', 'c', 'f90']
118+
for linkage in ['dynamic', 'static']))
106119
class HelloWorldTestOpenMP(HelloWorldBaseTest):
107-
def __init__(self, lang, linkage, **kwargs):
108-
super().__init__('openmp', lang, linkage, **kwargs)
120+
def __init__(self, lang, linkage):
121+
super().__init__('openmp', lang, linkage)
109122
self.sourcepath += '_openmp.' + lang
110123
self.descr += ' OpenMP ' + str.capitalize(linkage)
111124
self.prgenv_flags = {
112-
'PrgEnv-cray': ' -homp ',
113-
'PrgEnv-gnu': ' -fopenmp ',
114-
'PrgEnv-intel': ' -qopenmp ',
115-
'PrgEnv-pgi': ' -mp '
125+
'PrgEnv-cray': ['-homp'],
126+
'PrgEnv-gnu': ['-fopenmp'],
127+
'PrgEnv-intel': ['-qopenmp'],
128+
'PrgEnv-pgi': ['-mp']
116129
}
117130
self.num_tasks = 1
118131
self.num_tasks_per_node = 1
@@ -125,16 +138,19 @@ def __init__(self, lang, linkage, **kwargs):
125138
}
126139

127140

141+
@rfm.parameterized_test(*([lang, linkage]
142+
for lang in ['cpp', 'c', 'f90']
143+
for linkage in ['dynamic', 'static']))
128144
class HelloWorldTestMPI(HelloWorldBaseTest):
129-
def __init__(self, lang, linkage, **kwargs):
130-
super().__init__('mpi', lang, linkage, **kwargs)
145+
def __init__(self, lang, linkage):
146+
super().__init__('mpi', lang, linkage)
131147
self.sourcepath += '_mpi.' + lang
132148
self.descr += ' MPI ' + linkage.capitalize()
133149
self.prgenv_flags = {
134-
'PrgEnv-cray': '',
135-
'PrgEnv-gnu': '',
136-
'PrgEnv-intel': '',
137-
'PrgEnv-pgi': ''
150+
'PrgEnv-cray': [],
151+
'PrgEnv-gnu': [],
152+
'PrgEnv-intel': [],
153+
'PrgEnv-pgi': []
138154
}
139155

140156
# for the MPI test the self.num_tasks_per_node should always be one. If
@@ -145,16 +161,19 @@ def __init__(self, lang, linkage, **kwargs):
145161
self.num_cpus_per_task = 1
146162

147163

164+
@rfm.parameterized_test(*([lang, linkage]
165+
for lang in ['cpp', 'c', 'f90']
166+
for linkage in ['dynamic', 'static']))
148167
class HelloWorldTestMPIOpenMP(HelloWorldBaseTest):
149-
def __init__(self, lang, linkage, **kwargs):
150-
super().__init__('mpi_openmp', lang, linkage, **kwargs)
168+
def __init__(self, lang, linkage):
169+
super().__init__('mpi_openmp', lang, linkage)
151170
self.sourcepath += '_mpi_openmp.' + lang
152171
self.descr += ' MPI + OpenMP ' + linkage.capitalize()
153172
self.prgenv_flags = {
154-
'PrgEnv-cray': ' -homp ',
155-
'PrgEnv-gnu': ' -fopenmp ',
156-
'PrgEnv-intel': ' -qopenmp ',
157-
'PrgEnv-pgi': ' -mp '
173+
'PrgEnv-cray': ['-homp'],
174+
'PrgEnv-gnu': ['-fopenmp'],
175+
'PrgEnv-intel': ['-qopenmp'],
176+
'PrgEnv-pgi': ['-mp']
158177
}
159178
self.num_tasks = 6
160179
self.num_tasks_per_node = 3
@@ -165,22 +184,3 @@ def __init__(self, lang, linkage, **kwargs):
165184
self.variables = {
166185
'OMP_NUM_THREADS': str(self.num_cpus_per_task)
167186
}
168-
169-
170-
class HelloWorldTestFactory():
171-
def create(lang, variant, linkage, **kwargs):
172-
if variant == 'serial':
173-
return HelloWorldTestSerial(lang, linkage, **kwargs)
174-
elif variant == 'openmp':
175-
return HelloWorldTestOpenMP(lang, linkage, **kwargs)
176-
elif variant == 'mpi':
177-
return HelloWorldTestMPI(lang, linkage, **kwargs)
178-
elif variant == 'mpi_openmp':
179-
return HelloWorldTestMPIOpenMP(lang, linkage, **kwargs)
180-
181-
182-
def _get_checks(**kwargs):
183-
return [HelloWorldTestFactory.create(lang, variant, linkage, **kwargs)
184-
for lang in ['cpp', 'c', 'f90']
185-
for variant in ['serial', 'openmp', 'mpi', 'mpi_openmp']
186-
for linkage in ['dynamic', 'static']]
Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import os
2-
import reframe.utility.sanity as sn
32

4-
from reframe.core.pipeline import RegressionTest
3+
import reframe as rfm
4+
import reframe.utility.sanity as sn
55

66

7-
class PerftoolsCheck(RegressionTest):
8-
def __init__(self, lang, **kwargs):
9-
super().__init__('perftools_check_' + lang.replace('+', 'p'),
10-
os.path.dirname(__file__), **kwargs)
7+
@rfm.parameterized_test(*([lang] for lang in ['C', 'Cpp', 'F90', 'Cuda']))
8+
class PerftoolsCheck(rfm.RegressionTest):
9+
def __init__(self, lang):
10+
super().__init__()
1111
if lang == 'Cuda':
1212
self.valid_systems = ['daint:gpu', 'dom:gpu']
1313
else:
@@ -22,48 +22,53 @@ def __init__(self, lang, **kwargs):
2222
# FIXME: PGI Fortran is hanging after completion
2323
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu']
2424

25+
# NOTE: Reduce time limit because for PrgEnv-pgi even if the output
26+
# is correct, the batch job uses all the time.
27+
self.time_limit = (0, 1, 0)
28+
2529
self.num_gpus_per_node = 1
2630
self.executable = 'perftools_check'
27-
2831
self.prgenv_flags = {
29-
'PrgEnv-cray': ' -h nomessage=3140 -homp ',
30-
'PrgEnv-gnu': ' -fopenmp ',
31-
'PrgEnv-intel': ' -openmp ',
32-
'PrgEnv-pgi': ' -mp ',
32+
'PrgEnv-cray': ['-g', '-h nomessage=3140', '-homp'],
33+
'PrgEnv-gnu': ['-g', '-fopenmp'],
34+
'PrgEnv-intel': ['-g', '-openmp'],
35+
'PrgEnv-pgi': ['-g', '-mp']
3336
}
34-
3537
if self.current_system.name == 'kesch':
3638
# `-lcudart -lm` must be passed explicitly on kesch
37-
self.prgenv_flags['PrgEnv-gnu'] = ' -fopenmp -lcudart -lm '
39+
self.prgenv_flags['PrgEnv-gnu'] = ['-fopenmp', '-lcudart', '-lm']
3840

3941
self.sanity_patterns = sn.assert_found('Table 1: Profile by Function',
4042
self.stdout)
41-
self.modules = ['perftools-base', 'perftools-lite', 'cudatoolkit']
42-
self.makefile = 'Makefile_perftools'
43-
self.sourcesdir = os.path.join('src', lang)
44-
self.maintainers = ['MK', 'JG']
45-
self.tags = {'production'}
43+
44+
self.modules = ['perftools-lite', 'craype-accel-nvidia60']
45+
self.build_system = 'Make'
46+
self.build_system.makefile = 'Makefile_perftools'
47+
self.build_system.cppflags = ['-D_CSCS_ITMAX=1', '-DUSE_MPI']
48+
self.build_system.options = ['NVCCFLAGS="-arch=sm_60"']
49+
50+
if lang == 'Cpp':
51+
self.sourcesdir = os.path.join('src', 'C++')
52+
else:
53+
self.sourcesdir = os.path.join('src', lang)
54+
55+
# NOTE: Restrict concurrency to allow creation of Fortran modules
56+
if lang == 'F90':
57+
self.build_system.max_concurrency = 1
4658

4759
if lang != 'Cuda':
4860
self.num_tasks_per_node = 2
4961
self.variables = {'OMP_NUM_THREADS': '2'}
5062
else:
5163
self.num_tasks_per_node = 1
5264

53-
def compile(self):
54-
self.flags = ' -g -D_CSCS_ITMAX=1 -DUSE_MPI '
55-
prgenv_flags = self.prgenv_flags[self.current_environ.name]
56-
self.current_environ.cflags = self.flags + prgenv_flags
57-
self.current_environ.cxxflags = self.flags + prgenv_flags
58-
self.current_environ.fflags = self.flags + prgenv_flags
59-
self.current_environ.ldflags = self.flags + prgenv_flags
60-
super().compile(makefile=self.makefile,
61-
options='NVCCFLAGS="-arch=sm_60"')
62-
63-
64-
def _get_checks(**kwargs):
65-
ret = []
66-
for lang in ['C', 'C++', 'F90', 'Cuda']:
67-
ret.append(PerftoolsCheck(lang, **kwargs))
65+
self.maintainers = ['MK', 'JG']
66+
self.tags = {'production'}
6867

69-
return ret
68+
def setup(self, environ, partition, **job_opts):
69+
super().setup(environ, partition, **job_opts)
70+
flags = self.prgenv_flags[self.current_environ.name]
71+
self.build_system.cflags = flags
72+
self.build_system.cxxflags = flags
73+
self.build_system.fflags = flags
74+
self.build_system.ldflags = flags

cscs-checks/tools/profiling_and_debugging/src/C++/Makefile_perftools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LIB =
77
.SUFFIXES: .o .cc
88

99
%.o: %.cc
10-
$(CXX) $(CXXFLAGS) -c $< -o $(PE_ENV)$@
10+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $(PE_ENV)$@
1111

1212
perftools_check: $(OBJ)
1313
$(LD) $(LDFLAGS) $(OBJ2) $(LIB) -o $@

cscs-checks/tools/profiling_and_debugging/src/C/Makefile_perftools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LIB =
77
.SUFFIXES: .o .c
88

99
%.o: %.c
10-
$(CC) $(CFLAGS) -c $< -o $(PE_ENV)$@
10+
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $(PE_ENV)$@
1111

1212
perftools_check: $(OBJ)
1313
$(LD) $(LDFLAGS) $(OBJ2) $(LIB) -o $@

cscs-checks/tools/profiling_and_debugging/src/Cuda/Makefile_perftools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LIB =
1212
.SUFFIXES: .o .c
1313

1414
%.o: %.c
15-
$(CC) $(CFLAGS) $(DDTFLAGS) -c $< -o $(PE_ENV)$@
15+
$(CC) $(CPPFLAGS) $(CFLAGS) $(DDTFLAGS) -c $< -o $(PE_ENV)$@
1616

1717
perftools_check: $(OBJ)
1818
$(LD) $(LDFLAGS) $(OBJ2) $(LIB) -o $@

cscs-checks/tools/profiling_and_debugging/src/F90/Makefile_perftools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LIB =
77
.SUFFIXES: .o .F90
88

99
%.o: %.F90
10-
$(FC) $(FFLAGS) -c $< -o $(PE_ENV)$@
10+
$(FC) $(CPPFLAGS) $(FFLAGS) -c $< -o $(PE_ENV)$@
1111

1212
perftools_check: $(OBJ)
1313
$(LD) $(LDFLAGS) $(OBJ2) $(LIB) -o $@

reframe/core/pipeline.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import reframe.utility.os_ext as os_ext
2222
from reframe.core.buildsystems import BuildSystem, BuildSystemField
2323
from reframe.core.deferrable import deferrable, _DeferredExpression, evaluate
24-
from reframe.core.environments import Environment
24+
from reframe.core.environments import Environment, EnvironmentSnapshot
2525
from reframe.core.exceptions import (BuildError, PipelineError, SanityError,
2626
user_deprecation_warning)
2727
from reframe.core.launchers.registry import getlauncher
@@ -775,12 +775,16 @@ def _setup_environ(self, environ):
775775
for k, v in self.variables.items():
776776
self._current_environ.set_variable(k, v)
777777

778+
# Temporarily load the test's environment to record the actual module
779+
# load/unload sequence
780+
environ_save = EnvironmentSnapshot()
778781
# First load the local environment of the partition
779782
self.logger.debug('loading environment for the current partition')
780783
self._current_partition.local_env.load()
781784

782785
self.logger.debug("loading test's environment")
783786
self._current_environ.load()
787+
environ_save.load()
784788

785789
def _setup_paths(self):
786790
"""Setup the check's dynamic paths."""

reframe/frontend/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ def main():
319319
for d in options.checkpath:
320320
d = os.path.expandvars(d)
321321
if not os.path.exists(d):
322-
printer.info("%s: path `%s' does not exist. Skipping...\n" %
323-
(argparser.prog, d))
322+
printer.warning("%s: path `%s' does not exist. Skipping..." %
323+
(argparser.prog, d))
324324
continue
325325

326326
load_path.append(d)

0 commit comments

Comments
 (0)