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.

87 lines
2.8 KiB

  1. import os
  2. import json
  3. import pandas as pd
  4. from pandas.core.ops import methods
  5. import seaborn as sns
  6. import matplotlib.pyplot as plt
  7. x_label = "Copy Type"
  8. y_label = "Throughput in GiB/s"
  9. var_label = "Thread Counts"
  10. thread_counts = ["1t", "2t", "4t", "8t", "12t"]
  11. thread_counts_nice = ["1 Thread", "2 Threads", "4 Threads", "8 Threads", "12 Threads"]
  12. engine_counts = ["1e", "4e"]
  13. engine_counts_nice = ["1 Engine per Group", "4 Engines per Group"]
  14. title = "Performance of Multi-Threaded Submit - Copy Operation Intra-Node on DDR with Size 1 MiB"
  15. data = {
  16. x_label : thread_counts_nice,
  17. engine_counts_nice[0] : [],
  18. engine_counts_nice[1] : [],
  19. }
  20. def calc_throughput(size_bytes,time_microseconds):
  21. time_seconds = time_microseconds * 1e-6
  22. size_gib = size_bytes / (1024 ** 3)
  23. throughput_gibs = size_gib / time_seconds
  24. return throughput_gibs
  25. def index_from_element(value,array):
  26. for (idx,val) in enumerate(array):
  27. if val == value: return idx
  28. return 0
  29. # Function to load and process the JSON file for the multi-threaded benchmark
  30. def load_and_process_mt_json(file_path):
  31. with open(file_path, 'r') as file:
  32. data = json.load(file)
  33. # Extracting count from JSON structure
  34. count = data["count"]
  35. # Extracting time from JSON structure for elements 0 to count
  36. times = [data["list"][i]["report"]["time"]["combined_avg"] for i in range(count)]
  37. # Calculating the average of times
  38. average_time = sum(times) / count
  39. return average_time
  40. # Function to plot the graph for the new benchmark
  41. def plot_mt_graph(file_paths, engine_label):
  42. times = []
  43. for file_path in file_paths:
  44. # Load and process JSON file for the new benchmark
  45. time_microseconds = load_and_process_mt_json(file_path)
  46. times.append(time_microseconds)
  47. engine_index = index_from_element(engine_label,engine_counts)
  48. engine_nice = engine_counts_nice[engine_index]
  49. throughput = [calc_throughput(1024*1024, t) for t in times]
  50. data[engine_nice] = throughput
  51. # Main function to iterate over files and create plots for the new benchmark
  52. def main():
  53. folder_path = "benchmark-results/mtsubmit-bench/" # Replace with the actual path to your folder
  54. for engine_label in engine_counts:
  55. mt_file_paths = [os.path.join(folder_path, f"mtsubmit-{thread_count}-{engine_label}.json") for thread_count in thread_counts]
  56. plot_mt_graph(mt_file_paths, engine_label)
  57. df = pd.DataFrame(data)
  58. dfm = pd.melt(df, id_vars=x_label, var_name=var_label, value_name=y_label)
  59. sns.catplot(x=x_label, y=y_label, hue=var_label, data=dfm, kind='bar', height=5, aspect=1, palette="viridis")
  60. plt.title(title)
  61. plt.savefig(os.path.join(folder_path, "plot-cost-mtsubmit.png"), bbox_inches='tight')
  62. plt.show()
  63. if __name__ == "__main__":
  64. main()