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.

81 lines
2.3 KiB

  1. import os
  2. import json
  3. import pandas as pd
  4. from pandas.core.ops import methods
  5. from typing import List
  6. import seaborn as sns
  7. import matplotlib.pyplot as plt
  8. runid = "Run ID"
  9. x_label = "Destination Node"
  10. y_label = "Source Node"
  11. v_label = "Throughput"
  12. title = "Copy Throughput for 1GiB Elements running on SRC Node"
  13. index = [ runid, x_label, y_label]
  14. data = []
  15. def mean_without_outliers(x):
  16. return x.sort_values()[2:-2].mean()
  17. def calc_throughput(size_bytes,time_ns):
  18. time_seconds = time_ns * 1e-9
  19. size_gib = size_bytes / (1024 ** 3)
  20. throughput_gibs = size_gib / time_seconds
  21. return throughput_gibs
  22. def index_from_element(value,array):
  23. for (idx,val) in enumerate(array):
  24. if val == value: return idx
  25. return 0
  26. def load_time_mesurements(file_path):
  27. with open(file_path, 'r') as file:
  28. data = json.load(file)
  29. iterations = data["list"][0]["task"]["iterations"]
  30. return {
  31. "total": data["list"][0]["report"]["time"]["total"] / iterations,
  32. "combined": data["list"][0]["report"]["time"]["combined"],
  33. "submission": data["list"][0]["report"]["time"]["submission"],
  34. "completion": data["list"][0]["report"]["time"]["completion"]
  35. }
  36. def process_file_to_dataset(file_path, src_node, dst_node):
  37. data_size = 1024*1024*1024
  38. try:
  39. time = [load_time_mesurements(file_path)["total"]]
  40. run_idx = 0
  41. for t in time:
  42. data.append({ runid : run_idx, x_label : dst_node, y_label : src_node, v_label: calc_throughput(data_size, t)})
  43. run_idx = run_idx + 1
  44. except FileNotFoundError:
  45. return
  46. def main():
  47. folder_path = "benchmark-results/"
  48. for src_node in range(16):
  49. for dst_node in range(16):
  50. file = os.path .join(folder_path, f"copy-n{src_node}ton{dst_node}-1gib-1e.json")
  51. process_file_to_dataset(file, src_node, dst_node)
  52. df = pd.DataFrame(data)
  53. df.set_index(index, inplace=True)
  54. data_pivot = df.pivot_table(index=y_label, columns=x_label, values=v_label)
  55. sns.heatmap(data_pivot, annot=True, cmap="rocket_r", fmt=".0f")
  56. plt.title(title)
  57. plt.savefig(os.path.join(folder_path, "plot-perf-peakthroughput.png"), bbox_inches='tight')
  58. plt.show()
  59. if __name__ == "__main__":
  60. main()