Files
cem17/figures/plots.py
2017-05-16 11:47:15 -07:00

80 lines
2.3 KiB
Python

import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import math
sns.set(style="white", context="talk")
plt.rcdefaults()
DPI=300
BBOX_INCHES='tight'
def autolabel(ax, rect):
"""
Attach a text label above each bar displaying its height
"""
height = rect.get_height()
ax.text(rect.get_x() + rect.get_width()/2., 1.05*height,
'%d' % int(round(height)),
ha='center', va='bottom')
path='figures/mlfmm_bw'
width=0.33
fig, ax = plt.subplots()
systems = ('1T\n(1 XE)', "32T\n(1 XE)", "1 GPU\n(1 XK)" ,"4 GPU\n(4 XK)", "16 GPU\n(16 XK)")
mlfmm = (1.50e6, 8.64e4, 2.783779e4, 7.01e3, 1.89e3)
num = (45,45,45,45,47)
x_pos = np.arange(len(systems))
rects = ax.bar([p-width/2 for p in x_pos], [i/j for i,j in zip(mlfmm,num)], color='darkgray', log=True, width=width)
autolabel(ax, rects[0])
autolabel(ax, rects[1])
autolabel(ax, rects[2])
autolabel(ax, rects[3])
autolabel(ax, rects[4])
ax.set_ylim(1,8e4)
ax2=ax.twinx()
rects = ax2.bar([p+width/2 for p in x_pos], [mlfmm[0] / i for i in mlfmm], color='lightgray', log=True, width=width)
autolabel(ax2, rects[1])
autolabel(ax2, rects[2])
autolabel(ax2, rects[3])
autolabel(ax2, rects[4])
ax2.set_ylim(1,1.5e3)
ax.set_xticks(x_pos)
ax.set_xticklabels(systems)
ax.set_ylabel("Per-MLFMM Execution Time (ms)")
ax2.set_ylabel("Speedup over Sequential")
plt.savefig(path+'.pdf', bbox_inches=BBOX_INCHES)
plt.savefig(path+'.png', dpi=DPI, bbox_inches=BBOX_INCHES)
print path
path="figures/mlfmm_minsky"
width = 0.33
fig, ax = plt.subplots()
systems = ('1T', "160T", "1 GPU" ,"4 GPU")
mlfmm = [1.25e6, 4.84e4, 5.22e3, 1.29e3]
num = (44,44,44,44)
x_pos = np.arange(len(systems))
rects = ax.bar([p-width/2 for p in x_pos], [i/j for i,j in zip(mlfmm,num)], color='darkgray', log=True, width=width)
autolabel(ax, rects[0])
autolabel(ax, rects[1])
autolabel(ax, rects[2])
autolabel(ax, rects[3])
ax.set_ylim(1,8e4)
ax2=ax.twinx()
rects = ax2.bar([p+width/2 for p in x_pos], [mlfmm[0] / i for i in mlfmm], color='lightgray', log=True, width=width)
autolabel(ax2, rects[1])
autolabel(ax2, rects[2])
autolabel(ax2, rects[3])
ax2.set_ylim(1,1.5e3)
ax.set_xticks(x_pos)
ax.set_xticklabels(systems)
ax.set_ylabel("Per-MLFMM Execution Time (ms)")
ax2.set_ylabel("Speedup over Sequential")
plt.savefig(path+'.pdf', bbox_inches=BBOX_INCHES)
plt.savefig(path+'.png', dpi=DPI, bbox_inches=BBOX_INCHES)
print path