-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfigure15.py
More file actions
58 lines (48 loc) · 1.96 KB
/
figure15.py
File metadata and controls
58 lines (48 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import sys
import os
import pandas as pd
from matplotlib.cm import ScalarMappable
import matplotlib.ticker as mtick
sys.path.append(os.path.dirname(__file__))
from utils import *
plt.rcParams["font.family"] = "Times New Roman"
plt.rcParams.update({'font.size': FONT_SIZE})
plt.rcParams["figure.figsize"] = (6, 4)
plt.rcParams['axes.xmargin'] = 0
plt.rcParams['axes.ymargin'] = 0
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['ps.fonttype'] = 42
fig, axs = plt.subplots(1, 2, figsize=(8,6))
xlim = (0,3)
ylim = (0.5,5)
df = pd.read_csv(RESULTS_DIR + f"/figure15_cascade.csv")
ax = axs[0]
ax = df.plot.scatter(x='loads_per_fma', y='Speed-up vs Sparse', c='sparsity', colormap='cividis', alpha=0.5, s=1, ax=ax, colorbar=False)
ax.axhline(y=1.0, color='r', linestyle='-', linewidth=0.5)
ax.set_title('Versus MKL SpMM (CSR)', fontsize=FONT_SIZE+1)
ax.set_ylabel('Speedup')
ax.set_xlabel('Loads-per-FMA')
ax.spines.right.set_visible(False)
ax.spines.top.set_visible(False)
ax.set_xlim(xlim)
df = pd.read_csv(RESULTS_DIR + f"/figure15_raspberrypi.csv")
ax = axs[1]
ax = df.plot.scatter(x='loads_per_fma', y='Speed-up vs Sparse', c='sparsity', colormap='cividis', alpha=0.5, s=1, ax=ax, colorbar=False)
ax.axhline(y=1.0, color='r', linestyle='-', linewidth=0.5)
ax.set_title('Versus XNN SpMM', fontsize=FONT_SIZE+1)
ax.set_ylabel(None)
ax.set_xlabel('Loads-per-FMA')
ax.spines.right.set_visible(False)
ax.spines.top.set_visible(False)
ax.set_xlim(xlim)
cmap = plt.get_cmap("cividis")
norm = plt.Normalize(60, 95)
sm = ScalarMappable(norm=norm, cmap=cmap)
sm.set_array([])
cbar = fig.colorbar(sm, ax=axs, pad=0.15, location='bottom', shrink=0.45)
cbar.ax.set_title("Sparsity", position=(-0.18,5.5), pad=-4, y=0.3, fontsize=16)
cbar.ax.tick_params(axis='both', which='major', labelsize=14)
cbar.ax.tick_params(axis='both', which='minor', labelsize=8)
cbar.ax.xaxis.set_major_formatter(mtick.PercentFormatter(decimals=0))
cbar.ax.set_xticks([x + 5 for x in cbar.ax.get_xticks()[:-1]])
savefig("figure15.pdf")