88
99
1010class 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
5454class 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
138139class 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' }
0 commit comments