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.

102 lines
4.0 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"]
  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_ns):
  19. time_seconds = time_ns * 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_time_mesurements(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. if method_label == "xcopy":
  32. # xcopy runs on two engines that both copy 1/2 of the entire
  33. # specified size of 1gib, therefore the maximum time between
  34. # these two is going to be the total time for copy
  35. time0 = data["list"][0]["report"]["time"]
  36. time1 = data["list"][1]["report"]["time"]
  37. return {
  38. "total": max(time0["total"],time1["total"]) / iterations,
  39. "combined" : [max(x,y) for x,y in zip(time0["combined"], time1["combined"])],
  40. "submission" : [max(x,y) for x,y in zip(time0["completion"], time1["completion"])],
  41. "submission" : [max(x,y) for x,y in zip(time0["completion"], time1["completion"])],
  42. }
  43. else:
  44. return {
  45. "total": data["list"][0]["report"]["time"]["total"] / iterations,
  46. "combined": data["list"][0]["report"]["time"]["combined"],
  47. "submission": data["list"][0]["report"]["time"]["submission"],
  48. "completion": data["list"][0]["report"]["time"]["completion"]
  49. }
  50. def create_copy_dataset(file_path, method_label, type_label):
  51. method_index = index_from_element(method_label,copy_methods)
  52. method_nice = copy_methods_nice[method_index]
  53. type_index = index_from_element(type_label, types)
  54. type_nice = types_nice[type_index]
  55. data_size = 0
  56. if type_label in ["internode-n0ton1-1gib", "intersock-n0ton4-1gib"]: data_size = 1024*1024*1024
  57. elif type_label in ["internode-n0ton1-1mib", "intersock-n0ton4-1mib"]: data_size = 1024 * 1024
  58. else: data_size = 0
  59. try:
  60. run_idx = 0
  61. time = [load_time_mesurements(file_path,method_label)["total"]]
  62. for t in time:
  63. data.append({ runid : run_idx, x_label: type_nice, var_label : method_nice, y_label : calc_throughput(data_size, t)})
  64. run_idx = run_idx + 1
  65. except FileNotFoundError:
  66. return
  67. def main():
  68. folder_path = "benchmark-results/"
  69. for method_label in copy_methods:
  70. for type_label in types:
  71. file = os.path.join(folder_path, f"{method_label}-{type_label}-1e.json")
  72. create_copy_dataset(file, method_label, type_label)
  73. df = pd.DataFrame(data)
  74. df.set_index(index, inplace=True)
  75. df = df.sort_values(y_label)
  76. sns.barplot(x=x_label, y=y_label, hue=var_label, data=df, palette="rocket", errorbar="sd")
  77. plt.title(title)
  78. plt.savefig(os.path.join(folder_path, "plot-perf-enginelocation.png"), bbox_inches='tight')
  79. plt.show()
  80. if __name__ == "__main__":
  81. main()