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.

77 lines
3.2 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. prefetch_result = "./evaluation-results/qdp-xeonmax-simple-prefetch-tca4-tcb1-tcj2-tmul8-wl4294967296-cs8388608.csv"
  8. dram_result = "./evaluation-results/qdp-xeonmax-simple-dram-tca2-tcb0-tcj1-tmul16-wl4294967296-cs2097152.csv"
  9. tt_name = "rt-ns"
  10. function_names = [ "scana-run", "scana-load", "scanb-run", "aggrj-run", "aggrj-load" ]
  11. fn_nice = [ "Scan A, Filter", "Scan A, Load", "Scan B", "Aggregate, Project + Sum", "Aggregate, Load" ]
  12. def read_timings_from_csv(fname) -> tuple[list[float], list[str]]:
  13. t = {}
  14. total_time = 0
  15. # Read data from CSV file
  16. with open(fname, newline='') as csvfile:
  17. reader = csv.DictReader(csvfile, delimiter=';')
  18. for row in reader:
  19. total_time += int(row[tt_name])
  20. for i in range(len(function_names)):
  21. t[fn_nice[i]] = t.get(fn_nice[i], 0) + int(row[function_names[i]])
  22. t = {key: value * 100 / total_time for key, value in t.items() if value != 0}
  23. total = sum(list(t.values()))
  24. if total < 100.0:
  25. t["Waiting / Other"] = 100.0 - total
  26. return list(t.values()), list(t.keys())
  27. def get_data_prefetch_cache_access() -> tuple[list[float], list[str]]:
  28. total = 1.14
  29. data = [ 0.05, 0.02, 0.17, 0.40, 0.36, 0.13 ]
  30. data = [ x * 100 / total for x in data ]
  31. keys = ["Cache::GetCacheNode", "Cache::GetFromCache", "dml::handler::constructor", "Cache::AllocOnNode", "dml::make_task", "dml::submit"]
  32. return data,keys
  33. def get_data_prefetch_total() -> tuple[list[float], list[str]]:
  34. return read_timings_from_csv(prefetch_result)
  35. def get_data_dram_total() -> tuple[list[float], list[str]]:
  36. return read_timings_from_csv(dram_result)
  37. # loops over all possible configuration combinations and calls
  38. # process_file_to_dataset for them in order to build a dataframe
  39. # which is then displayed and saved
  40. def main(data: tuple[list[float], list[str]], fname):
  41. palette_color = sns.color_palette('mako')
  42. fig, ax = plt.subplots(figsize=(6, 3), subplot_kw=dict(aspect="equal"))
  43. wedges, texts = ax.pie(data[0], wedgeprops=dict(width=0.5), startangle=-40, colors=palette_color)
  44. bbox_props = dict(boxstyle="square,pad=0.3", fc="w", ec="k", lw=0.72)
  45. kw = dict(arrowprops=dict(arrowstyle="-"), bbox=bbox_props, zorder=0, va="center")
  46. for i, p in enumerate(wedges):
  47. ang = (p.theta2 - p.theta1)/2. + p.theta1
  48. y = np.sin(np.deg2rad(ang))
  49. x = np.cos(np.deg2rad(ang))
  50. horizontalalignment = {-1: "right", 1: "left"}[int(np.sign(x))]
  51. connectionstyle = f"angle,angleA=0,angleB={ang}"
  52. kw["arrowprops"].update({"connectionstyle": connectionstyle})
  53. ax.annotate(f"{data[1][i]} - {data[0][i]:2.1f}%", xy=(x, y), xytext=(1.35*np.sign(x), 1.4*y), horizontalalignment=horizontalalignment, **kw)
  54. fig.savefig(os.path.join(output_path, fname), bbox_inches='tight')
  55. if __name__ == "__main__":
  56. main(get_data_prefetch_cache_access(), "plot-timing-prefetch-cacheaccess.pdf")
  57. main(get_data_prefetch_total(), "plot-timing-prefetch-totalexec.pdf")
  58. main(get_data_dram_total(), "plot-timing-dram-totalexec.pdf")