forked from reframe-hpc/reframe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample2.py
More file actions
67 lines (60 loc) · 2.5 KB
/
Copy pathexample2.py
File metadata and controls
67 lines (60 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import reframe as rfm
import reframe.utility.sanity as sn
@rfm.simple_test
class Example2aTest(rfm.RegressionTest):
def __init__(self):
self.descr = 'Matrix-vector multiplication example with OpenMP'
self.valid_systems = ['*']
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu',
'PrgEnv-intel', 'PrgEnv-pgi']
self.sourcepath = 'example_matrix_vector_multiplication_openmp.c'
self.build_system = 'SingleSource'
self.executable_opts = ['1024', '100']
self.variables = {
'OMP_NUM_THREADS': '4'
}
self.sanity_patterns = sn.assert_found(
r'time for single matrix vector multiplication', self.stdout)
self.maintainers = ['you-can-type-your-email-here']
self.tags = {'tutorial'}
@rfm.run_before('compile')
def setflags(self):
env = self.current_environ.name
if env == 'PrgEnv-cray':
self.build_system.cflags = ['-homp']
elif env == 'PrgEnv-gnu':
self.build_system.cflags = ['-fopenmp']
elif env == 'PrgEnv-intel':
self.build_system.cflags = ['-openmp']
elif env == 'PrgEnv-pgi':
self.build_system.cflags = ['-mp']
@rfm.simple_test
class Example2bTest(rfm.RegressionTest):
def __init__(self):
self.descr = 'Matrix-vector multiplication example with OpenMP'
self.valid_systems = ['*']
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu',
'PrgEnv-intel', 'PrgEnv-pgi']
self.sourcepath = 'example_matrix_vector_multiplication_openmp.c'
self.build_system = 'SingleSource'
self.executable_opts = ['1024', '100']
self.prgenv_flags = {
'PrgEnv-cray': ['-homp'],
'PrgEnv-gnu': ['-fopenmp'],
'PrgEnv-intel': ['-openmp'],
'PrgEnv-pgi': ['-mp']
}
self.variables = {
'OMP_NUM_THREADS': '4'
}
self.sanity_patterns = sn.assert_found(
r'time for single matrix vector multiplication', self.stdout)
self.maintainers = ['you-can-type-your-email-here']
self.tags = {'tutorial'}
@rfm.run_before('compile')
def setflags(self):
self.build_system.cflags = self.prgenv_flags[self.current_environ.name]