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.

92 lines
3.3 KiB

  1. import os
  2. import json
  3. import pandas as pd
  4. from itertools import chain
  5. import seaborn as sns
  6. import matplotlib.pyplot as plt
  7. runid = "Run ID"
  8. x_label = "Thread Count"
  9. y_label = "Throughput in GiB/s"
  10. var_label = "Thread Counts"
  11. thread_counts = ["1t", "2t", "4t", "8t", "12t"]
  12. thread_counts_nice = ["1 Thread", "2 Threads", "4 Threads", "8 Threads", "12 Threads"]
  13. engine_counts = ["1mib-1e", "1mib-4e", "1gib-1e", "1gib-4e"]
  14. engine_counts_nice = ["1 E/WQ and Tasksize 1 MiB", "4 E/WQ and Tasksize 1 MiB", "1 E/WQ and Tasksize 1 GiB", "4 E/WQ and Tasksize 1 GiB"]
  15. title = "Per-Thread Throughput - 120 Copy Operations split on Threads Intra-Node on DDR"
  16. index = [runid, x_label, var_label]
  17. data = []
  18. def calc_throughput(size_bytes,time_ns):
  19. time_seconds = time_ns * 1e-9
  20. size_gib = size_bytes / (1024 ** 3)
  21. throughput_gibs = size_gib / time_seconds
  22. return throughput_gibs
  23. def index_from_element(value,array):
  24. for (idx,val) in enumerate(array):
  25. if val == value: return idx
  26. return 0
  27. def load_time_mesurements(file_path):
  28. with open(file_path, 'r') as file:
  29. data = json.load(file)
  30. count = data["count"]
  31. iterations = data["list"][0]["task"]["iterations"]
  32. # work queue size is 120 which is split over all available threads
  33. # therefore we divide the result by 120/n_threads to get the per-element speed
  34. return {
  35. "total" : sum([x / (iterations * 120) for x in list(chain([data["list"][i]["report"]["time"]["total"] for i in range(count)]))]),
  36. "combined" : [x / (120 / count) for x in list(chain(*[data["list"][i]["report"]["time"]["combined"] for i in range(count)]))],
  37. "submission" : [x / (120 / count) for x in list(chain(*[data["list"][i]["report"]["time"]["submission"] for i in range(count)]))],
  38. "completion" : [x / (120 / count) for x in list(chain(*[data["list"][i]["report"]["time"]["completion"] for i in range(count)]))]
  39. }
  40. def process_file_to_dataset(file_path, engine_label, thread_count):
  41. engine_index = index_from_element(engine_label,engine_counts)
  42. engine_nice = engine_counts_nice[engine_index]
  43. threadc_index = index_from_element(thread_count, thread_counts)
  44. thread_count_nice = thread_counts_nice[threadc_index]
  45. data_size = 0
  46. if engine_label in ["1gib-1e", "1gib-4e"]:
  47. data_size = 1024*1024*1024
  48. else:
  49. data_size = 1024*1024
  50. try:
  51. time = [load_time_mesurements(file_path)["total"]]
  52. run_idx = 0
  53. for t in time:
  54. data.append({ runid : run_idx, x_label: thread_count_nice, var_label : engine_nice, y_label : calc_throughput(data_size, t)})
  55. run_idx = run_idx + 1
  56. except FileNotFoundError:
  57. return
  58. def main():
  59. folder_path = "benchmark-results/"
  60. for engine_label in engine_counts:
  61. for thread_count in thread_counts:
  62. file = os.path.join(folder_path, f"mtsubmit-{thread_count}-{engine_label}.json")
  63. process_file_to_dataset(file, engine_label, thread_count)
  64. df = pd.DataFrame(data)
  65. df.set_index(index, inplace=True)
  66. sns.barplot(x=x_label, y=y_label, hue=var_label, data=df, palette="rocket", errorbar="sd")
  67. plt.title(title)
  68. plt.savefig(os.path.join(folder_path, "plot-perf-mtsubmit.png"), bbox_inches='tight')
  69. plt.show()
  70. if __name__ == "__main__":
  71. main()