This contains my bachelors thesis and associated tex files, code snippets and maybe more. Topic: Data Movement in Heterogeneous Memories with Intel Data Streaming Accelerator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
3.4 KiB

  1. import os
  2. import csv
  3. import numpy as np
  4. import seaborn as sns
  5. import matplotlib.pyplot as plt
  6. output_path = "./plots"
  7. hbm_result = "./evaluation-results/baseline/current-hbm/qdp-xeonmax-hbm-tca2-tcb0-tcj1-tmul16-wl4294967296-cs2097152.csv"
  8. dram_result = "./evaluation-results/baseline/current-dram/qdp-xeonmax-dram-tca2-tcb0-tcj1-tmul16-wl4294967296-cs2097152.csv"
  9. prefetch_result = "./evaluation-results/outofcacheallocation/qdp-xeonmax-prefetch-tca2-tcb1-tcj1-tmul16-wl4294967296-cs8388608.csv"
  10. distprefetch_result = "./evaluation-results/distprefetch/qdp-xeonmax-distprefetch-tca1-tcb1-tcj1-tmul32-wl4294967296-cs8388608.csv"
  11. tt_name = "rt-ns"
  12. function_names = [ "scana-run", "scanb-run", "aggrj-run" ]
  13. fn_nice = [ "Scan A", "Scan B", "Aggregate" ]
  14. def read_timings_from_csv(fname) -> tuple[list[float], list[str]]:
  15. t = {}
  16. row_count = 0
  17. with open(fname, newline='') as csvfile:
  18. reader = csv.DictReader(csvfile, delimiter=';')
  19. for row in reader:
  20. row_count = row_count + 1
  21. for i in range(len(function_names)):
  22. t[fn_nice[i]] = t.get(fn_nice[i], 0) + int(row[function_names[i]])
  23. t = {key: value / (1000 * 1000 * row_count) for key, value in t.items() if value != 0}
  24. return list(t.values()), list(t.keys())
  25. def get_data_prefetch_cache_access() -> tuple[list[float], list[str]]:
  26. total = 0.47
  27. data = [ 0.01, 0.01, 0.04, 0.42 ]
  28. data = [ x * 100 / total for x in data ]
  29. keys = ["Cache::GetCacheNode", "Cache::Access Itself", "dml::hardware_device::submit", "dml::make_mem_move_task (operator new)"]
  30. return data,keys
  31. def get_data_prefetch_total() -> tuple[list[float], list[str]]:
  32. return read_timings_from_csv(prefetch_result)
  33. def get_data_dram_total() -> tuple[list[float], list[str]]:
  34. return
  35. # loops over all possible configuration combinations and calls
  36. # process_file_to_dataset for them in order to build a dataframe
  37. # which is then displayed and saved
  38. def main(data: tuple[list[float], list[str]], fname, unit):
  39. palette_color = sns.color_palette('mako_r')
  40. fig, ax = plt.subplots(figsize=(6, 3), subplot_kw=dict(aspect="equal"))
  41. wedges, texts = ax.pie(data[0], wedgeprops=dict(width=0.5), startangle=-40, colors=palette_color)
  42. bbox_props = dict(boxstyle="square,pad=0.3", fc="w", ec="k", lw=0.72)
  43. kw = dict(arrowprops=dict(arrowstyle="-"), bbox=bbox_props, zorder=0, va="center")
  44. for i, p in enumerate(wedges):
  45. ang = (p.theta2 - p.theta1)/2. + p.theta1
  46. y = np.sin(np.deg2rad(ang))
  47. x = np.cos(np.deg2rad(ang))
  48. horizontalalignment = {-1: "right", 1: "left"}[int(np.sign(x))]
  49. connectionstyle = f"angle,angleA=0,angleB={ang}"
  50. kw["arrowprops"].update({"connectionstyle": connectionstyle})
  51. 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)
  52. plt.rcParams.update({'font.size': 18})
  53. fig.savefig(os.path.join(output_path, fname), bbox_inches='tight')
  54. if __name__ == "__main__":
  55. main(get_data_prefetch_cache_access(), "plot-timing-cacheaccess.pdf", "%")
  56. main(read_timings_from_csv(prefetch_result), "plot-timing-prefetch.pdf", "ms")
  57. main(read_timings_from_csv(distprefetch_result), "plot-timing-distprefetch.pdf", "ms")
  58. main(read_timings_from_csv(dram_result), "plot-timing-dram.pdf", "ms")
  59. main(read_timings_from_csv(hbm_result), "plot-timing-hbm.pdf", "ms")