|
7 | 7 | import reframe.utility.sanity as sn |
8 | 8 |
|
9 | 9 |
|
10 | | -@rfm.parameterized_test(['dynamic'], ['static']) |
| 10 | +@rfm.simple_test |
11 | 11 | 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): |
13 | 26 | 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): |
23 | 35 | # FIXME: static compilation yields a link error in case of |
24 | 36 | # PrgEnv-intel (Cray Bug #255701) workaround use C++ compiler |
25 | | - if linkage == 'static': |
| 37 | + if self.linkage == 'static': |
26 | 38 | self.build_system.cc = 'CC' |
27 | 39 |
|
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): |
31 | 42 | # Check the final residual norm for convergence |
32 | 43 | norm = sn.extractsingle(r'\s+\d+\s+KSP Residual norm\s+(?P<norm>\S+)', |
33 | 44 | 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