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.

104 lines
3.1 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 = "Time to Copy 1 KiB in Microseconds"
  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. data = {
  16. x_label : sizes_nice,
  17. types_nice[0] : [],
  18. types_nice[1] : [],
  19. types_nice[2] : [],
  20. types_nice[3] : [],
  21. types_nice[4] : []
  22. }
  23. stdev = {}
  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,s,t):
  29. with open(file_path, 'r') as file:
  30. data = json.load(file)
  31. time_microseconds = data["list"][0]["report"]["time"]["combined_avg"]
  32. if t not in stdev: stdev[t] = dict()
  33. stdev[t][s] = data["list"][0]["report"]["time"]["combined_stdev"]
  34. return time_microseconds
  35. def stdev_functor(values):
  36. v = values[0]
  37. sd = stdev[v]
  38. return (v - sd, v + sd)
  39. # Function to plot the graph for the new benchmark
  40. def plot_submit_graph(file_paths, type_label):
  41. times = []
  42. type_index = index_from_element(type_label,types)
  43. type_nice = types_nice[type_index]
  44. idx = 0
  45. for file_path in file_paths:
  46. time_microseconds = load_and_process_submit_json(file_path,sizes_nice[idx],type_nice)
  47. times.append(time_microseconds)
  48. idx = idx + 1
  49. # Adjust time measurements based on type
  50. # which can contain multiple submissions
  51. if type_label in {"bs10", "ms10"}:
  52. times = [time / 10 for time in times]
  53. elif type_label in {"ms50", "bs50"}:
  54. times = [time / 50 for time in times]
  55. times[0] = times[0] / 1
  56. times[1] = times[1] / 4
  57. times[2] = times[2] / 1024
  58. times[3] = times[3] / (1024 * 1024)
  59. data[type_nice] = times
  60. # Main function to iterate over files and create plots for the new benchmark
  61. def main():
  62. folder_path = "benchmark-results/submit-bench/" # 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. plot_submit_graph(file_paths, type_label)
  66. df = pd.DataFrame(data)
  67. dfm = pd.melt(df, id_vars=x_label, var_name=var_label, value_name=y_label)
  68. error_values: List[float] = []
  69. for index,row in dfm.iterrows():
  70. s = dfm[x_label][index]
  71. t = dfm[var_label][index]
  72. error_values.append(stdev[t][s])
  73. dfm["Stdev"] = error_values
  74. print(dfm)
  75. sns.catplot(x=x_label, y=y_label, hue=var_label, data=dfm, kind='bar', height=5, aspect=1, palette="viridis", errorbar=("ci", 100))
  76. plt.title("Performance of Submission Methods - Copy Operatione tested Intra-Node on DDR")
  77. plt.savefig(os.path.join(folder_path, "plot-perf-submitmethod.png"))
  78. plt.show()
  79. if __name__ == "__main__":
  80. main()