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.

112 lines
4.4 KiB

  1. import os
  2. import json
  3. import pandas as pd
  4. import seaborn as sns
  5. import matplotlib.pyplot as plt
  6. from common import calc_throughput, index_from_element
  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 1MiB", "Inter-Node 1MiB", "Inter-Socket 1GiB", "Inter-Node 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 = \
  16. """Throughput showing impact of Engine Location\n
  17. Copy Operation on DDR with 1 Engine per WQ"""
  18. description = \
  19. """Throughput showing impact of Engine Location\n
  20. Some Configurations missing as they are not feesible\n
  21. Copy Operation on DDR with 1 Engine per WQ"""
  22. index = [runid, x_label, var_label]
  23. data = []
  24. # loads the measurements from a given file and processes them
  25. # so that they are normalized, meaning that the timings returned
  26. # are nanoseconds per element transfered
  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. # procceses a single file and appends the desired timings
  51. # to the global data-array, handles multiple runs with a runid
  52. # and ignores if the given file is not found as some
  53. # configurations may not be benchmarked
  54. def create_copy_dataset(file_path, method_label, type_label):
  55. method_index = index_from_element(method_label,copy_methods)
  56. method_nice = copy_methods_nice[method_index]
  57. type_index = index_from_element(type_label, types)
  58. type_nice = types_nice[type_index]
  59. data_size = 0
  60. if type_label in ["internode-n0ton1-1gib", "intersock-n0ton4-1gib"]: data_size = 1024*1024*1024
  61. elif type_label in ["internode-n0ton1-1mib", "intersock-n0ton4-1mib"]: data_size = 1024 * 1024
  62. else: data_size = 0
  63. try:
  64. run_idx = 0
  65. time = [load_time_mesurements(file_path,method_label)["total"]]
  66. for t in time:
  67. data.append({ runid : run_idx, x_label: type_nice, var_label : method_nice, y_label : calc_throughput(data_size, t)})
  68. run_idx = run_idx + 1
  69. except FileNotFoundError:
  70. return
  71. # loops over all possible configuration combinations and calls
  72. # process_file_to_dataset for them in order to build a dataframe
  73. # which is then displayed and saved
  74. def main():
  75. result_path = "benchmark-results/"
  76. output_path = "benchmark-plots/"
  77. for method_label in copy_methods:
  78. for type_label in types:
  79. file = os.path.join(result_path, f"{method_label}-{type_label}-1e.json")
  80. create_copy_dataset(file, method_label, type_label)
  81. df = pd.DataFrame(data)
  82. df.set_index(index, inplace=True)
  83. df = df.sort_values(y_label)
  84. sns.barplot(x=x_label, y=y_label, hue=var_label, data=df, palette="rocket", errorbar="sd")
  85. plt.title(title)
  86. plt.savefig(os.path.join(output_path, "plot-perf-enginelocation.png"), bbox_inches='tight')
  87. plt.show()
  88. if __name__ == "__main__":
  89. main()