33
by Michael Hope
Various updates to the benchmark plotting scripts. |
1 |
#!/usr/bin/env python
|
2 |
||
3 |
"""Plot the performance of different variants of one routine versus alignment.
|
|
4 |
"""
|
|
5 |
||
6 |
import libplot |
|
7 |
||
8 |
import pylab |
|
9 |
||
10 |
||
11 |
def plot(records, bytes, function): |
|
12 |
records = [x for x in records if x.bytes==bytes and x.function==function] |
|
13 |
||
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
14 |
variants = libplot.unique(records, 'variant', prefer='this') |
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
15 |
alignments = libplot.unique(records, 'alignment') |
16 |
||
17 |
X = pylab.arange(len(alignments)) |
|
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
18 |
width = 1.0/(len(variants)+1) |
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
19 |
|
20 |
colours = iter('bgrcmyk') |
|
21 |
||
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
22 |
pylab.figure(1).set_size_inches((16, 12)) |
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
23 |
pylab.clf() |
24 |
||
25 |
for i, variant in enumerate(variants): |
|
26 |
heights = [] |
|
27 |
||
28 |
for alignment in alignments: |
|
29 |
matches = [x for x in records if x.variant==variant and x.alignment==alignment] |
|
30 |
||
31 |
if matches: |
|
32 |
match = matches[0] |
|
33 |
heights.append(match.bytes*match.loops/match.elapsed/(1024*1024)) |
|
34 |
else: |
|
35 |
heights.append(0) |
|
36 |
||
37 |
pylab.bar(X+i*width, heights, width, color=colours.next(), label=variant) |
|
38 |
||
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
39 |
|
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
40 |
axes = pylab.axes() |
41 |
axes.set_xticklabels(alignments) |
|
42 |
axes.set_xticks(X + 0.5) |
|
43 |
||
44 |
pylab.title('Performance of different variants of %(function)s for %(bytes)d byte blocks' % locals()) |
|
45 |
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. |
46 |
pylab.legend(loc='upper left', ncol=3) |
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
47 |
pylab.grid() |
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
48 |
pylab.savefig('alignment-%(function)s-%(bytes)d.png' % locals(), dpi=72) |
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
49 |
|
50 |
def main(): |
|
51 |
records = libplot.parse() |
|
52 |
||
53 |
for function in libplot.unique(records, 'function'): |
|
54 |
for bytes in libplot.unique(records, 'bytes'): |
|
55 |
plot(records, bytes, function) |
|
56 |
||
57 |
pylab.show() |
|
58 |
||
59 |
if __name__ == '__main__': |
|
60 |
main() |