Files
cem17/figures/plots.py
Carl Pearson c2b90958c4 .
2017-05-04 20:36:58 -05:00

161 lines
5.3 KiB
Python

import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="white", context="talk")
plt.rcdefaults()
DPI=600
path = 'figures/cpu_matvec'
fig, ax = plt.subplots()
systems = ('BW (32T)', "Minsky (160T)")
mlfmm = (8.65e4, 4.71e4)
total = (1.2e5, 5.6e4)
x_pos = np.arange(len(systems))
ax.bar(x_pos, mlfmm, color='gray')
ax.bar(x_pos, [i-j for i,j in zip(total, mlfmm)], color='lightgray', bottom=mlfmm )
ax.set_xticks(x_pos)
ax.set_xticklabels(systems)
ax.set_ylabel("Execution Time (ms)")
# ax.set_title('How fast do you want to go today?')
plt.savefig(path+'.pdf')
plt.savefig(path+'.png', dpi=DPI)
print path
path='figures/mlfmm_bw'
# fig, ax = plt.subplots()
# systems = ('1T', "32T", "1 GPU" ,"4 GPU", "16 GPU")
# mlfmm = (1.50e6, 8.64e4, 2.78e4, 7.01e3, 1.89e3)
# num = (45,45,45,45,47)
# x_pos = np.arange(len(systems))
# ax.bar(x_pos, [i/j for i,j in zip(mlfmm,num)], color='gray', log=True)
# ax.set_xticks(x_pos)
# ax.set_xticklabels(systems)
# ax.set_ylabel("Per-MLFMM Execution Time (ms)")
# plt.ylim([1, 1e5])
# # ax.set_title('How fast do you want to go today?')
# plt.savefig(path+'.pdf')
# plt.savefig(path+'.png', dpi=DPI)
# print path
width=0.25
fig, ax = plt.subplots()
systems = ('1T', "32T", "1 GPU" ,"4 GPU", "16 GPU")
mlfmm = (1.50e6, 8.64e4, 2.78e4, 7.01e3, 1.89e3)
num = (45,45,45,45,47)
x_pos = np.arange(len(systems))
ax.bar([p-width/2 for p in x_pos], [i/j for i,j in zip(mlfmm,num)], color='lightgray', log=True, width=0.25)
ax2=ax.twinx()
ax2.bar([p+width/2 for p in x_pos], [mlfmm[0] / i for i in mlfmm], color='darkgray', log=True, width=0.25)
ax.set_xticks(x_pos)
ax.set_xticklabels(systems)
ax.set_ylabel("Per-MLFMM Execution Time (ms)")
ax2.set_ylabel("Speedup over 1T")
# ax.set_title('How fast do you want to go today?')
plt.savefig(path+'.pdf')
plt.savefig(path+'.png', dpi=DPI)
print path
path="figures/mlfmm_minsky"
# fig, ax = plt.subplots()
# systems = ('1T', "160T", "1 GPU" ,"4 GPU")
# mlfmm = (1.25e6, 4.71e4, 5.22e3, 1.29e3)
# num = (44,44,44,44)
# x_pos = np.arange(len(systems))
# ax.bar(x_pos, [i/j for i,j in zip(mlfmm,num)], color='gray', log=True)
# ax.set_xticks(x_pos)
# ax.set_xticklabels(systems)
# ax.set_ylabel("Per-MLFMM Execution Time (ms)")
# plt.ylim([1, 1e5])
# # ax.set_title('How fast do you want to go today?')
# plt.savefig(path+'.pdf')
# plt.savefig(path+'.png', dpi=DPI)
# print path
# fig, ax = plt.subplots()
# systems = ('1T', "160T", "1 GPU" ,"4 GPU")
# mlfmm = [1.25e6, 4.71e4, 5.22e3, 1.29e3]
# num = (44,44,44,44)
# x_pos = [0,1,2,3]
# sns.barplot(x_pos + x_pos,
# [i/j for i, j in zip(mlfmm,num)] + [mlfmm[0] / i for i in mlfmm],
# ["Time", "Time", "Time", "Time", "Speedup", "Speedup", "Speedup", "Speedup"],
# palette="BuGn_d", ax=ax, log=True)
width = 10
fig, ax = plt.subplots()
systems = ('1T', "160T", "1 GPU" ,"4 GPU")
mlfmm = [1.25e6, 4.71e4, 5.22e3, 1.29e3]
num = (44,44,44,44)
x_pos = [0,1,2,3]
sns.barplot(x_pos,
[i/j for i, j in zip(mlfmm,num)],
color="DarkGray", ax=ax, log=True)
ax.set_ylabel("Per-MLFMM Execution Time (ms)")
ax2 = ax.twinx()
# ax2.set_ylim((0,300))
sns.barplot(x_pos,
[mlfmm[0] / i for i in mlfmm],
color="LightGray", ax=ax2, log=True)
ax2.set_ylabel("Speedup over 1T")
new_width = 0.25
for bar in ax.patches:
center = bar.get_x() + bar.get_width() / 2
bar.set_width(new_width)
bar.set_x(center - new_width)
for bar in ax2.patches:
center = bar.get_x() + bar.get_width() / 2
bar.set_width(new_width)
bar.set_x(center)
ax.set_xticks(x_pos)
ax.set_xticklabels(systems)
# plt.ylim([1, 1e5])
# ax.set_title('How fast do you want to go today?')
plt.savefig(path+'.pdf')
plt.savefig(path+'.png', dpi=DPI)
print path
fig, ax = plt.subplots()
systems = ['BW 32T', "Minsky 160T", "BW 4 GPU" ,"Minsky 4 GPU"]
p2m = (127.10, 72.10749, 7.73, 1.604)
m2m = (156.2506, 102.61091, 9.613814, 1.746476)
m2l = (189.615, 82.67791, 18.177774, 2.671025)
l2l = (91.5957, 101.56461, 20.215436, 2.611185)
l2p = (196.2115, 68.38529, 6.994, 1.395)
p2p = (1117.368, 590.4818, 90.619, 18.265)
total = [sum(i) for i in zip(p2m,m2m,m2l,l2l,l2p,p2p)]
p2m_ratio = [i/j for i,j in zip(p2m, total)]
m2m_ratio = [i/j for i,j in zip(m2m, total)]
m2l_ratio = [i/j for i,j in zip(m2l, total)]
l2l_ratio = [i/j for i,j in zip(l2l, total)]
l2p_ratio = [i/j for i,j in zip(l2p, total)]
p2p_ratio = [i/j for i,j in zip(p2p, total)]
path = 'figures/kernels'
x_pos = np.arange(len(systems))
ax.bar(x_pos, p2p_ratio, color='0', label='p2p')
ax.bar(x_pos, l2p_ratio, color='0.15', label='l2p', bottom=p2p_ratio)
ax.bar(x_pos, l2l_ratio, color='0.3', label='l2l', bottom=[sum(i) for i in zip(l2p_ratio,p2p_ratio)])
ax.bar(x_pos, m2l_ratio, color='0.45', label='m2l', bottom=[sum(i) for i in zip(l2l_ratio, l2p_ratio,p2p_ratio)])
ax.bar(x_pos, m2m_ratio, color='0.6', label='m2m', bottom=[sum(i) for i in zip(m2l_ratio, l2l_ratio, l2p_ratio,p2p_ratio)])
ax.bar(x_pos, p2m_ratio, color='0.75', label='p2m', bottom=[sum(i) for i in zip(m2m_ratio, m2l_ratio, l2l_ratio, l2p_ratio,p2p_ratio)])
ax.set_xticks(x_pos)
ax.set_xticklabels(systems)
ax.set_ylabel("MLFMM Kernel Breakdown")
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles, labels)
# plt.ylim([1, 1e4])
# ax.set_title('How fast do you want to go today?')
plt.savefig(path+'.pdf')
plt.savefig(path+'.png', dpi=DPI)
print path