Skip to content

Commit da18b68

Browse files
author
Vasileios Karakasis
authored
Merge pull request #2142 from teojgo/test/modernize_petsc
[test] Modernize PETSc test
2 parents 26d5f4c + 5b8998c commit da18b68

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

cscs-checks/libraries/petsc/petsc_helloworld.py

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,39 @@
77
import reframe.utility.sanity as sn
88

99

10-
@rfm.parameterized_test(['dynamic'], ['static'])
10+
@rfm.simple_test
1111
class PetscPoisson2DCheck(rfm.RegressionTest):
12-
def __init__(self, linkage):
12+
linkage = parameter(['dynamic', 'static'])
13+
valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc']
14+
valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', 'PrgEnv-intel']
15+
modules = ['cray-petsc']
16+
build_system = 'SingleSource'
17+
sourcepath = 'poisson2d.c'
18+
num_tasks = 16
19+
num_tasks_per_node = 8
20+
executable_opts = ['-da_grid_x 4', '-da_grid_y 4', '-ksp_monitor']
21+
tags = {'production', 'craype'}
22+
maintainers = ['AJ', 'CB']
23+
24+
@run_after('init')
25+
def set_description(self):
1326
self.descr = (f'Compile/run PETSc 2D Poisson example with cray-petsc '
14-
f'({linkage} linking)')
15-
self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc']
16-
self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu',
17-
'PrgEnv-intel']
18-
self.sourcepath = 'poisson2d.c'
19-
self.modules = ['cray-petsc']
20-
self.num_tasks = 16
21-
self.num_tasks_per_node = 8
22-
self.build_system = 'SingleSource'
27+
f'({self.linkage} linking)')
28+
29+
@run_before('compile')
30+
def set_variables(self):
31+
self.variables = {'CRAYPE_LINK_TYPE': self.linkage}
32+
33+
@run_before('compile')
34+
def intel_workaround(self):
2335
# FIXME: static compilation yields a link error in case of
2436
# PrgEnv-intel (Cray Bug #255701) workaround use C++ compiler
25-
if linkage == 'static':
37+
if self.linkage == 'static':
2638
self.build_system.cc = 'CC'
2739

28-
self.variables = {'CRAYPE_LINK_TYPE': linkage}
29-
self.executable_opts = ['-da_grid_x 4', '-da_grid_y 4', '-ksp_monitor']
30-
40+
@sanity_function
41+
def assert_convergence(self):
3142
# Check the final residual norm for convergence
3243
norm = sn.extractsingle(r'\s+\d+\s+KSP Residual norm\s+(?P<norm>\S+)',
3344
self.stdout, 'norm', float, -1)
34-
self.sanity_patterns = sn.assert_lt(norm, 1.0e-5)
35-
self.tags = {'production', 'craype'}
36-
self.maintainers = ['AJ', 'CB']
45+
return sn.assert_lt(norm, 1.0e-5)

0 commit comments

Comments
 (0)