In [ ]:
%matplotlib inline
In [ ]:
import matplotlib.pyplot as plt
In [ ]:
ls
In [ ]:
import seaborn as sns
In [ ]:
result_files = !ls *_results_*.csv
In [ ]:
def reader(filename):
return pd.read_csv(filename, index_col=[0], header=[0, 1])
In [ ]:
def get_core_count(x):
return int(os.path.splitext(x.split('_')[-1])[0])
def get_core_count_index(x):
return pd.Index([2 ** i for i in range(int(np.log2(get_core_count(x))) + 1)], name='cores')
In [ ]:
dfs = [reader(f) for f in result_files]
dfs
In [ ]:
core_counts = [get_core_count_index(f) for f in result_files]
core_counts
In [ ]:
names = [{32: 'Live Beef (32 cores)', 8: 'Mac \'n Cheese (8 cores)'}[get_core_count(f)] for f in result_files]
names
In [ ]:
for x, index, name in zip(dfs, core_counts, names):
x.index = index
x['name'] = name
In [ ]:
df = pd.concat(dfs).set_index('name', append=True)
df.columns.names = ['grouper', 'reducer']
df = df.T.stack().reorder_levels([2, 0, 1]).sort_index()
df
In [ ]:
fig, axs = plt.subplots(1, 2, figsize=(30, 12), sharey=True)
for i, (ax, (gk, gv)) in enumerate(zip(axs.flat, df.groupby(level='name'))):
gv.reset_index(level='name', drop=True).plot(kind='bar', ax=ax)
ax.tick_params(labelsize=20)
ax.set_xticklabels([x.get_text().strip('()').replace(',', ' ---') for x in ax.get_xticklabels()])
for xtl in ax.get_xticklabels():
xtl.set_color('white')
for ytl in ax.get_yticklabels():
ytl.set_color('white')
if not i:
ax.set_ylabel('Time in seconds', fontsize=30, color='white')
ax.set_xlabel('Grouper, Reducer', fontsize=30, color='white')
ax.set_title(ax.get_title(), color='white')
for t in ax.legend().get_texts():
t.set_color('white')
t.set_size(30)
ax.set_title(gk, fontsize=40)
fig.autofmt_xdate()
fig.tight_layout()
fig.savefig('perfbar.png', bbox_inches='tight', transparent=True)