Skip to content

Commit 6a6d1e4

Browse files
author
Vasileios Karakasis
authored
Merge pull request #2152 from ekouts/test/latency
[test] Modernize latency test
2 parents 9504c7a + 3bf97ae commit 6a6d1e4

File tree

1 file changed

+81
-74
lines changed

1 file changed

+81
-74
lines changed

cscs-checks/microbenchmarks/cpu/latency/latency.py

Lines changed: 81 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -9,89 +9,96 @@
99

1010
@rfm.simple_test
1111
class CPULatencyTest(rfm.RegressionTest):
12-
def __init__(self):
13-
self.sourcepath = 'latency.cpp'
14-
self.build_system = 'SingleSource'
15-
self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc',
16-
'ault:intel', 'ault:amdvega', 'tave:compute']
17-
self.valid_prog_environs = ['PrgEnv-gnu']
18-
self.num_tasks = 0
19-
self.num_tasks_per_node = 1
20-
21-
self.build_system.cxxflags = ['-O3']
22-
23-
self.executable_opts = ['16000', '128000', '8000000', '500000000']
12+
sourcepath = 'latency.cpp'
13+
build_system = 'SingleSource'
14+
valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc',
15+
'ault:intel', 'ault:amdvega', 'tave:compute']
16+
valid_prog_environs = ['PrgEnv-gnu']
17+
num_tasks = 0
18+
num_tasks_per_node = 1
19+
executable_opts = ['16000', '128000', '8000000', '500000000']
20+
reference = {
21+
'dom:mc': {
22+
'latencyL1': (1.21, -0.01, 0.26, 'ns'),
23+
'latencyL2': (3.65, -0.01, 0.26, 'ns'),
24+
'latencyL3': (18.83, -0.01, 0.05, 'ns'),
25+
'latencyMem': (76.6, -0.01, 0.05, 'ns')
26+
},
27+
'dom:gpu': {
28+
'latencyL1': (1.14, -0.01, 0.26, 'ns'),
29+
'latencyL2': (3.44, -0.01, 0.26, 'ns'),
30+
'latencyL3': (15.65, -0.01, 0.05, 'ns'),
31+
'latencyMem': (71.7, -0.01, 0.05, 'ns')
32+
},
33+
'daint:mc': {
34+
'latencyL1': (1.21, -0.01, 0.26, 'ns'),
35+
'latencyL2': (3.65, -0.01, 0.26, 'ns'),
36+
'latencyL3': (18.83, -0.01, 0.05, 'ns'),
37+
'latencyMem': (76.6, -0.01, 0.05, 'ns')
38+
},
39+
'daint:gpu': {
40+
'latencyL1': (1.14, -0.01, 0.26, 'ns'),
41+
'latencyL2': (3.44, -0.01, 0.26, 'ns'),
42+
'latencyL3': (15.65, -0.01, 0.05, 'ns'),
43+
'latencyMem': (71.7, -0.01, 0.05, 'ns')
44+
},
45+
'ault:intel': {
46+
'latencyL1': (1.08, -0.01, 0.26, 'ns'),
47+
'latencyL2': (3.8, -0.01, 0.26, 'ns'),
48+
'latencyL3': (21.5, -0.01, 0.05, 'ns'),
49+
'latencyMem': (86.5, -0.01, 0.05, 'ns')
50+
},
51+
'ault:amdvega': {
52+
'latencyL1': (1.32, -0.01, 0.26, 'ns'),
53+
'latencyL2': (4.02, -0.01, 0.26, 'ns'),
54+
'latencyL3': (14.4, -0.01, 0.26, 'ns'),
55+
'latencyMem': (90.0, -0.01, 0.05, 'ns')
56+
},
57+
'tave:compute': {
58+
'latencyL1': (2.86, -0.01, 0.05, 'ns'),
59+
'latencyL2': (12.15, -0.01, 0.05, 'ns'),
60+
'latencyL3': (137, -0.01, 0.05, 'ns'),
61+
'latencyMem': (150, -0.05, 0.05, 'ns')
62+
},
63+
}
64+
maintainers = ['SK']
65+
tags = {'benchmark', 'diagnostic'}
2466

67+
@run_after('init')
68+
def set_modules(self):
2569
if self.current_system.name in {'daint', 'dom'}:
2670
self.modules = ['craype-hugepages1G']
2771
if self.current_system.name in {'tave'}:
2872
self.modules = ['craype-hugepages512M']
2973

30-
self.sanity_patterns = sn.assert_eq(
74+
@run_before('compile')
75+
def set_flags(self):
76+
self.build_system.cxxflags = ['-O3']
77+
78+
@sanity_function
79+
def assert_success(self):
80+
return sn.assert_eq(
3181
sn.count(sn.findall(r'latency', self.stdout)),
32-
self.num_tasks_assigned * len(self.executable_opts))
82+
self.num_tasks * len(self.executable_opts)
83+
)
3384

34-
def lat_pattern(index):
35-
return sn.extractsingle(
36-
r'latency \(ns\) for input size %s: (?P<bw>\S+) clocks' %
37-
self.executable_opts[index], self.stdout, 'bw', float)
85+
def lat_pattern(self, index):
86+
return sn.extractsingle(
87+
r'latency \(ns\) for input size %s: (?P<bw>\S+) clocks' %
88+
self.executable_opts[index], self.stdout, 'bw', float)
3889

39-
self.perf_patterns = {
40-
'latencyL1': lat_pattern(0),
41-
'latencyL2': lat_pattern(1),
42-
'latencyL3': lat_pattern(2),
43-
'latencyMem': lat_pattern(3),
44-
}
90+
@performance_function('ns')
91+
def latencyL1(self):
92+
return self.lat_pattern(0)
4593

46-
self.reference = {
47-
'dom:mc': {
48-
'latencyL1': (1.21, -0.01, 0.26, 'ns'),
49-
'latencyL2': (3.65, -0.01, 0.26, 'ns'),
50-
'latencyL3': (18.83, -0.01, 0.05, 'ns'),
51-
'latencyMem': (76.6, -0.01, 0.05, 'ns')
52-
},
53-
'dom:gpu': {
54-
'latencyL1': (1.14, -0.01, 0.26, 'ns'),
55-
'latencyL2': (3.44, -0.01, 0.26, 'ns'),
56-
'latencyL3': (15.65, -0.01, 0.05, 'ns'),
57-
'latencyMem': (71.7, -0.01, 0.05, 'ns')
58-
},
59-
'daint:mc': {
60-
'latencyL1': (1.21, -0.01, 0.26, 'ns'),
61-
'latencyL2': (3.65, -0.01, 0.26, 'ns'),
62-
'latencyL3': (18.83, -0.01, 0.05, 'ns'),
63-
'latencyMem': (76.6, -0.01, 0.05, 'ns')
64-
},
65-
'daint:gpu': {
66-
'latencyL1': (1.14, -0.01, 0.26, 'ns'),
67-
'latencyL2': (3.44, -0.01, 0.26, 'ns'),
68-
'latencyL3': (15.65, -0.01, 0.05, 'ns'),
69-
'latencyMem': (71.7, -0.01, 0.05, 'ns')
70-
},
71-
'ault:intel': {
72-
'latencyL1': (1.08, -0.01, 0.26, 'ns'),
73-
'latencyL2': (3.8, -0.01, 0.26, 'ns'),
74-
'latencyL3': (21.5, -0.01, 0.05, 'ns'),
75-
'latencyMem': (86.5, -0.01, 0.05, 'ns')
76-
},
77-
'ault:amdvega': {
78-
'latencyL1': (1.32, -0.01, 0.26, 'ns'),
79-
'latencyL2': (4.02, -0.01, 0.26, 'ns'),
80-
'latencyL3': (14.4, -0.01, 0.26, 'ns'),
81-
'latencyMem': (90.0, -0.01, 0.05, 'ns')
82-
},
83-
'tave:compute': {
84-
'latencyL1': (2.86, -0.01, 0.05, 'ns'),
85-
'latencyL2': (12.15, -0.01, 0.05, 'ns'),
86-
'latencyL3': (137, -0.01, 0.05, 'ns'),
87-
'latencyMem': (150, -0.05, 0.05, 'ns')
88-
},
89-
}
94+
@performance_function('ns')
95+
def latencyL2(self):
96+
return self.lat_pattern(1)
9097

91-
self.maintainers = ['SK']
92-
self.tags = {'benchmark', 'diagnostic'}
98+
@performance_function('ns')
99+
def latencyL3(self):
100+
return self.lat_pattern(2)
93101

94-
@property
95-
@sn.sanity_function
96-
def num_tasks_assigned(self):
97-
return self.job.num_tasks
102+
@performance_function('ns')
103+
def latencyMem(self):
104+
return self.lat_pattern(3)

0 commit comments

Comments
 (0)