Skip to content

Commit 18c8877

Browse files
authored
Merge branch 'master' into regression_test/prgenv_build_systems
2 parents 0b10442 + 0d168ad commit 18c8877

File tree

11 files changed

+440
-141
lines changed

11 files changed

+440
-141
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: python
22
python:
33
- "3.5"
44
- "3.6"
5+
- "3.7-dev"
56

67
install:
78
- pip install -r requirements.txt

cscs-checks/microbenchmarks/osu/osu_tests.py

Lines changed: 67 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import os
2-
import itertools
1+
import reframe as rfm
32
import reframe.utility.sanity as sn
43

5-
from reframe.core.pipeline import RegressionTest
64

7-
8-
class AlltoallBaseTest(RegressionTest):
9-
def __init__(self, name, **kwargs):
10-
super().__init__(name,
11-
os.path.dirname(__file__), **kwargs)
5+
@rfm.parameterized_test(['production'])
6+
class AlltoallTest(rfm.RegressionTest):
7+
def __init__(self, variant):
8+
super().__init__()
129
self.strict_check = False
1310
self.valid_systems = ['daint:gpu', 'dom:gpu']
1411
self.descr = 'Alltoall osu microbenchmark'
12+
self.build_system = 'Make'
13+
self.build_system.makefile = 'Makefile_alltoall'
1514
self.executable = './osu_alltoall'
1615
# The -x option controls the number of warm-up iterations
1716
# The -i option controls the number of iterations
@@ -24,6 +23,15 @@ def __init__(self, name, **kwargs):
2423
'perf': sn.extractsingle(r'^8\s+(?P<perf>\S+)',
2524
self.stdout, 'perf', float)
2625
}
26+
self.tags = {variant}
27+
self.reference = {
28+
'dom:gpu': {
29+
'perf': (8.23, None, 0.1)
30+
},
31+
'daint:gpu': {
32+
'perf': (20.73, None, 2.0)
33+
},
34+
}
2735
self.num_tasks_per_node = 1
2836
self.num_gpus_per_node = 1
2937
if self.current_system.name == 'dom':
@@ -38,28 +46,11 @@ def __init__(self, name, **kwargs):
3846
}
3947
}
4048

41-
def compile(self):
42-
super().compile(makefile='Makefile_alltoall')
4349

44-
45-
class AlltoallProdTest(AlltoallBaseTest):
46-
def __init__(self, **kwargs):
47-
super().__init__('alltoall_osu_microbenchmark', **kwargs)
48-
self.tags = {'production'}
49-
self.reference = {
50-
'dom:gpu': {
51-
'perf': (8.23, None, 0.1)
52-
},
53-
'daint:gpu': {
54-
'perf': (20.73, None, 2.0)
55-
},
56-
}
57-
58-
59-
class AlltoallMonchAcceptanceTest(AlltoallBaseTest):
60-
def __init__(self, num_tasks, **kwargs):
61-
super().__init__('alltoall_osu_microbenchmark_monch_%s'
62-
% num_tasks, **kwargs)
50+
@rfm.parameterized_test(*({'num_tasks': i} for i in range(2, 10, 2)))
51+
class AlltoallMonchAcceptanceTest(AlltoallTest):
52+
def __init__(self, num_tasks):
53+
super().__init__('monch_acceptance')
6354
self.valid_systems = ['monch:compute']
6455
self.num_tasks = num_tasks
6556
reference_by_node = {
@@ -79,20 +70,23 @@ def __init__(self, num_tasks, **kwargs):
7970
self.reference = {
8071
'monch:compute': reference_by_node[self.num_tasks]
8172
}
82-
self.tags = {'monch_acceptance'}
8373

8474

85-
class G2GBaseTest(RegressionTest):
86-
def __init__(self, name, **kwargs):
87-
super().__init__('g2g_osu_microbenchmark_p2p_%s' % name,
88-
os.path.dirname(__file__), **kwargs)
75+
class P2PBaseTest(rfm.RegressionTest):
76+
def __init__(self):
77+
super().__init__()
8978
self.exclusive_access = True
9079
self.strict_check = False
9180
self.num_tasks = 2
9281
self.num_tasks_per_node = 1
93-
self.descr = 'G2G microbenchmark P2P ' + name.upper()
94-
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu',
95-
'PrgEnv-intel']
82+
self.descr = 'P2P microbenchmark '
83+
self.build_system = 'Make'
84+
self.build_system.makefile = 'Makefile_p2p'
85+
if self.current_system.name == 'kesch':
86+
self.valid_prog_environs = ['PrgEnv-cray']
87+
else:
88+
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu',
89+
'PrgEnv-intel']
9690
self.maintainers = ['RS', 'VK']
9791
self.tags = {'production'}
9892
self.sanity_patterns = sn.assert_found(r'^4194304', self.stdout)
@@ -103,34 +97,16 @@ def __init__(self, name, **kwargs):
10397
}
10498
}
10599

106-
def setup(self, partition, environ, **job_opts):
107-
if partition.name == 'gpu':
108-
self.num_gpus_per_node = 1
109-
self.modules = ['cudatoolkit']
110-
self.variables = {'MPICH_RDMA_ENABLED_CUDA': '1'}
111100

112-
if partition.name == 'cn':
113-
self.variables = {'MV2_USE_CUDA': '1'}
114-
115-
super().setup(partition, environ, **job_opts)
116-
if self.num_gpus_per_node >= 1:
117-
self.current_environ.cflags = ' -D_ENABLE_CUDA_ -DCUDA_ENABLED '
118-
119-
def compile(self):
120-
super().compile(makefile='Makefile_g2g')
121-
122-
123-
class G2GCPUBandwidthTest(G2GBaseTest):
124-
def __init__(self, **kwargs):
125-
super().__init__('cpu_bandwidth', **kwargs)
101+
@rfm.simple_test
102+
class P2PCPUBandwidthTest(P2PBaseTest):
103+
def __init__(self):
104+
super().__init__()
126105
self.valid_systems = ['daint:gpu', 'daint:mc',
127106
'dom:gpu', 'dom:mc',
128107
'monch:compute',
129108
'kesch:cn']
130-
if self.current_system.name == 'kesch':
131-
self.valid_prog_environs = ['PrgEnv-cray']
132-
133-
self.executable = './g2g_osu_bw'
109+
self.executable = './p2p_osu_bw'
134110
self.executable_opts = ['-x', '100', '-i', '1000']
135111

136112
self.reference = {
@@ -160,18 +136,17 @@ def __init__(self, **kwargs):
160136
self.tags |= {'monch_acceptance'}
161137

162138

163-
class G2GCPULatencyTest(G2GBaseTest):
164-
def __init__(self, **kwargs):
165-
super().__init__('cpu_latency', **kwargs)
139+
@rfm.simple_test
140+
class P2PCPULatencyTest(P2PBaseTest):
141+
def __init__(self):
142+
super().__init__()
166143
self.valid_systems = ['daint:gpu', 'daint:mc',
167144
'dom:gpu', 'dom:mc',
168145
'monch:compute',
169146
'kesch:cn']
170-
if self.current_system.name == 'kesch':
171-
self.valid_prog_environs = ['PrgEnv-cray']
172147
self.executable_opts = ['-x', '100', '-i', '1000']
173148

174-
self.executable = './g2g_osu_latency'
149+
self.executable = './p2p_osu_latency'
175150
self.reference = {
176151
'daint:gpu': {
177152
'latency': (1.16, None, 1.0)
@@ -199,15 +174,13 @@ def __init__(self, **kwargs):
199174
self.tags |= {'monch_acceptance'}
200175

201176

202-
class G2GCUDABandwidthTest(G2GBaseTest):
203-
def __init__(self, **kwargs):
204-
super().__init__('gpu_bandwidth', **kwargs)
177+
@rfm.simple_test
178+
class G2GBandwidthTest(P2PBaseTest):
179+
def __init__(self):
180+
super().__init__()
205181
self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn']
206-
if self.current_system.name == 'kesch':
207-
self.valid_prog_environs = ['PrgEnv-cray']
208-
209182
self.num_gpus_per_node = 1
210-
self.executable = './g2g_osu_bw'
183+
self.executable = './p2p_osu_bw'
211184
self.executable_opts = ['-x', '100', '-i', '1000', '-d',
212185
'cuda', 'D', 'D']
213186

@@ -226,17 +199,24 @@ def __init__(self, **kwargs):
226199
'bw': sn.extractsingle(r'^4194304\s+(?P<bw>\S+)',
227200
self.stdout, 'bw', float)
228201
}
202+
if self.current_system.name in ['daint', 'dom']:
203+
self.num_gpus_per_node = 1
204+
self.modules = ['craype-accel-nvidia60']
205+
self.variables = {'MPICH_RDMA_ENABLED_CUDA': '1'}
229206

230-
231-
class G2GCUDALatencyTest(G2GBaseTest):
232-
def __init__(self, **kwargs):
233-
super().__init__('gpu_latency', **kwargs)
234-
self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn']
235207
if self.current_system.name == 'kesch':
236-
self.valid_prog_environs = ['PrgEnv-cray']
208+
self.variables = {'MV2_USE_CUDA': '1'}
209+
210+
self.build_system.cppflags = ['-D_ENABLE_CUDA_']
237211

212+
213+
@rfm.simple_test
214+
class G2GLatencyTest(P2PBaseTest):
215+
def __init__(self):
216+
super().__init__()
217+
self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn']
238218
self.num_gpus_per_node = 1
239-
self.executable = './g2g_osu_latency'
219+
self.executable = './p2p_osu_latency'
240220
self.executable_opts = ['-x', '100', '-i', '1000', '-d',
241221
'cuda', 'D', 'D']
242222

@@ -255,14 +235,12 @@ def __init__(self, **kwargs):
255235
'latency': sn.extractsingle(r'^8\s+(?P<latency>\S+)',
256236
self.stdout, 'latency', float)
257237
}
238+
if self.current_system.name in ['daint', 'dom']:
239+
self.num_gpus_per_node = 1
240+
self.modules = ['craype-accel-nvidia60']
241+
self.variables = {'MPICH_RDMA_ENABLED_CUDA': '1'}
258242

243+
if self.current_system.name == 'kesch':
244+
self.variables = {'MV2_USE_CUDA': '1'}
259245

260-
def _get_checks(**kwargs):
261-
fixed_tests = [AlltoallProdTest(**kwargs),
262-
G2GCPUBandwidthTest(**kwargs),
263-
G2GCPULatencyTest(**kwargs),
264-
G2GCUDABandwidthTest(**kwargs),
265-
G2GCUDALatencyTest(**kwargs)]
266-
return list(itertools.chain(fixed_tests,
267-
map(lambda n: AlltoallMonchAcceptanceTest(
268-
n, **kwargs), range(2, 10, 2))))
246+
self.build_system.cppflags = ['-D_ENABLE_CUDA_']

cscs-checks/microbenchmarks/osu/src/Makefile_alltoall

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ EXECUTABLE := osu_alltoall
33
all: $(EXECUTABLE)
44

55
SRCS += osu_util.c \
6-
osu_alltoall.c
6+
osu_alltoall.c
77

88
OBJS := $(SRCS:.c=.o)
99

1010
$(OBJS):
11-
$(CC) $(CFLAGS) -o $(@) -c $(@:.o=.c)
11+
$(CC) $(CPPFLAGS) $(CFLAGS) -o $(@) -c $(@:.o=.c)
1212

1313
$(EXECUTABLE): $(OBJS)
14-
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(@)
14+
$(CC) $(CPPFLAGS) $(CFLAGS) -o $(@) $(OBJS) $(LDFLAGS)
1515

1616
clean:
1717
rm -f $(OBJS) $(EXECUTABLE)
18-

cscs-checks/microbenchmarks/osu/src/Makefile_g2g

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
EXECUTABLES := p2p_osu_bw p2p_osu_latency
2+
3+
all: $(EXECUTABLES)
4+
5+
SRCS += osu_util.c \
6+
osu_latency.c \
7+
osu_bw.c
8+
9+
OBJS_BW = osu_util.o osu_bw.o
10+
OBJS_LT = osu_util.o osu_latency.o
11+
12+
OBJS := $(SRCS:.c=.o)
13+
14+
$(OBJS):
15+
$(CC) $(CPPFLAGS) $(CXXFLAGS) -o $(@) -c $(@:.o=.c)
16+
17+
p2p_osu_bw: $(OBJS_BW)
18+
$(CC) $(CPPFLAGS) $(CXXFLAGS) -o $(@) $(OBJS_BW) $(LDFLAGS)
19+
20+
p2p_osu_latency: $(OBJS_LT)
21+
$(CC) $(CPPFLAGS) $(CXXFLAGS) -o $(@) $(OBJS_LT) $(LDFLAGS)
22+
23+
clean:
24+
rm -f $(OBJS) $(EXECUTABLES)

cscs-checks/tools/profiling_and_debugging/scorep_mpi_omp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import reframe as rfm
24
import reframe.utility.sanity as sn
35

@@ -32,8 +34,7 @@ def __init__(self, lang):
3234
if lang == 'F90':
3335
self.build_system.max_concurrency = 1
3436

35-
self.sourcesdir = 'src/%s' % lang
36-
self.build_system.srcdir = self.sourcesdir
37+
self.sourcesdir = os.path.join('src', lang)
3738
self.num_tasks = 3
3839
self.num_tasks_per_node = 3
3940
self.num_cpus_per_task = 4

docs/advanced.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The important bit here is how we set up the build system for this test:
4747
:dedent: 4
4848

4949

50-
First, we set the build system to ``Make`` and then set the preprocessor flags for the compilation.
50+
First, we set the build system to :attr:`Make <reframe.core.buildsystems.Make>` and then set the preprocessor flags for the compilation.
5151
ReFrame will invoke ``make`` as follows:
5252

5353
.. code::
@@ -76,7 +76,7 @@ If you want to limit build concurrency, you can do it as follows:
7676
7777
7878
Finally, you may also customize the name of the ``Makefile``.
79-
You can achieve that by setting the corresponding variable of the ``Make`` build system:
79+
You can achieve that by setting the corresponding variable of the :class:`Make <reframe.core.buildsystems.Make>` build system:
8080

8181
.. code-block:: python
8282
@@ -122,13 +122,15 @@ Add a configuration step before compiling the code
122122
==================================================
123123

124124
It is often the case that a configuration step is needed before compiling a code with ``make``.
125-
Currently, ReFrame does not provide specific abstractions for "configure-make"-style build systems.
126-
However, you can achieve the same effect using the :attr:`prebuild_cmd <reframe.core.pipeline.RegressionTest.prebuild_cmd>` for performing the configuration step.
127-
The following code snippet will configure a code with ``cmake`` before invoking ``make``:
125+
To address this kind of projects, ReFrame aims to offer specific abstractions for "configure-make"-style build systems.
126+
It supports `CMake-based <https://cmake.org/>`__ projects through the :class:`CMake <reframe.core.buildsystems.CMake>` build system, as well as `Autotools-based <https://www.gnu.org/software/automake/>`__ projects through the :class:`Autotools <reframe.core.buildsystems.Autotools>` build system.
127+
128+
For other build systems, you can achieve the same effect using the :class:`Make <reframe.core.buildsystems.Make>` build system and the :attr:`prebuild_cmd <reframe.core.pipeline.RegressionTest.prebuild_cmd>` for performing the configuration step.
129+
The following code snippet will configure a code with ``./custom_configure`` before invoking ``make``:
128130

129131
.. code-block:: python
130132
131-
self.prebuild_cmd = ['cmake -DUSE_LIBNUMA .']
133+
self.prebuild_cmd = ['./custom_configure -with-mylib']
132134
self.build_system = 'Make'
133135
self.build_system.cppflags = ['-DHAVE_FOO']
134136
self.build_system.flags_from_environ = False
@@ -137,7 +139,7 @@ The generated build script then will have the following lines:
137139

138140
.. code-block:: bash
139141
140-
cmake -DUSE_LIBNUMA .
142+
./custom_configure -with-mylib
141143
make -j CPPFLAGS='-DHAVE_FOO'
142144
143145

docs/tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ Assuming our test supported only GCC, we could simply add the following lines in
354354
self.build_system = 'SingleSource'
355355
self.build_system.cflags = ['-fopenmp']
356356
357-
The ``SingleSource`` build system that we use here supports the compilation of a single file only.
357+
The :class:`SingleSource <reframe.core.buildsystems.SingleSource>` build system that we use here supports the compilation of a single file only.
358358
Each build system type defines a set of variables that the user can set.
359359
Based on the selected build system, ReFrame will generate a build script that will be used for building the code.
360360
The generated build script can be found in `the stage or the output directory of the test <running.html#configuring-reframe-directories>`__, along with the output of the compilation.

0 commit comments

Comments
 (0)