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.

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