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.

107 lines
4.0 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. data.append({ runid : run_idx, x_label : dst_node, y_label : calc_throughput(file_data["size"], t)})
  59. run_idx = run_idx + 1
  60. except FileNotFoundError:
  61. return
  62. def plot_bar(table,title,node_config):
  63. plt.figure(figsize=(8, 6))
  64. sns.barplot(x=x_label, y=y_label, data=table, palette="rocket")
  65. plt.ylim(0, 100)
  66. plt.savefig(os.path.join(output_path, f"plot-perf-{node_config}-throughput-selectbarplot.png"), bbox_inches='tight')
  67. plt.show()
  68. # loops over all possible configuration combinations and calls
  69. # process_file_to_dataset for them in order to build a dataframe
  70. # which is then displayed and saved
  71. def main(node_config,title):
  72. src_node = 0
  73. for dst_node in {8,11,12,15}:
  74. size = "512mib" if node_config == "allnodes" and src_node == dst_node and src_node >= 8 else "1gib"
  75. file = os.path.join(result_path, f"copy-n{src_node}ton{dst_node}-{size}-{node_config}-1e.json")
  76. process_file_to_dataset(file, src_node, dst_node)
  77. df = pd.DataFrame(data)
  78. data.clear()
  79. df.set_index(index, inplace=True)
  80. plot_bar(df, title, node_config)
  81. return df
  82. if __name__ == "__main__":
  83. dall = main("allnodes", title_allnodes)
  84. dsmart = main("smart", title_smartnodes)