Skip to content

Instantly share code, notes, and snippets.

@sylvchev
Last active November 30, 2015 13:48
Show Gist options
  • Save sylvchev/97682447313a1d16f642 to your computer and use it in GitHub Desktop.
Save sylvchev/97682447313a1d16f642 to your computer and use it in GitHub Desktop.
Plotting a numpy/scipy benchmark between Canopy (MKL), Anaconda (Netlib) and my Gentoo python (OpenBLAS)
import matplotlib.pyplot as plt
import pickle
from numpy import arange
with open("scipy_canopy.pck", 'r') as f:
o = pickle.load(f)
canopy_dot = o['dot']
canopy_chol = o['chol']
canopy_svd = o['svd']
with open("scipy_anaconda.pck", 'r') as f:
o = pickle.load(f)
anaconda_dot = o['dot']
anaconda_chol = o['chol']
anaconda_svd = o['svd']
with open("scipy_system.pck", 'r') as f:
o = pickle.load(f)
system_dot = o['dot']
system_chol = o['chol']
system_svd = o['svd']
ind = arange(3)
width = 0.25
fig = plt.figure()
ax = plt.subplot()
ca = ax.bar(ind, [canopy_dot.mean(), canopy_chol.mean(), canopy_svd.mean()], width, color='r', yerr=[canopy_dot.std(), canopy_chol.std(), canopy_svd.std()])
sy = ax.bar(ind+width, [system_dot.mean(), system_chol.mean(), system_svd.mean()], width, color='b', yerr=[system_dot.std(), system_chol.std(), system_svd.std()])
an = ax.bar(ind+2*width, [anaconda_dot.mean(), anaconda_chol.mean(), anaconda_svd.mean()], width, color='g', yerr=[anaconda_dot.std(), anaconda_chol.std(), anaconda_svd.std()])
ax.set_ylabel('Time (s)')
ax.set_title('Benchmarking for scipy and numpy')
ax.set_xticks(ind + width)
ax.set_xticklabels(('dot', 'chol', 'svd'))
ax.legend((ca[0], sy[0], an[0]), ('Canopy/MKL', 'system/OpenBLAS', 'Anaconda/slow OpenBLAS'), loc="upper left")
plt.savefig('scipybench.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment