Skip to content

Commit

Permalink
plot changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bksaiki committed Jul 1, 2024
1 parent 30a40d4 commit a5a57f0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
35 changes: 23 additions & 12 deletions infra/platforms/cross-plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

input_style = 's'
platform_style = '.'
supported_style = '.'
desugared_style = '.'
supported_style = '2'
desugared_style = '_'

# preferred order
order = [
Expand Down Expand Up @@ -322,9 +322,8 @@ def plot_baseline_all(output_dir: Path, entries):
supported_frontier.sort(key=lambda pt: pt[0])
desugared_frontier.sort(key=lambda pt: pt[0])

platform_max = max(map(lambda pt: pt[0], platform_frontier))
desugared_max = max(map(lambda pt: pt[0], desugared_frontier))
print(f'{name} {platform_max / desugared_max}')
# platform_max = max(map(lambda pt: pt[0], platform_frontier))
# desugared_max = max(map(lambda pt: pt[0], desugared_frontier))

relative_frontier = desugared_frontier
input_pt = normalize([input_pt], relative_frontier)[0]
Expand All @@ -343,19 +342,31 @@ def plot_baseline_all(output_dir: Path, entries):
ax.set_title(display_names[name], size='medium')
ax.plot([input_x], [input_y], input_style, color=input_color)
ax.plot(platform_xs, platform_ys, platform_style, color=platform_color)
ax.plot(supported_xs, supported_ys, supported_style, color=supported_color)
ax.plot(supported_xs, supported_ys, supported_style, color=supported_color, mfc='none')
ax.plot(desugared_xs, desugared_ys, desugared_style, color=desugared_color)

# axis formatting
# y-axis formatting
ax.yaxis.set_major_formatter(FormatStrFormatter('%.1f'))
if max(map(lambda pt: pt[1], platform_frontier)) > 2:
ymax = max(map(lambda pt: pt[1], platform_frontier))
print(name, ymax)
if ymax > 2:
ax.set(ylim=(0, 4))
else:
elif ymax > 1.25:
ax.set(ylim=(0, 2))
else:
ax.set(ylim=(0, 1.5))

# x-axis formatting
# WARN: hard coded
# if name in ['arith', 'arith-fma', 'avx']:
# ax.set(xlim=(500, 1000))
# else:
# ax.set(xlim=(1350, 2800))

# xmin = min(map(lambda pt: pt[0], platform_frontier + supported_frontier + desugared_frontier))
# xmax = max(map(lambda pt: pt[0], platform_frontier + supported_frontier + desugared_frontier))
# print(name, xmin, xmax)

# line
xmin = min(map(lambda pt: pt[0], platform_frontier + supported_frontier + desugared_frontier))
xmax = max(map(lambda pt: pt[0], platform_frontier + supported_frontier + desugared_frontier))
#ax.hlines(y=1, xmin=xmin, xmax=xmax, color='gray', linestyle='--')

for i in range(len(names), 3 * nrows):
Expand Down
8 changes: 8 additions & 0 deletions infra/platforms/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ def plot_improve(name: str, output_dir: Path, info):
ylabel = 'Sum of error log2(ULP)'
xs, ys = zip(*frontier)

# plt.title('NMSE')
# plt.xticks([0, 2, 4, 6, 8, 10, 12])

# plt.title('Math')
# plt.xticks([0, 3, 6, 9, 12, 15, 18])
# plt.xlim((0, 19))


plt.plot(xs, ys, platform_style, color=platform_color, label='Chassis')
plt.xlabel(xlabel, fontsize=12)
plt.ylabel(ylabel, fontsize=12)
Expand Down

0 comments on commit a5a57f0

Please sign in to comment.