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.

100 lines
3.2 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-6
  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. time = {
  32. "combined" : data["list"][0]["report"]["time"]["combined"],
  33. "submit" : data["list"][0]["report"]["time"]["submission"],
  34. "complete" : data["list"][0]["report"]["time"]["completion"]
  35. }
  36. return time
  37. # Function to plot the graph for the new benchmark
  38. def plot_submit_graph(file_paths, type_label):
  39. times = []
  40. type_index = index_from_element(type_label,types)
  41. type_nice = types_nice[type_index]
  42. idx = 0
  43. for file_path in file_paths:
  44. time = load_and_process_submit_json(file_path)
  45. times.append(time["combined"])
  46. idx = idx + 1
  47. # Adjust time measurements based on type
  48. # which can contain multiple submissions
  49. if type_label in {"bs10", "ms10"}:
  50. times = [[t / 10 for t in time] for time in times]
  51. elif type_label in {"ms50", "bs50"}:
  52. times = [[t / 50 for t in time] for time in times]
  53. times[0] = [t / 1 for t in times[0]]
  54. times[1] = [t / 4 for t in times[1]]
  55. times[2] = [t / (1024) for t in times[2]]
  56. times[3] = [t / (32*1024) for t in times[3]]
  57. throughput = [[calc_throughput(1000*1000,time) for time in t] for t in times]
  58. idx = 0
  59. for run_set in throughput:
  60. run_idx = 0
  61. for run in run_set:
  62. data.append({ runid : run_idx, x_label: sizes_nice[idx], var_label : type_nice, y_label : throughput[idx][run_idx]})
  63. run_idx = run_idx + 1
  64. idx = idx + 1
  65. # Main function to iterate over files and create plots for the new benchmark
  66. def main():
  67. folder_path = "benchmark-results/" # Replace with the actual path to your folder
  68. for type_label in types:
  69. file_paths = [os.path.join(folder_path, f"submit-{type_label}-{size}-1e.json") for size in sizes]
  70. plot_submit_graph(file_paths, type_label)
  71. df = pd.DataFrame(data)
  72. df.set_index(index, inplace=True)
  73. df = df.sort_values(y_label)
  74. sns.barplot(x=x_label, y=y_label, hue=var_label, data=df, palette="rocket", errorbar="sd")
  75. plt.title(title)
  76. plt.savefig(os.path.join(folder_path, "plot-perf-submitmethod.png"), bbox_inches='tight')
  77. plt.show()
  78. if __name__ == "__main__":
  79. main()