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.

79 lines
2.7 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 = "Time in Microseconds"
  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. data = {
  15. x_label : types_nice,
  16. copy_methods_nice[0] : [],
  17. copy_methods_nice[1] : [],
  18. copy_methods_nice[2] : []
  19. }
  20. def index_from_element(value,array):
  21. for (idx,val) in enumerate(array):
  22. if val == value: return idx
  23. return 0
  24. # Function to load and process the JSON file for the new benchmark
  25. def load_and_process_copy_json(file_path, method_label):
  26. with open(file_path, 'r') as file:
  27. data = json.load(file)
  28. # Extracting time from JSON structure
  29. if method_label == "xcopy":
  30. # For xcopy method, add times from two entries and divide by 4
  31. time_entry1 = data["list"][0]["report"]["time"]["combined_avg"]
  32. time_entry2 = data["list"][1]["report"]["time"]["combined_avg"]
  33. time_microseconds = (time_entry1 + time_entry2) / 4
  34. else:
  35. # For other methods, use the time from the single entry
  36. time_microseconds = data["list"][0]["report"]["time"]["combined_avg"]
  37. return time_microseconds
  38. # Function to plot the graph for the new benchmark
  39. def plot_copy_graph(file_paths, method_label):
  40. times = []
  41. for file_path in file_paths:
  42. # Load and process JSON file for the new benchmark
  43. time_microseconds = load_and_process_copy_json(file_path, method_label)
  44. times.append(time_microseconds)
  45. method_index = index_from_element(method_label,copy_methods)
  46. method_nice = copy_methods_nice[method_index]
  47. data[method_nice] = times
  48. # Main function to iterate over files and create plots for the new benchmark
  49. def main():
  50. folder_path = "benchmark-results/cross-copy-bench/" # Replace with the actual path to your folder
  51. for method_label in copy_methods:
  52. copy_file_paths = [os.path.join(folder_path, f"{method_label}-{type_label}-1mib-4e.json") for type_label in types]
  53. plot_copy_graph(copy_file_paths, method_label)
  54. df = pd.DataFrame(data)
  55. dfm = pd.melt(df, id_vars=x_label, var_name=var_label, value_name=y_label)
  56. sns.catplot(x=x_label, y=y_label, hue=var_label, data=dfm, kind='bar', height=5, aspect=1, palette="viridis")
  57. plt.savefig(os.path.join(folder_path, "plot-perf-enginelocation.png"))
  58. plt.show()
  59. if __name__ == "__main__":
  60. main()