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.

97 lines
3.7 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-1mib", "internode-n0ton1-1mib", "intersock-n0ton4-1gib", "internode-n0ton1-1gib"]
  12. types_nice = ["Inter-Socket Copy 1MiB", "Inter-Node Copy 1MiB", "Inter-Socket Copy 1GiB", "Inter-Node Copy 1GiB"]
  13. copy_methods = ["dstcopy", "srccopy", "xcopy", "srcoutsidercopy", "dstoutsidercopy", "sockoutsidercopy", "nodeoutsidercopy"]
  14. copy_methods_nice = [ "Engine on DST-Node", "Engine on SRC-Node", "Cross-Copy / Both Engines", "Engine on SRC-Socket, not SRC-Node", "Engine on DST-Socket, not DST-Node", "Engine on different Socket", "Engine on same Socket but neither SRC nor DST Node"]
  15. title = "Performance of Engine Location - Copy Operation on DDR with 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. iterations = data["list"][0]["task"]["iterations"]
  31. # Extracting time from JSON structure
  32. if method_label == "xcopy":
  33. # For xcopy method, add times from two entries and divide by 3
  34. time0 = data["list"][0]["report"]["time"]
  35. time1 = data["list"][1]["report"]["time"]
  36. return {
  37. "total": max(time0["total"],time1["total"]),
  38. "combined" : [max(x,y) for x,y in zip(time0["combined"], time1["combined"])],
  39. "submission" : [max(x,y) for x,y in zip(time0["completion"], time1["completion"])],
  40. "completion" : [max(x,y) for x,y in zip(time0["submission"], time1["submission"])]
  41. }
  42. else:
  43. return data["list"][0]["report"]["time"]
  44. # Function to plot the graph for the new benchmark
  45. def create_copy_dataset(file_path, method_label, type_label):
  46. method_index = index_from_element(method_label,copy_methods)
  47. method_nice = copy_methods_nice[method_index]
  48. type_index = index_from_element(type_label, types)
  49. type_nice = types_nice[type_index]
  50. data_size = 0
  51. if type_label in ["internode-n0ton1-1mib", "intersock-n0ton4-1mib"]:
  52. data_size = 1024 * 1024
  53. else:
  54. data_size = 1024*1024*1024
  55. try:
  56. time = load_and_process_copy_json(file_path,method_label)["total"]
  57. run_idx = 0
  58. for t in time:
  59. data.append({ runid : run_idx, x_label: type_nice, var_label : method_nice, y_label : calc_throughput(data_size, t)})
  60. run_idx = run_idx + 1
  61. except FileNotFoundError:
  62. return
  63. # Main function to iterate over files and create plots for the new benchmark
  64. def main():
  65. folder_path = "benchmark-results/"
  66. for method_label in copy_methods:
  67. for type_label in types:
  68. file = os.path.join(folder_path, f"{method_label}-{type_label}-1e.json")
  69. create_copy_dataset(file, method_label, type_label)
  70. df = pd.DataFrame(data)
  71. df.set_index(index, inplace=True)
  72. df = df.sort_values(y_label)
  73. sns.barplot(x=x_label, y=y_label, hue=var_label, data=df, palette="rocket", errorbar="sd")
  74. plt.title(title)
  75. plt.savefig(os.path.join(folder_path, "plot-perf-enginelocation.png"), bbox_inches='tight')
  76. plt.show()
  77. if __name__ == "__main__":
  78. main()