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.

113 lines
3.4 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. x_label = "Size of Submitted Task"
  9. y_label = "Throughput in GiB/s"
  10. var_label = "Submission Type"
  11. sizes = ["1kib", "4kib", "1mib", "1gib"]
  12. sizes_nice = ["1 KiB", "4 KiB", "1 MiB", "1 GiB"]
  13. types = ["bs10", "bs50", "ms10", "ms50", "ssaw"]
  14. types_nice = ["Batch, Size 10", "Batch, Size 50", "Multi-Submit, Count 10", "Multi Submit, Count 50", "Single Submit"]
  15. title = "Performance of Submission Methods - Copy Operation tested Intra-Node on DDR"
  16. data = {
  17. x_label : sizes_nice,
  18. types_nice[0] : [],
  19. types_nice[1] : [],
  20. types_nice[2] : [],
  21. types_nice[3] : [],
  22. types_nice[4] : []
  23. }
  24. stdev = {}
  25. def calc_throughput(size_bytes,time_microseconds):
  26. time_seconds = time_microseconds * 1e-6
  27. size_gib = size_bytes / (1024 ** 3)
  28. throughput_gibs = size_gib / time_seconds
  29. return throughput_gibs
  30. def index_from_element(value,array):
  31. for (idx,val) in enumerate(array):
  32. if val == value: return idx
  33. return 0
  34. def load_and_process_submit_json(file_path,s,t):
  35. with open(file_path, 'r') as file:
  36. data = json.load(file)
  37. time_microseconds = data["list"][0]["report"]["time"]["combined_avg"]
  38. if t not in stdev: stdev[t] = dict()
  39. stdev[t][s] = data["list"][0]["report"]["time"]["combined_stdev"]
  40. return time_microseconds
  41. def stdev_functor(values):
  42. v = values[0]
  43. sd = stdev[v]
  44. return (v - sd, v + sd)
  45. # Function to plot the graph for the new benchmark
  46. def plot_submit_graph(file_paths, type_label):
  47. times = []
  48. type_index = index_from_element(type_label,types)
  49. type_nice = types_nice[type_index]
  50. idx = 0
  51. for file_path in file_paths:
  52. time_microseconds = load_and_process_submit_json(file_path,sizes_nice[idx],type_nice)
  53. times.append(time_microseconds)
  54. idx = idx + 1
  55. # Adjust time measurements based on type
  56. # which can contain multiple submissions
  57. if type_label in {"bs10", "ms10"}:
  58. times = [time / 10 for time in times]
  59. elif type_label in {"ms50", "bs50"}:
  60. times = [time / 50 for time in times]
  61. times[0] = times[0] / 1
  62. times[1] = times[1] / 4
  63. times[2] = times[2] / 1024
  64. times[3] = times[3] / (1024 * 1024)
  65. throughput = [calc_throughput(1024,t) for t in times]
  66. data[type_nice] = throughput
  67. # Main function to iterate over files and create plots for the new benchmark
  68. def main():
  69. folder_path = "benchmark-results/submit-bench/" # Replace with the actual path to your folder
  70. for type_label in types:
  71. file_paths = [os.path.join(folder_path, f"submit-{type_label}-{size}-1e.json") for size in sizes]
  72. plot_submit_graph(file_paths, type_label)
  73. df = pd.DataFrame(data)
  74. dfm = pd.melt(df, id_vars=x_label, var_name=var_label, value_name=y_label)
  75. error_values: List[float] = []
  76. for index,row in dfm.iterrows():
  77. s = dfm[x_label][index]
  78. t = dfm[var_label][index]
  79. error_values.append(stdev[t][s])
  80. dfm["Stdev"] = error_values
  81. print(dfm)
  82. sns.catplot(x=x_label, y=y_label, hue=var_label, data=dfm, kind='bar', height=5, aspect=1, palette="viridis", errorbar=("ci", 100))
  83. plt.title(title)
  84. plt.savefig(os.path.join(folder_path, "plot-perf-submitmethod.png"), bbox_inches='tight')
  85. plt.show()
  86. if __name__ == "__main__":
  87. main()