in visualization/plotting.py [0:0]
def plot_scaling(save_fname='scaling.pdf'):
bspn = 256 # batch-size per node
pdf = pd.DataFrame()
net_tags = ['eth', 'ib']
# net_tags = ['ib', 'eth']
net_columns = {}
# construct scaling data-frame
for net_tag in net_tags:
if net_tag == 'eth':
nodes, fpaths, tags, legends, colors = get_eth_config()
elif net_tag == 'ib':
nodes, fpaths, tags, legends, colors = get_ib_config()
pdf['nodes'] = nodes
columns = []
for alg_tags, alg_fpath, alg_legends in zip(tags, fpaths, legends): # iterate over algorithms
alg = alg_legends[0].split(' ')[0] # algorithm name
alg_thpt = []
for i, n in enumerate(nodes):
df = parse_csv(n, alg_tags[i], alg_fpath)
tpi = df['time_mean'].dropna().iloc[-1] # avg time per itr
thpt = tpi
# thpt = (bspn * n) / tpi # throughput (images per second)
alg_thpt.append(thpt)
net_label = '(InfiniBand)' if net_tag == 'ib' else '(Ethernet)'
rtag = alg + ' ' + net_label
pdf[rtag] = alg_thpt
columns.append(rtag)
net_columns[net_tag] = columns
# plot scaling data
fig = plt.figure(1)
ax = fig.add_subplot(111)
for net_tag in net_tags:
if net_tag == 'eth':
_, _, _, _, colors = get_eth_config()
elif net_tag == 'ib':
_, _, _, _, colors = get_ib_config()
columns = net_columns[net_tag]
print(columns)
linestyle = '--' if net_tag == 'ib' else '-'
marker = '1' if net_tag == 'ib' else '2'
for alg, alg_colors in zip(columns, colors):
color = alg_colors[-2]
pdf.plot(x='nodes', y=alg, ax=ax, color=color, grid=True,
label=alg, marker=marker, xticks=nodes, ms=15,
subplots=True, linestyle=linestyle,
fontsize=16)
ax.set_xlabel('Number of nodes', fontsize=font_size)
ax.set_ylabel('Time per iteration (s)', fontsize=font_size)
# ax.set_ylabel('Throughput (Images/sec.)', fontsize=font_size)
ax.grid(which='both')
ax.grid(which='minor', alpha=0.2)
ax.grid(which='major', alpha=0.5)
plt.legend(prop={'size': 16})
plt.tight_layout()
fig.savefig(save_fname)
plt.show()