Skip to content

Commit bc99ef2

Browse files
committed
plots updates
1 parent 9d15c0a commit bc99ef2

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

infra/cnt_per_iters_plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def plot_cnt_per_iters(outcomes, args):
2222
rival = rival.drop(['baseline_precision'], axis=1)
2323
rival = rival.groupby(['rival_iter'], as_index=False, sort=True).sum()
2424

25-
ax.bar(np.arange(len(baseline)) + 0.9, baseline['number_of_points'], color="green", alpha=1, width=0.4, label='baseline', hatch='/')
26-
ax.bar(np.arange(len(rival)) + 1.1, rival['number_of_points'], color="red", alpha=0.7, width=0.4, label='reval')
25+
ax.bar(np.arange(len(baseline)) + 0.925, baseline['number_of_points'], color="green", alpha=1, width=0.5, label='baseline', hatch='/')
26+
ax.bar(np.arange(len(rival)) + 1.075, rival['number_of_points'], color="red", alpha=0.7, width=0.5, label='reval')
2727

2828
ax.legend()
2929
ax.set_xlabel("Iteration")

infra/histograms.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ def plot_histogram(args, valid=True):
4343
ax.margins(x=0.02)
4444
ax.set_ylabel("Seconds spent")
4545
ax.set_xlabel("Precision (number of bits)")
46-
ax.set_title("Histogram for valid points" if valid else "Histogram for all the points")
47-
46+
4847
plt.legend()
4948
plt.tight_layout()
50-
plt.savefig(args.path + "/histogram_valid.png" if valid else args.path + "/histogram_all.png", format="png")
5149
plt.savefig(args.path + "/histogram_valid.pdf" if valid else args.path + "/histogram_all.pdf", format="pdf")
5250

51+
ax.set_title("Histogram for valid points" if valid else "Histogram for all the points")
52+
plt.tight_layout()
53+
plt.savefig(args.path + "/histogram_valid.png" if valid else args.path + "/histogram_all.png", format="png")
54+
55+
5356

5457
def bucket_precisions_by_bins(data, bins):
5558
x = [0] * len(bins)

infra/ratio_plot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def tool_cmp2speed(x):
9090
ax.set_xticklabels(["$2^{" + str(i+7) + "}$" for i, x in enumerate(x)])
9191

9292
ax.yaxis.grid(True, linestyle='-', which='major', color='grey', alpha=0.3)
93+
plt.tight_layout()
9394
plt.savefig(args.path + "/ratio_plot_precision.png", format="png")
9495
plt.savefig(args.path + "/ratio_plot_precision.pdf", format="pdf")
9596

infra/repeats_plot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ def plot_repeats_plot(outcomes, args):
1111

1212
# Drop precision column and sum up based on iteration
1313
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'])
1415
baseline = (outcomes.loc[(outcomes['tool'] == "baseline") & (outcomes['iter'] > 0)]).sort_values(by=['iter'])
1516

16-
ax.bar(np.arange(len(baseline)) + 0.9, baseline['number_of_instr_executions'], color="green", alpha=1, width=0.4, label='baseline', hatch='/')
17-
ax.bar(np.arange(len(rival)) + 1.1, rival['number_of_instr_executions'], color="red", alpha=0.7, width=0.4, label='reval')
17+
ax.bar(np.arange(len(baseline)) + 0.925, 100, color="green", alpha=0.6, 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=1, width=0.5, label='reval')
1820

1921
ax.legend()
2022
ax.set_xlabel("Iteration")
21-
ax.set_ylabel("Number of instruction executions")
23+
ax.set_ylabel("Percentage of instructions executed")
2224
ax.yaxis.grid(True, linestyle='-', which='major', color='grey', alpha=0.3)
2325
plt.tight_layout()
2426
plt.savefig(args.path + "/repeats_plot.png", format="png")

time.rkt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,17 @@
9090
'mixsample-rival-all
9191
(list (execution-time execution) name precision)))
9292

93-
; Record number of instructions has been executed
94-
93+
; Record percentage of instructions has been executed
9594
(when (equal? rival-status 'valid)
95+
(define rival-no-repeats-instr-cnt
96+
(* (+ 1 rival-iter) (vector-length (rival-machine-instructions rival-machine))))
97+
(define rival-instr-cnt (vector-length rival-executions))
98+
; Report instruction that has been executed
99+
(timeline-push! timeline 'instr-executed-cnt (list 'rival rival-iter rival-instr-cnt))
100+
; Report the total number of instruction that could be executed with no repeats
96101
(timeline-push! timeline
97102
'instr-executed-cnt
98-
(list 'rival rival-iter (vector-length rival-executions))))
103+
(list 'rival-no-repeats rival-iter rival-no-repeats-instr-cnt)))
99104

100105
; --------------------------- Baseline execution ----------------------------------------------
101106
(define baseline-start-apply (current-inexact-milliseconds))

0 commit comments

Comments
 (0)