29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
1 |
#!/usr/bin/env python
|
2 |
||
3 |
"""Plot the performance for different block sizes of one function across
|
|
4 |
variants.
|
|
5 |
"""
|
|
6 |
||
7 |
import libplot |
|
8 |
||
9 |
import pylab |
|
10 |
import pdb |
|
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
11 |
import math |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
12 |
|
44
by Michael Hope
Various plotting updates. |
13 |
def pretty_kb(v): |
14 |
if v < 1024: |
|
15 |
return '%d' % v |
|
16 |
else: |
|
17 |
if v % 1024 == 0: |
|
18 |
return '%d k' % (v//1024) |
|
19 |
else: |
|
20 |
return '%.1f k' % (v/1024) |
|
21 |
||
80
by Michael Hope
Generate a tumbnail and full size for the size plots. Tweak the colours to have more and make the first a Linaro purple. |
22 |
def plot(records, function, alignment=None, scale=1): |
44
by Michael Hope
Various plotting updates. |
23 |
variants = libplot.unique(records, 'variant', prefer='this') |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
24 |
records = [x for x in records if x.function==function] |
25 |
||
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
26 |
if alignment != None: |
113
by Will Newton
Allow aligning source and destination buffers separately. |
27 |
records = [x for x in records if x.src_alignment==alignment[0] and |
28 |
x.dst_alignment==alignment[1]] |
|
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
29 |
|
113
by Will Newton
Allow aligning source and destination buffers separately. |
30 |
alignments = libplot.unique(records, ('src_alignment', 'dst_alignment')) |
31 |
if len(alignments) != 1: |
|
32 |
return False |
|
33 |
if libplot.alignments_equal(alignments): |
|
34 |
aalignment = alignments[0][0] |
|
35 |
else: |
|
36 |
aalignment = "%s:%s" % (alignments[0][0], alignments[0][1]) |
|
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
37 |
|
38 |
bytes = libplot.unique(records, 'bytes')[0] |
|
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
39 |
|
80
by Michael Hope
Generate a tumbnail and full size for the size plots. Tweak the colours to have more and make the first a Linaro purple. |
40 |
colours = libplot.make_colours() |
30
by Michael Hope
Added more ranges. changed everything to MB/s. Account for the loop overhead. |
41 |
all_x = [] |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
42 |
|
80
by Michael Hope
Generate a tumbnail and full size for the size plots. Tweak the colours to have more and make the first a Linaro purple. |
43 |
pylab.figure(1).set_size_inches((6.4*scale, 4.8*scale)) |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
44 |
pylab.clf() |
45 |
||
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
46 |
if 'str' in function: |
47 |
# The harness fills out to 16k. Anything past that is an
|
|
48 |
# early match
|
|
49 |
top = 16384 |
|
50 |
else: |
|
51 |
top = 2**31 |
|
52 |
||
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
53 |
for variant in variants: |
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
54 |
matches = [x for x in records if x.variant==variant and x.bytes <= top] |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
55 |
matches.sort(key=lambda x: x.bytes) |
56 |
||
57 |
X = [x.bytes for x in matches] |
|
58 |
Y = [x.bytes*x.loops/x.elapsed/(1024*1024) for x in matches] |
|
59 |
||
30
by Michael Hope
Added more ranges. changed everything to MB/s. Account for the loop overhead. |
60 |
all_x.extend(X) |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
61 |
colour = colours.next() |
62 |
||
63 |
if X: |
|
64 |
pylab.plot(X, Y, c=colour) |
|
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
65 |
pylab.scatter(X, Y, c=colour, label=variant, edgecolors='none') |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
66 |
|
80
by Michael Hope
Generate a tumbnail and full size for the size plots. Tweak the colours to have more and make the first a Linaro purple. |
67 |
pylab.legend(loc='upper left', ncol=3, prop={'size': 'small'}) |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
68 |
pylab.grid() |
44
by Michael Hope
Various plotting updates. |
69 |
pylab.title('%(function)s of %(aalignment)s byte aligned blocks' % locals()) |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
70 |
pylab.xlabel('Size (B)') |
71 |
pylab.ylabel('Rate (MB/s)') |
|
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
72 |
|
73 |
# Figure out how high the range goes
|
|
74 |
top = max(all_x) |
|
75 |
||
76 |
power = int(round(math.log(max(all_x)) / math.log(2))) |
|
77 |
||
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
78 |
pylab.semilogx() |
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
79 |
|
80 |
pylab.axes().set_xticks([2**x for x in range(0, power+1)]) |
|
81 |
pylab.axes().set_xticklabels([pretty_kb(2**x) for x in range(0, power+1)]) |
|
82 |
pylab.xlim(0, top) |
|
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
83 |
pylab.ylim(0, pylab.ylim()[1]) |
113
by Will Newton
Allow aligning source and destination buffers separately. |
84 |
return True |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
85 |
|
86 |
def main(): |
|
87 |
records = libplot.parse() |
|
88 |
||
89 |
functions = libplot.unique(records, 'function') |
|
113
by Will Newton
Allow aligning source and destination buffers separately. |
90 |
alignments = libplot.unique(records, ('src_alignment', 'dst_alignment')) |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
91 |
|
92 |
for function in functions: |
|
44
by Michael Hope
Various plotting updates. |
93 |
for alignment in alignments: |
80
by Michael Hope
Generate a tumbnail and full size for the size plots. Tweak the colours to have more and make the first a Linaro purple. |
94 |
for scale in [1, 2.5]: |
113
by Will Newton
Allow aligning source and destination buffers separately. |
95 |
if plot(records, function, alignment, scale): |
96 |
pylab.savefig('sizes-%s-%02d-%02d-%.1f.png' % (function, alignment[0], alignment[1], scale), dpi=72) |
|
44
by Michael Hope
Various plotting updates. |
97 |
|
98 |
pylab.show() |
|
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
99 |
|
100 |
if __name__ == '__main__': |
|
101 |
main() |