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 10import numpy as np 11from matplotlib import pyplot as plt 12 13plt.rc("font", size=16) 14 15 16def 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 23t_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 27t_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 31t_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 35t_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 39print t_c_intel 40 41 42ind = np.arange(3) # the x locations for the groups 43width = 0.15 # the width of the bars 44 45fig = plt.figure() 46ax = fig.add_subplot(111) 47rects1 = ax.bar(ind, t_gcc, width, color='b', label="odeint gcc") 48rects2 = ax.bar(ind+width, t_intel, width, color='g', label="odeint intel") 49rects3 = ax.bar(ind+2*width, t_c_intel, width, color='y', label="C intel") 50rects4 = ax.bar(ind+3*width, t_gfort, width, color='c', label="gfort") 51 52ax.axis([-width, 2.0+5*width, 0.0, 0.85]) 53ax.set_ylabel('Runtime (s)') 54ax.set_title('Performance for integrating the Lorenz system') 55ax.set_xticks(ind + 1.5*width) 56ax.set_xticklabels(('Core i5-3210M\n3.1 GHz', 57 'Xeon E5-2690\n3.8 GHz', 58 'Opteron 8431\n 2.4 GHz')) 59ax.legend(loc='upper left', prop={'size': 16}) 60 61plt.savefig("perf.pdf") 62plt.savefig("perf.png", dpi=50) 63 64plt.show() 65