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.

95 lines
3.2 KiB

  1. import os
  2. import json
  3. import pandas as pd
  4. from pandas.core.ops import methods
  5. import seaborn as sns
  6. import matplotlib.pyplot as plt
  7. runid = "Run ID"
  8. x_label = "Copy Type"
  9. y_label = "Throughput in GiB/s"
  10. var_label = "Configuration"
  11. types = ["intersock-n0ton4", "internode-n0ton1"]
  12. types_nice = ["Inter-Socket Copy", "Inter-Node Copy"]
  13. copy_methods = ["dstcopy", "srccopy", "xcopy"]
  14. copy_methods_nice = [ "Engine on DST-Node", "Engine on SRC-Node", "Cross-Copy / Both Engines" ]
  15. title = "Performance of Engine Location - Copy Operation on DDR with Size 1 MiB and 1 Engine per WQ"
  16. index = [runid, x_label, var_label]
  17. data = []
  18. def calc_throughput(size_bytes,time_microseconds):
  19. time_seconds = time_microseconds * 1e-9
  20. size_gib = size_bytes / (1024 ** 3)
  21. throughput_gibs = size_gib / time_seconds
  22. return throughput_gibs
  23. def index_from_element(value,array):
  24. for (idx,val) in enumerate(array):
  25. if val == value: return idx
  26. return 0
  27. def load_and_process_copy_json(file_path,method_label):
  28. with open(file_path, 'r') as file:
  29. data = json.load(file)
  30. # Extracting time from JSON structure
  31. if method_label == "xcopy":
  32. # For xcopy method, add times from two entries and divide by 3
  33. time0 = data["list"][0]["report"]["time"]
  34. time1 = data["list"][1]["report"]["time"]
  35. return {
  36. "combined" : [sum(x) / 4 for x in zip(time0["combined"], time1["combined"])],
  37. "submission" : [sum(x) / 4 for x in zip(time0["completion"], time1["completion"])],
  38. "completion" : [sum(x) / 4 for x in zip(time0["submission"], time1["submission"])]
  39. }
  40. else:
  41. return data["list"][0]["report"]["time"]
  42. # Function to plot the graph for the new benchmark
  43. def create_copy_dataset(file_paths, method_label):
  44. times = []
  45. method_index = index_from_element(method_label,copy_methods)
  46. method_nice = copy_methods_nice[method_index]
  47. idx = 0
  48. for file_path in file_paths:
  49. time = load_and_process_copy_json(file_path,method_label)
  50. times.append(time["combined"])
  51. idx = idx + 1
  52. throughput = [[calc_throughput(1024*1024,time) for time in t] for t in times]
  53. idx = 0
  54. for run_set in throughput:
  55. run_idx = 0
  56. for run in run_set:
  57. data.append({ runid : run_idx, x_label: types_nice[idx], var_label : method_nice, y_label : throughput[idx][run_idx]})
  58. run_idx = run_idx + 1
  59. idx = idx + 1
  60. # Main function to iterate over files and create plots for the new benchmark
  61. def main():
  62. folder_path = "benchmark-results/"
  63. for method_label in copy_methods:
  64. copy_file_paths = [os.path.join(folder_path, f"{method_label}-{type_label}-1mib-1e.json") for type_label in types]
  65. create_copy_dataset(copy_file_paths, method_label)
  66. df = pd.DataFrame(data)
  67. df.set_index(index, inplace=True)
  68. df = df.sort_values(y_label)
  69. sns.barplot(x=x_label, y=y_label, hue=var_label, data=df, palette="rocket", errorbar="sd")
  70. plt.title(title)
  71. plt.savefig(os.path.join(folder_path, "plot-perf-enginelocation.png"), bbox_inches='tight')
  72. plt.show()
  73. if __name__ == "__main__":
  74. main()