|
1 | | -import os |
2 | | - |
| 1 | +import reframe as rfm |
3 | 2 | import reframe.utility.sanity as sn |
4 | | -from reframe.core.pipeline import RegressionTest |
5 | 3 |
|
6 | | -class OpenACCFortranCheck(RegressionTest): |
7 | | - def __init__(self, num_tasks, **kwargs): |
| 4 | + |
| 5 | +@rfm.parameterized_test([1], [2]) |
| 6 | +class OpenACCFortranCheck(rfm.RegressionTest): |
| 7 | + def __init__(self, num_tasks): |
| 8 | + super().__init__() |
8 | 9 | if num_tasks == 1: |
9 | | - check_name = 'openacc_fortran_check' |
| 10 | + self.name = 'openacc_fortran_check' |
| 11 | + self.descr = 'OpenACC Fortran check' |
10 | 12 | else: |
11 | | - check_name = 'openacc_mpi_fortran_check' |
12 | | - super().__init__(check_name, |
13 | | - os.path.dirname(__file__), **kwargs) |
| 13 | + self.name = 'openacc_mpi_fortran_check' |
| 14 | + self.descr = 'OpenACC+MPI Fortran check' |
| 15 | + |
14 | 16 | self.valid_systems = ['daint:gpu', 'dom:gpu', 'kesch:cn'] |
15 | 17 | self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-pgi'] |
16 | | - if self.current_system.name in ['daint', 'dom']: |
17 | | - self.modules = ['craype-accel-nvidia60'] |
18 | | - self._pgi_flags = '-acc -ta=tesla:cc60' |
19 | | - elif self.current_system.name in ['kesch']: |
20 | | - self.modules = ['craype-accel-nvidia35'] |
21 | | - self._pgi_flags = '-acc -ta=tesla:cc35' |
22 | | - |
23 | 18 | self.num_tasks = num_tasks |
24 | 19 | if self.num_tasks == 1: |
25 | 20 | self.sourcepath = 'vecAdd_openacc.f90' |
26 | 21 | else: |
27 | 22 | self.sourcepath = 'vecAdd_openacc_mpi.f90' |
| 23 | + |
| 24 | + if self.current_system.name in ['daint', 'dom']: |
| 25 | + self.modules = ['craype-accel-nvidia60'] |
| 26 | + elif self.current_system.name == 'kesch': |
| 27 | + self.modules = ['craype-accel-nvidia35'] |
| 28 | + |
| 29 | + self.build_system = 'SingleSource' |
28 | 30 | self.num_gpus_per_node = 1 |
29 | 31 | self.executable = self.name |
30 | 32 | self.num_tasks_per_node = 1 |
31 | | - |
32 | 33 | result = sn.extractsingle(r'final result:\s+(?P<result>\d+\.?\d*)', |
33 | | - self.stdout, 'result', float) |
| 34 | + self.stdout, 'result', float) |
34 | 35 | self.sanity_patterns = sn.assert_reference(result, 1., -1e-5, 1e-5) |
35 | 36 |
|
36 | 37 | self.maintainers = ['TM', 'VK'] |
37 | 38 | self.tags = {'production'} |
38 | 39 |
|
39 | 40 | def setup(self, partition, environ, **job_opts): |
40 | 41 | if environ.name == 'PrgEnv-cray': |
41 | | - environ.fflags = '-hacc -hnoomp' |
| 42 | + self.build_system.fflags = ['-hacc', '-hnoomp'] |
42 | 43 | elif environ.name == 'PrgEnv-pgi': |
43 | | - environ.fflags = self._pgi_flags |
| 44 | + if self.current_system.name in ['daint', 'dom']: |
| 45 | + self.build_system.fflags = ['-acc', '-ta=tesla:cc60'] |
| 46 | + else: |
| 47 | + self.build_system.fflags = ['-acc', '-ta=tesla:cc35'] |
44 | 48 |
|
45 | 49 | super().setup(partition, environ, **job_opts) |
46 | | - |
47 | | - |
48 | | -def _get_checks(**kwargs): |
49 | | - return [OpenACCFortranCheck(1, **kwargs), |
50 | | - OpenACCFortranCheck(2, **kwargs)] |
0 commit comments