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.

109 lines
4.1 KiB

  1. import os
  2. import json
  3. import pandas as pd
  4. from itertools import chain
  5. import seaborn as sns
  6. import matplotlib.pyplot as plt
  7. from common import calc_throughput
  8. result_path = "benchmark-results/"
  9. output_path = "benchmark-plots/"
  10. runid = "Run ID"
  11. x_label = "Destination Node"
  12. y_label = "Throughput in GiB/s"
  13. title_allnodes = \
  14. """Copy Throughput in GiB/s tested for 1GiB Elements\n
  15. Using all 8 DSA Chiplets available on the System"""
  16. title_smartnodes = \
  17. """Copy Throughput in GiB/s tested for 1GiB Elements\n
  18. Using Cross-Copy for Intersocket and all 4 Chiplets of Socket for Intrasocket"""
  19. title_difference = \
  20. """Gain in Copy Throughput in GiB/s of All-DSA vs. Smart Assignment"""
  21. description_smartnodes = \
  22. """Copy Throughput in GiB/s tested for 1GiB Elements\n
  23. Nodes of {8...15} are HBM accessors for their counterparts (minus 8)\n
  24. Using all 4 DSA Chiplets of a Socket for Intra-Socket Operation\n
  25. And using only the Source and Destination Nodes DSA for Inter-Socket"""
  26. description_allnodes = \
  27. """Copy Throughput in GiB/s tested for 1GiB Elements\n
  28. Nodes of {8...15} are HBM accessors for their counterparts (minus 8)\n
  29. Using all 8 DSA Chiplets available on the System"""
  30. index = [ runid, x_label, y_label]
  31. data = []
  32. # loads the measurements from a given file and processes them
  33. # so that they are normalized, meaning that the timings returned
  34. # are nanoseconds per element transfered
  35. def load_time_mesurements(file_path):
  36. with open(file_path, 'r') as file:
  37. data = json.load(file)
  38. count = data["count"]
  39. batch_size = data["list"][0]["task"]["batching"]["batch_size"] if data["list"][0]["task"]["batching"]["batch_size"] > 0 else 1
  40. iterations = data["list"][0]["task"]["iterations"]
  41. return {
  42. "size": data["list"][0]["task"]["size"],
  43. "total": sum([x / (iterations * batch_size * count * count) for x in list(chain([data["list"][i]["report"]["time"]["total"] for i in range(count)]))]),
  44. "combined": [ x / (count * batch_size) for x in list(chain(*[data["list"][i]["report"]["time"]["combined"] for i in range(count)]))],
  45. "submission": [ x / (count * batch_size) for x in list(chain(*[data["list"][i]["report"]["time"]["submission"] for i in range(count)]))],
  46. "completion": [ x / (count * batch_size) for x in list(chain(*[data["list"][i]["report"]["time"]["completion"] for i in range(count)]))]
  47. }
  48. # procceses a single file and appends the desired timings
  49. # to the global data-array, handles multiple runs with a runid
  50. # and ignores if the given file is not found as some
  51. # configurations may not be benchmarked
  52. def process_file_to_dataset(file_path, src_node, dst_node):
  53. try:
  54. file_data = load_time_mesurements(file_path)
  55. time = file_data["combined"]
  56. run_idx = 0
  57. for t in time:
  58. size = file_data["size"]
  59. tp = calc_throughput(size, t)
  60. data.append({ runid : run_idx, x_label : dst_node, y_label : tp})
  61. run_idx = run_idx + 1
  62. except FileNotFoundError:
  63. return
  64. def plot_bar(table,title,node_config):
  65. plt.figure(figsize=(8, 6))
  66. sns.barplot(x=x_label, y=y_label, data=table, palette="rocket", errorbar=None)
  67. plt.ylim(0, 100)
  68. plt.savefig(os.path.join(output_path, f"plot-perf-{node_config}-cpu-throughput-selectbarplot.pdf"), bbox_inches='tight')
  69. plt.show()
  70. # loops over all possible configuration combinations and calls
  71. # process_file_to_dataset for them in order to build a dataframe
  72. # which is then displayed and saved
  73. def main(node_config,title):
  74. src_node = 0
  75. for dst_node in {8,11,12,15}:
  76. size = "512mib" if node_config == "allnodes" and src_node == dst_node and src_node >= 8 else "1gib"
  77. file = os.path.join(result_path, f"copy-n{src_node}ton{dst_node}-{size}-{node_config}-cpu-1e.json")
  78. process_file_to_dataset(file, src_node, dst_node)
  79. df = pd.DataFrame(data)
  80. data.clear()
  81. df.set_index(index, inplace=True)
  82. plot_bar(df, title, node_config)
  83. return df
  84. if __name__ == "__main__":
  85. dall = main("allnodes", title_allnodes)
  86. dsmart = main("smart", title_smartnodes)