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.

90 lines
3.1 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 = "Configuration"
  10. types = ["intersock-n0ton4", "internode-n0ton1"]
  11. types_nice = ["Inter-Socket Copy", "Inter-Node Copy"]
  12. copy_methods = ["dstcopy", "srccopy", "xcopy"]
  13. copy_methods_nice = [ "Engine on DST-Node", "Engine on SRC-Node", "Cross-Copy / Both Engines" ]
  14. title = "Performance of Engine Location - Copy Operation on DDR with Size 1 MiB"
  15. data = {
  16. x_label : types_nice,
  17. copy_methods_nice[0] : [],
  18. copy_methods_nice[1] : [],
  19. copy_methods_nice[2] : []
  20. }
  21. def calc_throughput(size_bytes,time_microseconds):
  22. time_seconds = time_microseconds * 1e-6
  23. size_gib = size_bytes / (1024 ** 3)
  24. throughput_gibs = size_gib / time_seconds
  25. return throughput_gibs
  26. def index_from_element(value,array):
  27. for (idx,val) in enumerate(array):
  28. if val == value: return idx
  29. return 0
  30. # Function to load and process the JSON file for the new benchmark
  31. def load_and_process_copy_json(file_path, method_label):
  32. with open(file_path, 'r') as file:
  33. data = json.load(file)
  34. # Extracting time from JSON structure
  35. if method_label == "xcopy":
  36. # For xcopy method, add times from two entries and divide by 4
  37. time_entry1 = data["list"][0]["report"]["time"]["combined_avg"]
  38. time_entry2 = data["list"][1]["report"]["time"]["combined_avg"]
  39. time_microseconds = (time_entry1 + time_entry2) / 4
  40. else:
  41. # For other methods, use the time from the single entry
  42. time_microseconds = data["list"][0]["report"]["time"]["combined_avg"]
  43. return time_microseconds
  44. # Function to plot the graph for the new benchmark
  45. def plot_copy_graph(file_paths, method_label):
  46. times = []
  47. for file_path in file_paths:
  48. # Load and process JSON file for the new benchmark
  49. time_microseconds = load_and_process_copy_json(file_path, method_label)
  50. times.append(time_microseconds)
  51. method_index = index_from_element(method_label,copy_methods)
  52. method_nice = copy_methods_nice[method_index]
  53. throughput = [calc_throughput(1024*1024, t) for t in times]
  54. data[method_nice] = throughput
  55. # Main function to iterate over files and create plots for the new benchmark
  56. def main():
  57. folder_path = "benchmark-results/cross-copy-bench/" # Replace with the actual path to your folder
  58. for method_label in copy_methods:
  59. copy_file_paths = [os.path.join(folder_path, f"{method_label}-{type_label}-1mib-4e.json") for type_label in types]
  60. plot_copy_graph(copy_file_paths, method_label)
  61. df = pd.DataFrame(data)
  62. dfm = pd.melt(df, id_vars=x_label, var_name=var_label, value_name=y_label)
  63. sns.catplot(x=x_label, y=y_label, hue=var_label, data=dfm, kind='bar', height=5, aspect=1, palette="viridis")
  64. plt.title(title)
  65. plt.savefig(os.path.join(folder_path, "plot-perf-enginelocation.png"), bbox_inches='tight')
  66. plt.show()
  67. if __name__ == "__main__":
  68. main()