]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/odeint/performance/plot_result.py
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / numeric / odeint / performance / plot_result.py
1 """
2 Copyright 2011-2014 Mario Mulansky
3 Copyright 2011-2014 Karsten Ahnert
4
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or
7 copy at http://www.boost.org/LICENSE_1_0.txt)
8 """
9
10 import numpy as np
11 from matplotlib import pyplot as plt
12
13 plt.rc("font", size=16)
14
15
16 def get_runtime_from_file(filename):
17 gcc_perf_file = open(filename, 'r')
18 for line in gcc_perf_file:
19 if "Minimal Runtime:" in line:
20 return float(line.split(":")[-1])
21
22
23 t_gcc = [get_runtime_from_file("perf_workbook/odeint_rk4_array_gcc.perf"),
24 get_runtime_from_file("perf_ariel/odeint_rk4_array_gcc.perf"),
25 get_runtime_from_file("perf_lyra/odeint_rk4_array_gcc.perf")]
26
27 t_intel = [get_runtime_from_file("perf_workbook/odeint_rk4_array_intel.perf"),
28 get_runtime_from_file("perf_ariel/odeint_rk4_array_intel.perf"),
29 get_runtime_from_file("perf_lyra/odeint_rk4_array_intel.perf")]
30
31 t_gfort = [get_runtime_from_file("perf_workbook/rk4_gfort.perf"),
32 get_runtime_from_file("perf_ariel/rk4_gfort.perf"),
33 get_runtime_from_file("perf_lyra/rk4_gfort.perf")]
34
35 t_c_intel = [get_runtime_from_file("perf_workbook/rk4_c_intel.perf"),
36 get_runtime_from_file("perf_ariel/rk4_c_intel.perf"),
37 get_runtime_from_file("perf_lyra/rk4_c_intel.perf")]
38
39 print t_c_intel
40
41
42 ind = np.arange(3) # the x locations for the groups
43 width = 0.15 # the width of the bars
44
45 fig = plt.figure()
46 ax = fig.add_subplot(111)
47 rects1 = ax.bar(ind, t_gcc, width, color='b', label="odeint gcc")
48 rects2 = ax.bar(ind+width, t_intel, width, color='g', label="odeint intel")
49 rects3 = ax.bar(ind+2*width, t_c_intel, width, color='y', label="C intel")
50 rects4 = ax.bar(ind+3*width, t_gfort, width, color='c', label="gfort")
51
52 ax.axis([-width, 2.0+5*width, 0.0, 0.85])
53 ax.set_ylabel('Runtime (s)')
54 ax.set_title('Performance for integrating the Lorenz system')
55 ax.set_xticks(ind + 1.5*width)
56 ax.set_xticklabels(('Core i5-3210M\n3.1 GHz',
57 'Xeon E5-2690\n3.8 GHz',
58 'Opteron 8431\n 2.4 GHz'))
59 ax.legend(loc='upper left', prop={'size': 16})
60
61 plt.savefig("perf.pdf")
62 plt.savefig("perf.png", dpi=50)
63
64 plt.show()