Skip to content

Commit 10b693c

Browse files
authored
Merge pull request #1 from jjotero/test/automatic_arrays_acc
Update syntax of `AutomaticArraysCheck`
2 parents bd77192 + c05cf50 commit 10b693c

File tree

1 file changed

+44
-39
lines changed

1 file changed

+44
-39
lines changed

cscs-checks/mch/automatic_arrays_acc.py

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,29 @@
1010

1111
@rfm.simple_test
1212
class AutomaticArraysCheck(rfm.RegressionTest):
13-
def __init__(self):
14-
self.valid_systems = ['daint:gpu', 'dom:gpu', 'arolla:cn', 'tsa:cn']
15-
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-cce', 'PrgEnv-pgi',
16-
'PrgEnv-nvidia']
13+
valid_systems = ['daint:gpu', 'dom:gpu', 'arolla:cn', 'tsa:cn']
14+
valid_prog_environs = [
15+
'PrgEnv-cray', 'PrgEnv-cce', 'PrgEnv-pgi', 'PrgEnv-nvidia'
16+
]
17+
num_tasks = 1
18+
num_gpus_per_node = 1
19+
num_tasks_per_node = 1
20+
sourcepath = 'automatic_arrays_OpenACC.F90'
21+
build_system = 'SingleSource'
22+
maintainers = ['AJ', 'MKr']
23+
tags = {'production', 'mch', 'craype'}
24+
envname = variable(str)
25+
26+
@run_after('setup')
27+
def set_exclusive_access(self):
1728
if self.current_system.name in ['arolla', 'tsa']:
1829
self.exclusive_access = True
1930

31+
@run_before('compile')
32+
def setflags(self):
2033
# This tets requires an MPI compiler, although it uses a single task
21-
self.num_tasks = 1
22-
self.num_gpus_per_node = 1
23-
self.num_tasks_per_node = 1
24-
self.sourcepath = 'automatic_arrays_OpenACC.F90'
25-
self.build_system = 'SingleSource'
2634
self.build_system.fflags = ['-O2']
27-
self.sanity_patterns = sn.assert_found(r'Result: ', self.stdout)
28-
self.perf_patterns = {
29-
'time': sn.extractsingle(r'Timing:\s+(?P<time>\S+)',
30-
self.stdout, 'time', float)
31-
}
32-
self.arrays_reference = {
33-
'PrgEnv-cray': {
34-
'daint:gpu': {'time': (5.7E-05, None, 0.15, 's')},
35-
'dom:gpu': {'time': (5.7E-05, None, 0.15, 's')},
36-
},
37-
'PrgEnv-pgi': {
38-
'daint:gpu': {'time': (7.5E-05, None, 0.15, 's')},
39-
'dom:gpu': {'time': (7.5e-05, None, 0.15, 's')},
40-
},
41-
'PrgEnv-nvidia': {
42-
'daint:gpu': {'time': (7.5E-05, None, 0.15, 's')},
43-
'dom:gpu': {'time': (7.5e-05, None, 0.15, 's')},
44-
}
45-
}
46-
47-
self.maintainers = ['AJ', 'MKr']
48-
self.tags = {'production', 'mch', 'craype'}
4935

50-
@run_before('compile')
51-
def setflags(self):
5236
if self.current_system.name in ['daint', 'dom']:
5337
if not self.current_environ.name.startswith('PrgEnv-nvidia'):
5438
self.modules = ['craype-accel-nvidia60']
@@ -57,22 +41,20 @@ def setflags(self):
5741
'-Mnorpath']
5842

5943
if self.current_environ.name.startswith('PrgEnv-cray'):
60-
envname = 'PrgEnv-cray'
44+
self.envname = 'PrgEnv-cray'
6145
self.build_system.fflags += ['-hacc', '-hnoomp']
6246
elif self.current_environ.name.startswith('PrgEnv-cce'):
63-
envname = 'PrgEnv-cce'
47+
self.envname = 'PrgEnv-cce'
6448
self.build_system.fflags += ['-hacc', '-hnoomp']
6549
elif self.current_environ.name.startswith('PrgEnv-pgi'):
66-
envname = 'PrgEnv-pgi'
50+
self.envname = 'PrgEnv-pgi'
6751
self.build_system.fflags += ['-acc']
6852
if self.current_system.name in ['arolla', 'tsa']:
6953
self.build_system.fflags += ['-ta=tesla,cc70']
7054
elif self.current_system.name in ['daint', 'dom']:
7155
self.build_system.fflags += ['-ta=tesla,cc60', '-Mnorpath']
7256
else:
73-
envname = self.current_environ.name
74-
75-
self.reference = self.arrays_reference[envname]
57+
self.envname = self.current_environ.name
7658

7759
@run_before('compile')
7860
def cdt2008_pgi_workaround(self):
@@ -82,3 +64,26 @@ def cdt2008_pgi_workaround(self):
8264

8365
if (self.current_environ.name == 'PrgEnv-pgi' and cdt == '20.08'):
8466
self.variables.update({'CUDA_HOME': '$CUDATOOLKIT_HOME'})
67+
68+
@run_before('sanity')
69+
def set_sanity_and_perf_patterns(self):
70+
self.sanity_patterns = sn.assert_found(r'Result: ', self.stdout)
71+
self.perf_patterns = {
72+
'time': sn.extractsingle(r'Timing:\s+(?P<time>\S+)',
73+
self.stdout, 'time', float)
74+
}
75+
self.arrays_reference = {
76+
'PrgEnv-cray': {
77+
'daint:gpu': {'time': (5.7E-05, None, 0.15, 's')},
78+
'dom:gpu': {'time': (5.7E-05, None, 0.15, 's')},
79+
},
80+
'PrgEnv-pgi': {
81+
'daint:gpu': {'time': (7.5E-05, None, 0.15, 's')},
82+
'dom:gpu': {'time': (7.5e-05, None, 0.15, 's')},
83+
},
84+
'PrgEnv-nvidia': {
85+
'daint:gpu': {'time': (7.5E-05, None, 0.15, 's')},
86+
'dom:gpu': {'time': (7.5e-05, None, 0.15, 's')},
87+
}
88+
}
89+
self.reference = self.arrays_reference[self.envname]

0 commit comments

Comments
 (0)