diff --git a/qdp_project/plots/plot-timing-cacheaccess.pdf b/qdp_project/plots/plot-timing-cacheaccess.pdf deleted file mode 100644 index c1370cf..0000000 Binary files a/qdp_project/plots/plot-timing-cacheaccess.pdf and /dev/null differ diff --git a/qdp_project/plots/plot-timing-distprefetch.pdf b/qdp_project/plots/plot-timing-distprefetch.pdf index fb9ae62..e3b1a10 100644 Binary files a/qdp_project/plots/plot-timing-distprefetch.pdf and b/qdp_project/plots/plot-timing-distprefetch.pdf differ diff --git a/qdp_project/plots/plot-timing-dram.pdf b/qdp_project/plots/plot-timing-dram.pdf index 73d6f65..2fec87c 100644 Binary files a/qdp_project/plots/plot-timing-dram.pdf and b/qdp_project/plots/plot-timing-dram.pdf differ diff --git a/qdp_project/plots/plot-timing-hbm.pdf b/qdp_project/plots/plot-timing-hbm.pdf index 9dbe776..574e035 100644 Binary files a/qdp_project/plots/plot-timing-hbm.pdf and b/qdp_project/plots/plot-timing-hbm.pdf differ diff --git a/qdp_project/plots/plot-timing-prefetch.pdf b/qdp_project/plots/plot-timing-prefetch.pdf index f840b29..8bb42a0 100644 Binary files a/qdp_project/plots/plot-timing-prefetch.pdf and b/qdp_project/plots/plot-timing-prefetch.pdf differ diff --git a/qdp_project/plots/table-qdpspeedup.tex b/qdp_project/plots/table-qdpspeedup.tex new file mode 100644 index 0000000..71499be --- /dev/null +++ b/qdp_project/plots/table-qdpspeedup.tex @@ -0,0 +1,10 @@ +\begin{tabular}{lll} +\toprule +Configuration & Speedup & Cache Hitrate \\ +\midrule +DDR-SDRAM (Baseline) & x1.00 & \textemdash \\ +HBM (Upper Limit) & x1.41 & \textemdash \\ +Prefetching & x0.82 & 89.38 \% \\ +Prefetching, Distributed Columns & x1.23 & 93.20 \% \\ +\bottomrule +\end{tabular} diff --git a/qdp_project/plotter.py b/qdp_project/plotter.py index 8643ebf..72747cf 100644 --- a/qdp_project/plotter.py +++ b/qdp_project/plotter.py @@ -1,14 +1,15 @@ import os import csv import numpy as np +import pandas as pd import seaborn as sns import matplotlib.pyplot as plt output_path = "./plots" -hbm_result = "./evaluation-results/baseline/current-hbm/qdp-xeonmax-hbm-tca2-tcb0-tcj1-tmul16-wl4294967296-cs2097152.csv" -dram_result = "./evaluation-results/baseline/current-dram/qdp-xeonmax-dram-tca2-tcb0-tcj1-tmul16-wl4294967296-cs2097152.csv" -prefetch_result = "./evaluation-results/outofcacheallocation/qdp-xeonmax-prefetch-tca2-tcb1-tcj1-tmul16-wl4294967296-cs8388608.csv" -distprefetch_result = "./evaluation-results/distprefetch/qdp-xeonmax-distprefetch-tca1-tcb1-tcj1-tmul32-wl4294967296-cs8388608.csv" +hbm_result = "./evaluation-results/current/qdp-xeonmax-hbm-tca4-tcb0-tcj1-tmul32-wl4294967296-cs2097152.csv" +dram_result = "./evaluation-results/current/qdp-xeonmax-dram-tca2-tcb0-tcj1-tmul32-wl4294967296-cs2097152.csv" +prefetch_result = "./evaluation-results/current/qdp-xeonmax-prefetch-tca1-tcb1-tcj1-tmul32-wl4294967296-cs8388608.csv" +distprefetch_result = "./evaluation-results/current/qdp-xeonmax-distprefetch-tca1-tcb1-tcj1-tmul32-wl4294967296-cs8388608.csv" tt_name = "rt-ns" function_names = [ "scana-run", "scanb-run", "aggrj-run" ] @@ -31,24 +32,83 @@ def read_timings_from_csv(fname) -> tuple[list[float], list[str]]: return list(t.values()), list(t.keys()) -def get_data_prefetch_cache_access() -> tuple[list[float], list[str]]: - total = 0.47 - data = [ 0.01, 0.01, 0.04, 0.42 ] - data = [ x * 100 / total for x in data ] - keys = ["Cache::GetCacheNode", "Cache::Access Itself", "dml::hardware_device::submit", "dml::make_mem_move_task (operator new)"] +def read_total_time_from_csv(fname) -> float: + time = 0 + row_count = 0 + + with open(fname, newline='') as csvfile: + reader = csv.DictReader(csvfile, delimiter=';') + for row in reader: + row_count = row_count + 1 + time += int(row["rt-ns"]) + + return time / (1000 * 1000 * row_count) + + +def read_cache_hitrate_from_csv(fname) -> float: + hitrate = 0 + row_count = 0 + + with open(fname, newline='') as csvfile: + reader = csv.DictReader(csvfile, delimiter=';') + for row in reader: + row_count = row_count + 1 + hitrate += float(row["cache-hr"]) + + return (hitrate * 100) / row_count + + +def generate_speedup_table(): + baseline = read_total_time_from_csv(dram_result) + columns = [ "Configuration", "Speedup", "Cache Hitrate" ] + + names = [ + "DDR-SDRAM (Baseline)", + "HBM (Upper Limit)", + "Prefetching", + "Prefetching, Distributed Columns" + ] + + rawtime = [ + read_total_time_from_csv(dram_result), + read_total_time_from_csv(hbm_result), + read_total_time_from_csv(prefetch_result), + read_total_time_from_csv(distprefetch_result), + ] - return data,keys + speedup = [ + baseline / rawtime[0], + baseline / rawtime[1], + baseline / rawtime[2], + baseline / rawtime[3] + ] -def get_data_prefetch_total() -> tuple[list[float], list[str]]: - return read_timings_from_csv(prefetch_result) + cachehr = [ + 0, + 0, + read_cache_hitrate_from_csv(prefetch_result), + read_cache_hitrate_from_csv(distprefetch_result) + ] + + data = [ + [ names[0], f"x{speedup[0]:1.2f}", r" \textemdash " ], + [ names[1], f"x{speedup[1]:1.2f}", r" \textemdash " ], + [ names[2], f"x{speedup[2]:1.2f}", f"{cachehr[2]:2.2f} \%" ], + [ names[3], f"x{speedup[3]:1.2f}", f"{cachehr[3]:2.2f} \%" ] + ] + + return pd.DataFrame(data, columns=columns) + + +def tex_table(df, fname): + with open(os.path.join(output_path, fname), "w") as of: + of.write(df.to_latex(index=False)) -def get_data_dram_total() -> tuple[list[float], list[str]]: - return # loops over all possible configuration combinations and calls # process_file_to_dataset for them in order to build a dataframe # which is then displayed and saved -def main(data: tuple[list[float], list[str]], fname, unit): +def donut_plot(data: tuple[list[float], list[str]], fname): palette_color = sns.color_palette('mako_r') fig, ax = plt.subplots(figsize=(6, 3), subplot_kw=dict(aspect="equal")) @@ -64,15 +124,19 @@ def main(data: tuple[list[float], list[str]], fname, unit): horizontalalignment = {-1: "right", 1: "left"}[int(np.sign(x))] connectionstyle = f"angle,angleA=0,angleB={ang}" kw["arrowprops"].update({"connectionstyle": connectionstyle}) - ax.annotate(f"{data[1][i]} - {data[0][i]:2.2f} {unit}", xy=(x, y), xytext=(1.35*np.sign(x), 1.4*y), horizontalalignment=horizontalalignment, **kw) + ax.annotate(f"{data[1][i]} - {data[0][i]:2.2f} ms", xy=(x, y), xytext=(1.35*np.sign(x), 1.4*y), horizontalalignment=horizontalalignment, **kw) plt.rcParams.update({'font.size': 18}) fig.savefig(os.path.join(output_path, fname), bbox_inches='tight') +def main(): + donut_plot(read_timings_from_csv(prefetch_result), "plot-timing-prefetch.pdf") + donut_plot(read_timings_from_csv(distprefetch_result), "plot-timing-distprefetch.pdf") + donut_plot(read_timings_from_csv(dram_result), "plot-timing-dram.pdf") + donut_plot(read_timings_from_csv(hbm_result), "plot-timing-hbm.pdf") + tex_table(generate_speedup_table(), "table-qdpspeedup.tex") + + if __name__ == "__main__": - main(get_data_prefetch_cache_access(), "plot-timing-cacheaccess.pdf", "%") - main(read_timings_from_csv(prefetch_result), "plot-timing-prefetch.pdf", "ms") - main(read_timings_from_csv(distprefetch_result), "plot-timing-distprefetch.pdf", "ms") - main(read_timings_from_csv(dram_result), "plot-timing-dram.pdf", "ms") - main(read_timings_from_csv(hbm_result), "plot-timing-hbm.pdf", "ms") + main()