|
4 | 4 | # SPDX-License-Identifier: BSD-3-Clause |
5 | 5 |
|
6 | 6 | import reframe as rfm |
7 | | -import reframe.utility.sanity as sn |
8 | 7 |
|
9 | | - |
10 | | -class NumpyBaseTest(rfm.RunOnlyRegressionTest): |
11 | | - def __init__(self): |
12 | | - self.descr = 'Test a few typical numpy operations' |
13 | | - self.valid_prog_environs = ['builtin'] |
14 | | - self.modules = ['numpy'] |
15 | | - self.reference = { |
16 | | - 'daint:gpu': { |
17 | | - 'dot': (0.4, None, 0.05, 'seconds'), |
18 | | - 'svd': (0.37, None, 0.05, 'seconds'), |
19 | | - 'cholesky': (0.12, None, 0.05, 'seconds'), |
20 | | - 'eigendec': (3.5, None, 0.05, 'seconds'), |
21 | | - 'inv': (0.21, None, 0.05, 'seconds'), |
22 | | - }, |
23 | | - 'daint:mc': { |
24 | | - 'dot': (0.3, None, 0.05, 'seconds'), |
25 | | - 'svd': (0.35, None, 0.05, 'seconds'), |
26 | | - 'cholesky': (0.1, None, 0.05, 'seconds'), |
27 | | - 'eigendec': (4.14, None, 0.05, 'seconds'), |
28 | | - 'inv': (0.16, None, 0.05, 'seconds'), |
29 | | - }, |
30 | | - 'dom:gpu': { |
31 | | - 'dot': (0.4, None, 0.05, 'seconds'), |
32 | | - 'svd': (0.37, None, 0.05, 'seconds'), |
33 | | - 'cholesky': (0.12, None, 0.05, 'seconds'), |
34 | | - 'eigendec': (3.5, None, 0.05, 'seconds'), |
35 | | - 'inv': (0.21, None, 0.05, 'seconds'), |
36 | | - }, |
37 | | - 'dom:mc': { |
38 | | - 'dot': (0.3, None, 0.05, 'seconds'), |
39 | | - 'svd': (0.35, None, 0.05, 'seconds'), |
40 | | - 'cholesky': (0.1, None, 0.05, 'seconds'), |
41 | | - 'eigendec': (4.14, None, 0.05, 'seconds'), |
42 | | - 'inv': (0.16, None, 0.05, 'seconds'), |
43 | | - }, |
44 | | - } |
45 | | - self.perf_patterns = { |
46 | | - 'dot': sn.extractsingle( |
47 | | - r'^Dotted two 4096x4096 matrices in\s+(?P<dot>\S+)\s+s', |
48 | | - self.stdout, 'dot', float), |
49 | | - 'svd': sn.extractsingle( |
50 | | - r'^SVD of a 2048x1024 matrix in\s+(?P<svd>\S+)\s+s', |
51 | | - self.stdout, 'svd', float), |
52 | | - 'cholesky': sn.extractsingle( |
53 | | - r'^Cholesky decomposition of a 2048x2048 matrix in' |
54 | | - r'\s+(?P<cholesky>\S+)\s+s', |
55 | | - self.stdout, 'cholesky', float), |
56 | | - 'eigendec': sn.extractsingle( |
57 | | - r'^Eigendecomposition of a 2048x2048 matrix in' |
58 | | - r'\s+(?P<eigendec>\S+)\s+s', |
59 | | - self.stdout, 'eigendec', float), |
60 | | - 'inv': sn.extractsingle( |
61 | | - r'^Inversion of a 2048x2048 matrix in\s+(?P<inv>\S+)\s+s', |
62 | | - self.stdout, 'inv', float) |
63 | | - } |
64 | | - self.sanity_patterns = sn.assert_found(r'Numpy version:\s+\S+', |
65 | | - self.stdout) |
66 | | - self.variables = { |
67 | | - 'OMP_NUM_THREADS': '$SLURM_CPUS_PER_TASK', |
68 | | - } |
69 | | - self.executable = 'python' |
70 | | - self.executable_opts = ['np_ops.py'] |
71 | | - self.num_tasks_per_node = 1 |
72 | | - self.use_multithreading = False |
73 | | - self.tags = {'production'} |
74 | | - self.maintainers = ['RS', 'TR'] |
| 8 | +from hpctestlib.python.numpy.numpy_ops import numpy_ops_check |
75 | 9 |
|
76 | 10 |
|
77 | 11 | @rfm.simple_test |
78 | | -class NumpyHaswellTest(NumpyBaseTest): |
79 | | - def __init__(self): |
80 | | - super().__init__() |
81 | | - self.valid_systems = ['daint:gpu', 'dom:gpu'] |
82 | | - self.num_cpus_per_task = 12 |
| 12 | +class cscs_numpy_test(numpy_ops_check): |
| 13 | + valid_prog_environs = ['builtin'] |
| 14 | + valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc'] |
| 15 | + modules = ['numpy'] |
| 16 | + num_tasks_per_node = 1 |
| 17 | + use_multithreading = False |
| 18 | + all_ref = { |
| 19 | + 'haswell@12c': { |
| 20 | + 'dot': (0.4, None, 0.05, 's'), |
| 21 | + 'svd': (0.37, None, 0.05, 's'), |
| 22 | + 'cholesky': (0.12, None, 0.05, 's'), |
| 23 | + 'eigendec': (3.5, None, 0.05, 's'), |
| 24 | + 'inv': (0.21, None, 0.05, 's'), |
| 25 | + }, |
| 26 | + 'broadwell@36c': { |
| 27 | + 'dot': (0.3, None, 0.05, 's'), |
| 28 | + 'svd': (0.35, None, 0.05, 's'), |
| 29 | + 'cholesky': (0.1, None, 0.05, 's'), |
| 30 | + 'eigendec': (4.14, None, 0.05, 's'), |
| 31 | + 'inv': (0.16, None, 0.05, 's'), |
| 32 | + } |
| 33 | + } |
| 34 | + tags = {'production'} |
| 35 | + maintainers = ['RS', 'TR'] |
83 | 36 |
|
| 37 | + @run_after('setup') |
| 38 | + def set_num_cpus_per_task(self): |
| 39 | + self.num_cpus_per_task = self.current_partition.processor.num_cores |
| 40 | + variables = { |
| 41 | + 'OMP_NUM_THREADS': self.num_cpus_per_task |
| 42 | + } |
84 | 43 |
|
85 | | -@rfm.simple_test |
86 | | -class NumpyBroadwellTest(NumpyBaseTest): |
87 | | - def __init__(self): |
88 | | - super().__init__() |
89 | | - self.valid_systems = ['daint:mc', 'dom:mc'] |
90 | | - self.num_cpus_per_task = 36 |
| 44 | + @run_before('performance') |
| 45 | + def set_perf_ref(self): |
| 46 | + arch = self.current_partition.processor.arch |
| 47 | + pname = self.current_partition.fullname |
| 48 | + num_cores = self.current_partition.processor.num_cores |
| 49 | + self.reference = { |
| 50 | + pname: self.all_ref[f'{arch}@{num_cores}c'] |
| 51 | + } |
0 commit comments