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.

95 lines
3.0 KiB

  1. import os
  2. import json
  3. import pandas as pd
  4. from pandas.core.ops import methods
  5. from typing import List
  6. import seaborn as sns
  7. import matplotlib.pyplot as plt
  8. runid = "Run ID"
  9. x_label = "Size of Submitted Task"
  10. y_label = "Throughput in GiB/s"
  11. var_label = "Submission Type"
  12. sizes = ["1kib", "4kib", "1mib", "32mib"]
  13. sizes_nice = ["1 KiB", "4 KiB", "1 MiB", "32 MiB"]
  14. types = ["bs10", "bs50", "ms10", "ms50", "ssaw"]
  15. types_nice = ["Batch, Size 10", "Batch, Size 50", "Multi-Submit, Count 10", "Multi-Submit, Count 50", "Single Submit"]
  16. title = "Performance of Submission Methods - Copy Operation tested Intra-Node on DDR"
  17. index = [runid, x_label, var_label]
  18. data = []
  19. def calc_throughput(size_bytes,time_microseconds):
  20. time_seconds = time_microseconds * 1e-9
  21. size_gib = size_bytes / (1024 ** 3)
  22. throughput_gibs = size_gib / time_seconds
  23. return throughput_gibs
  24. def index_from_element(value,array):
  25. for (idx,val) in enumerate(array):
  26. if val == value: return idx
  27. return 0
  28. def load_and_process_submit_json(file_path):
  29. with open(file_path, 'r') as file:
  30. data = json.load(file)
  31. return data["list"][0]["report"]["time"]
  32. # Function to plot the graph for the new benchmark
  33. def create_submit_dataset(file_paths, type_label):
  34. times = []
  35. type_index = index_from_element(type_label,types)
  36. type_nice = types_nice[type_index]
  37. idx = 0
  38. for file_path in file_paths:
  39. time = load_and_process_submit_json(file_path)
  40. times.append(time["combined"])
  41. idx = idx + 1
  42. # Adjust time measurements based on type
  43. # which can contain multiple submissions
  44. if type_label in {"bs10", "ms10"}:
  45. times = [[t / 10 for t in time] for time in times]
  46. elif type_label in {"ms50", "bs50"}:
  47. times = [[t / 50 for t in time] for time in times]
  48. times[0] = [t / 1 for t in times[0]]
  49. times[1] = [t / 4 for t in times[1]]
  50. times[2] = [t / (1024) for t in times[2]]
  51. times[3] = [t / (32*1024) for t in times[3]]
  52. throughput = [[calc_throughput(1024,time) for time in t] for t in times]
  53. idx = 0
  54. for run_set in throughput:
  55. run_idx = 0
  56. for run in run_set:
  57. data.append({ runid : run_idx, x_label: sizes_nice[idx], var_label : type_nice, y_label : throughput[idx][run_idx]})
  58. run_idx = run_idx + 1
  59. idx = idx + 1
  60. # Main function to iterate over files and create plots for the new benchmark
  61. def main():
  62. folder_path = "benchmark-results/" # Replace with the actual path to your folder
  63. for type_label in types:
  64. file_paths = [os.path.join(folder_path, f"submit-{type_label}-{size}-1e.json") for size in sizes]
  65. create_submit_dataset(file_paths, type_label)
  66. df = pd.DataFrame(data)
  67. df.set_index(index, inplace=True)
  68. df = df.sort_values(y_label)
  69. sns.barplot(x=x_label, y=y_label, hue=var_label, data=df, palette="rocket", errorbar="sd")
  70. plt.title(title)
  71. plt.savefig(os.path.join(folder_path, "plot-perf-submitmethod.png"), bbox_inches='tight')
  72. plt.show()
  73. if __name__ == "__main__":
  74. main()