Skip to content

Commit 4e6e0f7

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into update-syntax/vasp
2 parents ecb7518 + c79d952 commit 4e6e0f7

File tree

2 files changed

+158
-135
lines changed

2 files changed

+158
-135
lines changed

cscs-checks/apps/cp2k/cp2k_check.py

Lines changed: 100 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,88 @@
88

99

1010
class Cp2kCheck(rfm.RunOnlyRegressionTest):
11-
def __init__(self):
11+
modules = ['CP2K']
12+
executable = 'cp2k.psmp'
13+
executable_opts = ['H2O-256.inp']
14+
maintainers = ['LM']
15+
tags = {'scs'}
16+
strict_check = False
17+
extra_resources = {
18+
'switches': {
19+
'num_switches': 1
20+
}
21+
}
22+
23+
@run_after('init')
24+
def set_prgenv(self):
1225
if self.current_system.name in ['eiger', 'pilatus']:
1326
self.valid_prog_environs = ['cpeGNU']
1427
else:
1528
self.valid_prog_environs = ['builtin']
1629

17-
self.modules = ['CP2K']
18-
self.executable = 'cp2k.psmp'
19-
self.executable_opts = ['H2O-256.inp']
20-
30+
@sanity_function
31+
def assert_energy_diff(self):
2132
energy = sn.extractsingle(
2233
r'\s+ENERGY\| Total FORCE_EVAL \( QS \) '
2334
r'energy [\[\(]a\.u\.[\]\)]:\s+(?P<energy>\S+)',
2435
self.stdout, 'energy', float, item=-1
2536
)
2637
energy_reference = -4404.2323
2738
energy_diff = sn.abs(energy-energy_reference)
28-
self.sanity_patterns = sn.all([
39+
return sn.all([
2940
sn.assert_found(r'PROGRAM STOPPED IN', self.stdout),
3041
sn.assert_eq(sn.count(sn.extractall(
3142
r'(?i)(?P<step_count>STEP NUMBER)',
3243
self.stdout, 'step_count')), 10),
3344
sn.assert_lt(energy_diff, 1e-4)
3445
])
3546

36-
self.perf_patterns = {
37-
'time': sn.extractsingle(r'^ CP2K(\s+[\d\.]+){4}\s+(?P<perf>\S+)',
38-
self.stdout, 'perf', float)
39-
}
40-
41-
self.maintainers = ['LM']
42-
self.tags = {'scs'}
43-
self.strict_check = False
44-
self.extra_resources = {
45-
'switches': {
46-
'num_switches': 1
47-
}
48-
}
47+
@performance_function('s')
48+
def time(self):
49+
return sn.extractsingle(r'^ CP2K(\s+[\d\.]+){4}\s+(?P<perf>\S+)',
50+
self.stdout, 'perf', float)
4951

5052

51-
@rfm.parameterized_test(*([s, v]
52-
for s in ['small', 'large']
53-
for v in ['maint', 'prod']))
53+
@rfm.simple_test
5454
class Cp2kCpuCheck(Cp2kCheck):
55-
def __init__(self, scale, variant):
56-
super().__init__()
57-
self.descr = 'CP2K CPU check (version: %s, %s)' % (scale, variant)
58-
self.valid_systems = ['daint:mc', 'eiger:mc', 'pilatus:mc']
59-
if scale == 'small':
55+
scale = parameter(['small', 'large'])
56+
variant = parameter(['maint', 'prod'])
57+
valid_systems = ['daint:mc', 'eiger:mc', 'pilatus:mc']
58+
references_by_variant = {
59+
'maint': {
60+
'small': {
61+
'dom:mc': {'time': (202.2, None, 0.05, 's')},
62+
'daint:mc': {'time': (180.9, None, 0.08, 's')},
63+
'eiger:mc': {'time': (70.0, None, 0.08, 's')},
64+
'pilatus:mc': {'time': (70.0, None, 0.08, 's')}
65+
},
66+
'large': {
67+
'daint:mc': {'time': (141.0, None, 0.05, 's')},
68+
'eiger:mc': {'time': (46.0, None, 0.05, 's')},
69+
'pilatus:mc': {'time': (46.0, None, 0.05, 's')}
70+
}
71+
},
72+
'prod': {
73+
'small': {
74+
'dom:mc': {'time': (202.2, None, 0.05, 's')},
75+
'daint:mc': {'time': (180.9, None, 0.08, 's')},
76+
'eiger:mc': {'time': (70.0, None, 0.08, 's')},
77+
'pilatus:mc': {'time': (70.0, None, 0.08, 's')}
78+
},
79+
'large': {
80+
'daint:mc': {'time': (113.0, None, 0.05, 's')},
81+
'eiger:mc': {'time': (46.0, None, 0.05, 's')},
82+
'pilatus:mc': {'time': (46.0, None, 0.05, 's')}
83+
}
84+
}
85+
}
86+
87+
@run_after('init')
88+
def setup_by_variant_and_scale(self):
89+
self.descr = f'CP2K CPU check (version: {self.scale}, {self.variant})'
90+
self.tags |= {'maintenance'
91+
if self.variant == 'maint' else 'production'}
92+
if self.scale == 'small':
6093
self.valid_systems += ['dom:mc']
6194
if self.current_system.name in ['daint', 'dom']:
6295
self.num_tasks = 216
@@ -91,37 +124,7 @@ def __init__(self, scale, variant):
91124
'OMP_PROC_BIND': 'close'
92125
}
93126

94-
references = {
95-
'maint': {
96-
'small': {
97-
'dom:mc': {'time': (202.2, None, 0.05, 's')},
98-
'daint:mc': {'time': (180.9, None, 0.08, 's')},
99-
'eiger:mc': {'time': (70.0, None, 0.08, 's')},
100-
'pilatus:mc': {'time': (70.0, None, 0.08, 's')}
101-
},
102-
'large': {
103-
'daint:mc': {'time': (141.0, None, 0.05, 's')},
104-
'eiger:mc': {'time': (46.0, None, 0.05, 's')},
105-
'pilatus:mc': {'time': (46.0, None, 0.05, 's')}
106-
}
107-
},
108-
'prod': {
109-
'small': {
110-
'dom:mc': {'time': (202.2, None, 0.05, 's')},
111-
'daint:mc': {'time': (180.9, None, 0.08, 's')},
112-
'eiger:mc': {'time': (70.0, None, 0.08, 's')},
113-
'pilatus:mc': {'time': (70.0, None, 0.08, 's')}
114-
},
115-
'large': {
116-
'daint:mc': {'time': (113.0, None, 0.05, 's')},
117-
'eiger:mc': {'time': (46.0, None, 0.05, 's')},
118-
'pilatus:mc': {'time': (46.0, None, 0.05, 's')}
119-
}
120-
}
121-
}
122-
123-
self.reference = references[variant][scale]
124-
self.tags |= {'maintenance' if variant == 'maint' else 'production'}
127+
self.reference = self.references_by_variant[self.variant][self.scale]
125128

126129
@run_before('run')
127130
def set_task_distribution(self):
@@ -132,46 +135,48 @@ def set_cpu_binding(self):
132135
self.job.launcher.options = ['--cpu-bind=cores']
133136

134137

135-
@rfm.parameterized_test(*([s, v]
136-
for s in ['small', 'large']
137-
for v in ['maint', 'prod']))
138+
@rfm.simple_test
138139
class Cp2kGpuCheck(Cp2kCheck):
139-
def __init__(self, scale, variant):
140-
super().__init__()
141-
self.descr = 'CP2K GPU check (version: %s, %s)' % (scale, variant)
142-
self.valid_systems = ['daint:gpu']
143-
self.num_gpus_per_node = 1
144-
if scale == 'small':
140+
scale = parameter(['small', 'large'])
141+
variant = parameter(['maint', 'prod'])
142+
valid_systems = ['daint:gpu']
143+
num_gpus_per_node = 1
144+
num_tasks_per_node = 6
145+
num_cpus_per_task = 2
146+
variables = {
147+
'CRAY_CUDA_MPS': '1',
148+
'OMP_NUM_THREADS': str(num_cpus_per_task)
149+
}
150+
references_by_variant = {
151+
'maint': {
152+
'small': {
153+
'dom:gpu': {'time': (251.8, None, 0.15, 's')},
154+
'daint:gpu': {'time': (241.3, None, 0.05, 's')}
155+
},
156+
'large': {
157+
'daint:gpu': {'time': (199.6, None, 0.06, 's')}
158+
}
159+
},
160+
'prod': {
161+
'small': {
162+
'dom:gpu': {'time': (240.0, None, 0.05, 's')},
163+
'daint:gpu': {'time': (241.3, None, 0.05, 's')}
164+
},
165+
'large': {
166+
'daint:gpu': {'time': (199.6, None, 0.06, 's')}
167+
}
168+
}
169+
}
170+
171+
@run_after('init')
172+
def setup_by_variant_and_scale(self):
173+
self.descr = f'CP2K GPU check (version: {self.scale}, {self.variant})'
174+
if self.scale == 'small':
145175
self.valid_systems += ['dom:gpu']
146176
self.num_tasks = 36
147177
else:
148178
self.num_tasks = 96
149179

150-
self.num_tasks_per_node = 6
151-
self.num_cpus_per_task = 2
152-
self.variables = {
153-
'CRAY_CUDA_MPS': '1',
154-
'OMP_NUM_THREADS': str(self.num_cpus_per_task)
155-
}
156-
references = {
157-
'maint': {
158-
'small': {
159-
'dom:gpu': {'time': (251.8, None, 0.15, 's')},
160-
'daint:gpu': {'time': (241.3, None, 0.05, 's')}
161-
},
162-
'large': {
163-
'daint:gpu': {'time': (199.6, None, 0.06, 's')}
164-
}
165-
},
166-
'prod': {
167-
'small': {
168-
'dom:gpu': {'time': (240.0, None, 0.05, 's')},
169-
'daint:gpu': {'time': (241.3, None, 0.05, 's')}
170-
},
171-
'large': {
172-
'daint:gpu': {'time': (199.6, None, 0.06, 's')}
173-
}
174-
}
175-
}
176-
self.reference = references[variant][scale]
177-
self.tags |= {'maintenance' if variant == 'maint' else 'production'}
180+
self.reference = self.references_by_variant[self.variant][self.scale]
181+
self.tags |= {'maintenance'
182+
if self.variant == 'maint' else 'production'}

cscs-checks/apps/cpmd/cpmd_check.py

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,80 @@
33
#
44
# SPDX-License-Identifier: BSD-3-Clause
55

6+
import contextlib
67
import reframe as rfm
78
import reframe.utility.sanity as sn
89

910

10-
@rfm.parameterized_test(['small'], ['large'])
11+
@rfm.simple_test
1112
class CPMDCheck(rfm.RunOnlyRegressionTest):
12-
def __init__(self, scale):
13-
self.descr = 'CPMD check (C4H6 metadynamics)'
14-
self.maintainers = ['AJ', 'LM']
15-
self.tags = {'production'}
13+
scale = parameter(['small', 'large'])
14+
descr = 'CPMD check (C4H6 metadynamics)'
15+
maintainers = ['AJ', 'LM']
16+
tags = {'production'}
17+
valid_systems = ['daint:gpu']
18+
num_tasks_per_node = 1
19+
valid_prog_environs = ['builtin']
20+
modules = ['CPMD']
21+
executable = 'cpmd.x'
22+
executable_opts = ['ana_c4h6.in > stdout.txt']
23+
readonly_files = ['ana_c4h6.in', 'C_MT_BLYP', 'H_MT_BLYP']
24+
use_multithreading = True
25+
strict_check = False
26+
extra_resources = {
27+
'switches': {
28+
'num_switches': 1
29+
}
30+
}
31+
allref = {
32+
'9': {
33+
'p100': {
34+
'time': (285.5, None, 0.20, 's')
35+
},
36+
},
37+
'16': {
38+
'p100': {
39+
'time': (245.0, None, 0.59, 's')
40+
}
41+
}
42+
}
1643

17-
self.valid_systems = ['daint:gpu']
18-
if scale == 'small':
19-
self.num_tasks = 9
44+
@run_after('init')
45+
def setup_by_scale(self):
46+
if self.scale == 'small':
2047
self.valid_systems += ['dom:gpu']
48+
self.num_tasks = 9
2149
else:
2250
self.num_tasks = 16
2351

24-
self.num_tasks_per_node = 1
25-
self.valid_prog_environs = ['builtin']
26-
self.modules = ['CPMD']
27-
self.executable = 'cpmd.x'
28-
self.executable_opts = ['ana_c4h6.in > stdout.txt']
29-
self.readonly_files = ['ana_c4h6.in', 'C_MT_BLYP', 'H_MT_BLYP']
30-
self.use_multithreading = True
31-
self.strict_check = False
32-
self.extra_resources = {
33-
'switches': {
34-
'num_switches': 1
52+
@run_before('performance')
53+
def set_perf_reference(self):
54+
proc = self.current_partition.processor
55+
pname = self.current_partition.fullname
56+
if pname in ('daint:gpu', 'dom:gpu'):
57+
arch = 'p100'
58+
else:
59+
arch = proc.arch
60+
61+
with contextlib.suppress(KeyError):
62+
self.reference = {
63+
pname: {
64+
'perf': self.allref[self.num_tasks][arch][self.benchmark]
65+
}
3566
}
36-
}
3767

68+
@sanity_function
69+
def assert_energy_diff(self):
3870
# OpenMP version of CPMD segfaults
3971
# self.variables = { 'OMP_NUM_THREADS' : '8' }
4072
energy = sn.extractsingle(
4173
r'CLASSICAL ENERGY\s+-(?P<result>\S+)',
4274
'stdout.txt', 'result', float)
4375
energy_reference = 25.81
4476
energy_diff = sn.abs(energy - energy_reference)
45-
self.sanity_patterns = sn.assert_lt(energy_diff, 0.26)
46-
self.perf_patterns = {
47-
'time': sn.extractsingle(r'^ cpmd(\s+[\d\.]+){3}\s+(?P<perf>\S+)',
48-
'stdout.txt', 'perf', float)
49-
}
50-
if scale == 'small':
51-
self.reference = {
52-
'daint:gpu': {
53-
'time': (285.5, None, 0.20, 's')
54-
},
55-
'dom:gpu': {
56-
'time': (332.0, None, 0.15, 's')
57-
}
58-
}
59-
else:
60-
self.reference = {
61-
'daint:gpu': {
62-
'time': (245.0, None, 0.59, 's')
63-
}
64-
}
77+
return sn.assert_lt(energy_diff, 0.26)
78+
79+
@performance_function('s')
80+
def time(self):
81+
return sn.extractsingle(r'^ cpmd(\s+[\d\.]+){3}\s+(?P<perf>\S+)',
82+
'stdout.txt', 'perf', float)

0 commit comments

Comments
 (0)