|
2 | 2 | import reframe.utility.sanity as sn |
3 | 3 |
|
4 | 4 |
|
| 5 | +@rfm.required_version('>=2.14') |
| 6 | +@rfm.simple_test |
5 | 7 | class DGEMMTest(rfm.RegressionTest): |
6 | 8 | def __init__(self): |
7 | 9 | super().__init__() |
8 | 10 | self.descr = 'DGEMM performance test' |
9 | 11 | self.sourcepath = 'dgemm.c' |
10 | | - self.executable_opts = ['5000', '5000', '5000'] |
11 | | - self.sanity_patterns = sn.assert_found( |
12 | | - r'Time for \d+ DGEMM operations', self.stdout) |
13 | | - self.maintainers = ['AJ'] |
14 | | - self.tags = {'production'} |
15 | 12 |
|
| 13 | + self.sanity_patterns = self.eval_sanity() |
| 14 | + # the perf patterns are automaticaly generated inside sanity |
| 15 | + self.perf_patterns = {} |
16 | 16 |
|
17 | | -@rfm.required_version('>=2.14') |
18 | | -@rfm.simple_test |
19 | | -class DGEMMTestMonch(DGEMMTest): |
20 | | - def __init__(self): |
21 | | - super().__init__() |
22 | | - self.tags = {'monch_acceptance'} |
23 | | - self.valid_systems = ['monch:compute'] |
24 | | - self.valid_prog_environs = ['PrgEnv-gnu'] |
25 | | - self.num_tasks = 1 |
| 17 | + self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc', |
| 18 | + 'monch:compute'] |
| 19 | + self.valid_prog_environs = ['PrgEnv-cray', 'PrgEnv-gnu', 'PrgEnv-intel'] |
| 20 | + |
| 21 | + # FIXME: set the num_tasks to zero. |
| 22 | + self.num_tasks = 2 |
26 | 23 | self.num_tasks_per_node = 1 |
27 | 24 | self.num_tasks_per_core = 1 |
28 | | - self.num_cpus_per_task = 20 |
29 | | - self.num_tasks_per_socket = 10 |
| 25 | + self.num_tasks_per_socket = 1 |
30 | 26 | self.use_multithreading = False |
| 27 | + |
| 28 | + self.build_system = 'SingleSource' |
| 29 | + self.build_system.cflags = ['-O3'] |
| 30 | + |
| 31 | + self.my_reference = { |
| 32 | + 'daint:gpu': (430, -0.1, None), |
| 33 | + 'daint:mc': (430, -0.1, None), |
| 34 | + 'monch:compute': (350, -0.1, None), |
| 35 | + } |
| 36 | + |
| 37 | + self.maintainers = ['AJ', 'VH', 'VK'] |
| 38 | + self.tags = {'production'} |
| 39 | + |
| 40 | + |
| 41 | + def setup(self, partition, environ, **job_opts): |
| 42 | + if partition.fullname in ['daint:gpu', 'dom:gpu']: |
| 43 | + self.num_cpus_per_task = 12 |
| 44 | + self.executable_opts = ['6000', '6000', '6000'] |
| 45 | + |
| 46 | + elif partition.fullname in ['daint:mc', 'dom:mc']: |
| 47 | + self.num_cpus_per_task = 36 |
| 48 | + self.executable_opts = ['6000', '6000', '6000'] |
| 49 | + |
| 50 | + elif partition.fullname in ['monch:compute']: |
| 51 | + self.num_cpus_per_task = 20 |
| 52 | + self.executable_opts = ['5000', '5000', '5000'] |
| 53 | + self.build_system.cflags += ['-I$EBROOTOPENBLAS/include'] |
| 54 | + self.build_system.ldflags = ['-L$EBROOTOPENBLAS/lib', '-lopenblas', |
| 55 | + '-lpthread', '-lgfortran'] |
| 56 | + |
31 | 57 | self.variables = { |
32 | 58 | 'OMP_NUM_THREADS': str(self.num_cpus_per_task), |
33 | 59 | 'MV2_ENABLE_AFFINITY': '0' |
34 | 60 | } |
35 | | - self.build_system = 'SingleSource' |
36 | | - self.build_system.cflags = ['-O3', '-I$EBROOTOPENBLAS/include'] |
37 | | - self.build_system.ldflags = ['-L$EBROOTOPENBLAS/lib', '-lopenblas', |
38 | | - '-lpthread', '-lgfortran'] |
39 | | - self.perf_patterns = { |
40 | | - 'perf': sn.max( |
41 | | - sn.extractall(r'Run\s\d\s+:\s+(?P<gflops>\S+)\s\S+', |
42 | | - self.stdout, "gflops", float) |
43 | | - ) |
44 | | - } |
45 | | - self.reference = { |
46 | | - 'monch:compute': { |
47 | | - 'perf': (350, -0.1, None) |
48 | | - } |
49 | | - } |
| 61 | + |
| 62 | + if environ.name.startswith('PrgEnv-cray'): |
| 63 | + self.build_system.cflags += ['-hnoomp'] |
| 64 | + |
| 65 | + super().setup(partition, environ, **job_opts) |
| 66 | + |
| 67 | + |
| 68 | + @sn.sanity_function |
| 69 | + def eval_sanity(self): |
| 70 | + failures = [] |
| 71 | + |
| 72 | + all_tested_nodes = sn.evaluate(sn.findall( |
| 73 | + r'(?P<name>.*):\s+Time for \d+ DGEMM operations', |
| 74 | + self.stdout |
| 75 | + )) |
| 76 | + number_of_tested_nodes = len(all_tested_nodes) |
| 77 | + |
| 78 | + if number_of_tested_nodes != self.num_tasks: |
| 79 | + failures.append('Requested %s nodes, but found %s nodes)' % |
| 80 | + (self.num_tasks, number_of_tested_nodes)) |
| 81 | + #FIXME: list detected nodes in error message |
| 82 | + sn.assert_false(failures, msg=', '.join(failures)) |
| 83 | + |
| 84 | + update_reference = False |
| 85 | + if self.my_reference[self.current_partition.fullname]: |
| 86 | + update_reference = True |
| 87 | + |
| 88 | + for node in all_tested_nodes: |
| 89 | + nodename = node.group('name') |
| 90 | + |
| 91 | + if update_reference: |
| 92 | + partition_name = self.current_partition.fullname |
| 93 | + ref_name = '%s:%s' % (partition_name, nodename) |
| 94 | + self.reference[ref_name] = self.my_reference[partition_name] |
| 95 | + self.perf_patterns[nodename] = sn.extractsingle( |
| 96 | + '%s:\\s+Flops based on.*:\\s+(?P<gflops>.*)\\sGFlops\\/sec' |
| 97 | + % nodename, self.stdout, "gflops", float) |
| 98 | + |
| 99 | + return sn.assert_false(failures, msg=', '.join(failures)) |
0 commit comments