Skip to content

Commit 5bb7897

Browse files
committed
repeats plot update for skipped percentage instead of evaluated percentage
1 parent c4c0616 commit 5bb7897

File tree

2 files changed

+45
-12
lines changed

2 files changed

+45
-12
lines changed

infra/ratio_plot.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def plot_speed_graph_rival_iter(outcomes, args):
1212
# Drop precision column and sum up based on iteration
1313
outcomes = outcomes.drop(['baseline_precision'], axis=1)
1414
outcomes = outcomes.groupby(['rival_iter', 'tool_name'], as_index=False).sum()
15-
15+
1616
# Select appropriate tools
1717
baseline_cmp = outcomes.loc[(outcomes['tool_name'] == "valid-baseline") & (outcomes['rival_iter'] > 0)]
1818
rival_cmp = outcomes.loc[(outcomes['tool_name'] == "valid-rival") & (outcomes['rival_iter'] > 0)]
@@ -44,10 +44,10 @@ def tool_cmp2speed(x):
4444
plt.savefig(args.path + "/ratio_plot_iter.pdf", format="pdf")
4545

4646
# Latex stuff
47-
print("\\newcommand{\RivalAvgSpeedupOverSollya}{" + str(round(sollya_cmp['time'].sum() / rival_cmp['time'].sum(), 2)) + "\\xspace}")
48-
print("\\newcommand{\RivalAvgSpeedupOverBaseline}{" + str(round(baseline_cmp['time'].sum() / rival_cmp['time'].sum(), 2)) + "\\xspace}")
49-
print("\\newcommand{\RivalMaxSpeedupOverSollya}{" + str(round(np.array(tool_cmp2speed(rival_cmp)[1])[-1]/np.array(tool_cmp2speed(sollya_cmp)[1])[-1], 2)) + "\\xspace}")
50-
print("\\newcommand{\RivalMaxSpeedupOverBaseline}{" + str(round(np.array(tool_cmp2speed(rival_cmp)[1])[-1]/np.array(tool_cmp2speed(baseline_cmp)[1])[-1], 2)) + "\\xspace}")
47+
# print("\\newcommand{\RivalAvgSpeedupOverSollya}{" + str(round(sollya_cmp['time'].sum() / rival_cmp['time'].sum(), 2)) + "\\xspace}")
48+
# print("\\newcommand{\RivalAvgSpeedupOverBaseline}{" + str(round(baseline_cmp['time'].sum() / rival_cmp['time'].sum(), 2)) + "\\xspace}")
49+
# print("\\newcommand{\RivalMaxSpeedupOverSollya}{" + str(round(np.array(tool_cmp2speed(rival_cmp)[1])[-1]/np.array(tool_cmp2speed(sollya_cmp)[1])[-1], 2)) + "\\xspace}")
50+
# print("\\newcommand{\RivalMaxSpeedupOverBaseline}{" + str(round(np.array(tool_cmp2speed(rival_cmp)[1])[-1]/np.array(tool_cmp2speed(baseline_cmp)[1])[-1], 2)) + "\\xspace}")
5151

5252
def plot_speed_graph_baseline_precision(outcomes, args):
5353
# Create figure
@@ -63,6 +63,17 @@ def plot_speed_graph_baseline_precision(outcomes, args):
6363
rival_cmp = outcomes.loc[(outcomes['tool_name'] == "valid-rival") & (outcomes['baseline_precision'] > 73)]
6464
sollya_cmp = outcomes.loc[(outcomes['tool_name'] == "valid-sollya") & (outcomes['baseline_precision'] > 73)]
6565

66+
print("\\newcommand{\NumTunedPoints}{" + rival_cmp['number_of_points'].sum() + "\\xspace}")
67+
68+
rival_initial = float(outcomes.loc[(outcomes['tool_name'] == "valid-rival") & (outcomes['baseline_precision'] == 73)]['time'])
69+
baseline_initial = float(outcomes.loc[(outcomes['tool_name'] == "valid-baseline") & (outcomes['baseline_precision'] == 73)]['time'])
70+
sollya_initial = float(outcomes.loc[(outcomes['tool_name'] == "valid-sollya") & (outcomes['baseline_precision'] == 73)]['time'])
71+
72+
print("\\newcommand{\RivalInitialSpeedupOverSollya}{" + str(round(sollya_initial/rival_initial, 2)) + "\\xspace}")
73+
print("\\newcommand{\RivalInitialSpeedupOverBaseline}{" + str(round(baseline_initial/rival_initial, 2)) + "\\xspace}")
74+
75+
76+
6677
# Some weird functions that creates speed per millisecond for each tool
6778
def add_values(row):
6879
return int(row['baseline_precision']), (row['number_of_points'] / row['time']) * 1000

infra/repeats_plot.py

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,39 @@ def plot_repeats_plot(outcomes, args):
1010
fig.tight_layout(pad=2.0)
1111

1212
# Drop precision column and sum up based on iteration
13-
rival = (outcomes.loc[(outcomes['tool'] == "rival") & (outcomes['iter'] > 0)]).sort_values(by=['iter'])
14-
rival_no_repeats = (outcomes.loc[(outcomes['tool'] == "rival-no-repeats") & (outcomes['iter'] > 0)]).sort_values(by=['iter'])
15-
baseline = (outcomes.loc[(outcomes['tool'] == "baseline") & (outcomes['iter'] > 0)]).sort_values(by=['iter'])
13+
rival = (outcomes.loc[(outcomes['tool'] == "rival")]).sort_values(by=['iter'])
14+
rival_no_repeats = (outcomes.loc[(outcomes['tool'] == "rival-no-repeats")]).sort_values(by=['iter'])
15+
baseline = (outcomes.loc[(outcomes['tool'] == "baseline")]).sort_values(by=['iter'])
1616

17-
ax.bar(np.arange(len(baseline)) + 0.925, 100, color="green", alpha=1, width=0.5, label='baseline', hatch='/')
18-
percentages = np.array(rival['number_of_instr_executions']) / np.array(rival_no_repeats['number_of_instr_executions']) * 100
19-
ax.bar(np.arange(len(rival)) + 1.075, percentages, color="red", alpha=0.7, width=0.5, label='reval')
17+
# ax.bar(np.arange(len(baseline)) - 0.075, 100, color="green", alpha=1, width=0.5, label='baseline', hatch='/')
18+
percentages = (1.0 - np.array(rival['number_of_instr_executions']) / np.array(rival_no_repeats['number_of_instr_executions'])) * 100
19+
ax.bar(np.arange(len(rival)), percentages, color="red", alpha=0.7, label='reval')
20+
21+
average = round((1.0 - (rival['number_of_instr_executions'].sum() / rival_no_repeats['number_of_instr_executions'].sum())) * 100, 2)
22+
print("\\newcommand{\AveragePercentageOfSkippedInstr}{" + str(average) + "\\xspace}")
23+
maximum = round((1.0 - (np.array(rival['number_of_instr_executions'])[-1] / np.array(rival_no_repeats['number_of_instr_executions'])[-1])) * 100, 2)
24+
print("\\newcommand{\MaximumPercentageOfSkippedInstr}{" + str(maximum) + "\\xspace}")
25+
26+
# Print percentages
27+
for bar in ax.patches:
28+
if bar.get_height() == 0:
29+
ax.text(
30+
bar.get_x() + bar.get_width() / 2,
31+
bar.get_height() + bar.get_y() - bar.get_height()/2 + 0.5,
32+
str(round(bar.get_height(), 2)) + "%",
33+
ha='center',
34+
color='black')
35+
else:
36+
ax.text(
37+
bar.get_x() + bar.get_width() / 2,
38+
bar.get_height() + bar.get_y() - bar.get_height()/2 + 0.5,
39+
str(round(bar.get_height(), 2)) + "%",
40+
ha='center',
41+
color='black')
2042

2143
ax.legend()
2244
ax.set_xlabel("Iteration")
23-
ax.set_ylabel("Percentage of instructions executed")
45+
ax.set_ylabel("Percentage of instructions skipped")
2446
ax.yaxis.grid(True, linestyle='-', which='major', color='grey', alpha=0.3)
2547
plt.tight_layout()
2648
plt.savefig(args.path + "/repeats_plot.png", format="png")

0 commit comments

Comments
 (0)