|
7 | 7 | import reframe.utility.sanity as sn |
8 | 8 |
|
9 | 9 |
|
10 | | -class StridedBase(rfm.RegressionTest): |
11 | | - def __init__(self): |
12 | | - self.sourcepath = 'strides.cpp' |
13 | | - self.build_system = 'SingleSource' |
14 | | - self.valid_systems = ['daint:gpu', 'dom:gpu', 'daint:mc', 'dom:mc', |
15 | | - 'eiger:mc', 'pilatus:mc'] |
16 | | - self.valid_prog_environs = ['PrgEnv-gnu'] |
17 | | - self.num_tasks = 1 |
18 | | - self.num_tasks_per_node = 1 |
19 | | - |
20 | | - self.sanity_patterns = sn.assert_eq( |
21 | | - sn.count(sn.findall(r'bandwidth', self.stdout)), |
22 | | - self.num_tasks_assigned) |
23 | | - |
24 | | - self.perf_patterns = { |
25 | | - 'bandwidth': sn.extractsingle( |
26 | | - r'bandwidth: (?P<bw>\S+) GB/s', |
27 | | - self.stdout, 'bw', float) |
28 | | - } |
29 | | - |
30 | | - self.system_num_cpus = { |
31 | | - 'daint:mc': 72, |
32 | | - 'daint:gpu': 24, |
33 | | - 'dom:mc': 72, |
34 | | - 'dom:gpu': 24, |
35 | | - 'eiger:mc': 128, |
36 | | - 'pilatus:mc': 128 |
37 | | - } |
38 | | - |
39 | | - self.maintainers = ['SK'] |
40 | | - self.tags = {'benchmark', 'diagnostic'} |
41 | | - |
42 | | - @property |
43 | | - @sn.sanity_function |
44 | | - def num_tasks_assigned(self): |
45 | | - return self.job.num_tasks |
46 | | - |
47 | | - |
48 | 10 | @rfm.simple_test |
49 | | -class StridedBandwidthTest(StridedBase): |
50 | | - def __init__(self): |
51 | | - super().__init__() |
52 | | - |
53 | | - self.reference = { |
54 | | - 'dom:gpu': { |
55 | | - 'bandwidth': (50, -0.1, 0.1, 'GB/s') |
56 | | - }, |
57 | | - 'dom:mc': { |
58 | | - 'bandwidth': (100, -0.1, 0.1, 'GB/s') |
59 | | - }, |
60 | | - 'daint:gpu': { |
61 | | - 'bandwidth': (50, -0.1, 0.1, 'GB/s') |
62 | | - }, |
63 | | - 'daint:mc': { |
64 | | - 'bandwidth': (100, -0.1, 0.1, 'GB/s') |
65 | | - }, |
66 | | - 'eiger:mc': { |
67 | | - 'bandwidth': (270, -0.1, 0.1, 'GB/s') |
68 | | - }, |
69 | | - 'pilatus:mc': { |
70 | | - 'bandwidth': (270, -0.1, 0.1, 'GB/s') |
71 | | - } |
72 | | - } |
| 11 | +class StridedBandwidthTest(rfm.RegressionTest): |
| 12 | + sourcepath = 'strides.cpp' |
| 13 | + build_system = 'SingleSource' |
| 14 | + valid_systems = ['daint:gpu', 'dom:gpu', 'daint:mc', 'dom:mc', |
| 15 | + 'eiger:mc', 'pilatus:mc'] |
| 16 | + valid_prog_environs = ['PrgEnv-gnu'] |
| 17 | + num_tasks = 1 |
| 18 | + num_tasks_per_node = 1 |
| 19 | + maintainers = ['SK'] |
| 20 | + tags = {'benchmark', 'diagnostic'} |
| 21 | + stride_bytes = parameter([8, 64, 128]) |
| 22 | + reference_bw = { |
| 23 | + 8: { |
| 24 | + 'haswell': (50, -0.1, 0.1, 'GB/s'), |
| 25 | + 'broadwell': (100, -0.1, 0.1, 'GB/s'), |
| 26 | + 'zen2': (270, -0.1, 0.1, 'GB/s') |
| 27 | + }, |
| 28 | + 64: { |
| 29 | + 'haswell': (6, -0.1, 0.2, 'GB/s'), |
| 30 | + 'broadwell': (12.5, -0.1, 0.2, 'GB/s'), |
| 31 | + 'zen2': (33, -0.1, 0.2, 'GB/s') |
| 32 | + }, |
| 33 | + 128: { |
| 34 | + 'haswell': (4.5, -0.1, 0.2, 'GB/s'), |
| 35 | + 'broadwell': (9.1, -0.1, 0.2, 'GB/s'), |
| 36 | + 'zen2': (33, -0.1, 0.2, 'GB/s') |
| 37 | + }, |
| 38 | + } |
| 39 | + |
| 40 | + @run_after('setup') |
| 41 | + def skip_if_no_topo(self): |
| 42 | + proc = self.current_partition.processor |
| 43 | + pname = self.current_partition.fullname |
| 44 | + if not proc.info: |
| 45 | + self.skip(f'no topology information found for partition {pname!r}') |
| 46 | + |
| 47 | + @sanity_function |
| 48 | + def assert_num_tasks(self): |
| 49 | + return sn.assert_eq(sn.count(sn.findall(r'bandwidth', self.stdout)), |
| 50 | + self.num_tasks) |
| 51 | + |
| 52 | + @performance_function('GB/s') |
| 53 | + def bandwidth(self): |
| 54 | + return sn.extractsingle(r'bandwidth: (?P<bw>\S+) GB/s', |
| 55 | + self.stdout, 'bw', float) |
73 | 56 |
|
74 | 57 | @run_before('run') |
75 | 58 | def set_exec_opts(self): |
76 | | - self.num_cpus = self.system_num_cpus[self.current_partition.fullname] |
77 | | - |
78 | | - # 8-byte stride, using the full cacheline |
79 | | - self.executable_opts = ['100000000', '1', f'{self.num_cpus}'] |
80 | | - |
81 | | - |
82 | | -@rfm.simple_test |
83 | | -class StridedBandwidthTest64(StridedBase): |
84 | | - def __init__(self): |
85 | | - super().__init__() |
86 | | - |
87 | | - self.reference = { |
88 | | - 'dom:gpu': { |
89 | | - 'bandwidth': (6, -0.1, 0.2, 'GB/s') |
90 | | - }, |
91 | | - 'dom:mc': { |
92 | | - 'bandwidth': (12.5, -0.1, 0.2, 'GB/s') |
93 | | - }, |
94 | | - 'daint:gpu': { |
95 | | - 'bandwidth': (6, -0.05, 0.2, 'GB/s') |
96 | | - }, |
97 | | - 'daint:mc': { |
98 | | - 'bandwidth': (12.5, -0.1, 0.2, 'GB/s') |
99 | | - }, |
100 | | - 'eiger:mc': { |
101 | | - 'bandwidth': (33, -0.1, 0.2, 'GB/s') |
102 | | - }, |
103 | | - 'pilatus:mc': { |
104 | | - 'bandwidth': (33, -0.1, 0.2, 'GB/s') |
105 | | - } |
106 | | - } |
107 | | - |
108 | | - @run_before('run') |
109 | | - def set_exec_opts(self): |
110 | | - self.num_cpus = self.system_num_cpus[self.current_partition.fullname] |
111 | | - |
112 | | - # 64-byte stride, using 1/8 of the cacheline |
113 | | - self.executable_opts = ['100000000', '8', '%s' % self.num_cpus] |
114 | | - |
115 | | - |
116 | | -@rfm.simple_test |
117 | | -class StridedBandwidthTest128(StridedBase): |
118 | | - def __init__(self): |
119 | | - super().__init__() |
120 | | - |
121 | | - self.reference = { |
122 | | - 'dom:gpu': { |
123 | | - 'bandwidth': (4.5, -0.1, 0.2, 'GB/s') |
124 | | - }, |
125 | | - 'dom:mc': { |
126 | | - 'bandwidth': (9.1, -0.1, 0.2, 'GB/s') |
127 | | - }, |
128 | | - 'daint:gpu': { |
129 | | - 'bandwidth': (4.5, -0.1, 0.2, 'GB/s') |
130 | | - }, |
131 | | - 'daint:mc': { |
132 | | - 'bandwidth': (9.1, -0.1, 0.2, 'GB/s') |
133 | | - }, |
134 | | - 'eiger:mc': { |
135 | | - 'bandwidth': (33, -0.1, 0.2, 'GB/s') |
136 | | - }, |
137 | | - } |
138 | | - |
139 | | - @run_before('run') |
140 | | - def set_exec_opts(self): |
141 | | - self.num_cpus = self.system_num_cpus[self.current_partition.fullname] |
142 | | - |
143 | | - # 128-byte stride, using 1/8 of every 2nd cacheline |
144 | | - self.executable_opts = ['100000000', '16', '%s' % self.num_cpus] |
| 59 | + proc = self.current_partition.processor |
| 60 | + self.executable_opts = [ |
| 61 | + '100000000', str(self.stride_bytes // 8), f'{proc.num_cpus}' |
| 62 | + ] |
| 63 | + |
| 64 | + @run_before('performance') |
| 65 | + def set_reference(self): |
| 66 | + proc = self.current_partition.processor |
| 67 | + try: |
| 68 | + ref = self.reference_bw[self.stride_bytes][proc.arch] |
| 69 | + except KeyError: |
| 70 | + return |
| 71 | + else: |
| 72 | + self.reference = {'*': {'bandwidth': ref}} |
0 commit comments