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.

102 lines
3.7 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. from common import calc_throughput, index_from_element
  8. runid = "Run ID"
  9. x_label = "Thread Count"
  10. y_label = "Throughput in GiB/s"
  11. var_label = "Transfer Size"
  12. thread_counts = ["1t", "2t", "12t"]
  13. thread_counts_nice = ["1 Thread", "2 Threads", "12 Threads"]
  14. engine_counts = ["1mib-1e", "1gib-1e"]
  15. engine_counts_nice = ["1 MiB", "1 GiB"]
  16. title = \
  17. """Total Throughput showing cost of MT Submit\n
  18. Copying 120x split on n Threads Intra-Node on DDR\n
  19. """
  20. description = \
  21. """Total Throughput showing cost of MT Submit\n
  22. Running 120 Copy Operations split on n Threads\n
  23. Copying Intra-Node on DDR performed for multiple Configurations\n
  24. """
  25. index = [runid, x_label, var_label]
  26. data = []
  27. # loads the measurements from a given file and processes them
  28. # so that they are normalized, meaning that the timings returned
  29. # are nanoseconds per element transfered
  30. def load_time_mesurements(file_path):
  31. with open(file_path, 'r') as file:
  32. data = json.load(file)
  33. count = data["count"]
  34. iterations = data["list"][0]["task"]["iterations"]
  35. # work queue size is 120 which is split over all available threads
  36. # therefore we divide the result by 120/n_threads to get the per-element speed
  37. return {
  38. "total" : sum([x / (iterations * 120) for x in list(chain([data["list"][i]["report"]["time"]["total"] for i in range(count)]))]),
  39. "combined" : [x / 120 for x in list(chain(*[data["list"][i]["report"]["time"]["combined"] for i in range(count)]))],
  40. "submission" : [x / 120 for x in list(chain(*[data["list"][i]["report"]["time"]["submission"] for i in range(count)]))],
  41. "completion" : [x / 120 for x in list(chain(*[data["list"][i]["report"]["time"]["completion"] for i in range(count)]))]
  42. }
  43. # procceses a single file and appends the desired timings
  44. # to the global data-array, handles multiple runs with a runid
  45. # and ignores if the given file is not found as some
  46. # configurations may not be benchmarked
  47. def process_file_to_dataset(file_path, engine_label, thread_count):
  48. engine_index = index_from_element(engine_label,engine_counts)
  49. engine_nice = engine_counts_nice[engine_index]
  50. threadc_index = index_from_element(thread_count, thread_counts)
  51. thread_count_nice = thread_counts_nice[threadc_index]
  52. data_size = 0
  53. if engine_label in ["1gib-1e", "1gib-4e"]: data_size = 1024*1024*1024
  54. elif engine_label in ["1mib-1e", "1mib-4e"]: data_size = 1024*1024
  55. else: data_size = 0
  56. try:
  57. time = load_time_mesurements(file_path)["combined"]
  58. run_idx = 0
  59. for t in time:
  60. data.append({ runid : run_idx, x_label: thread_count_nice, var_label : engine_nice, y_label : calc_throughput(data_size, t)})
  61. run_idx = run_idx + 1
  62. except FileNotFoundError:
  63. return
  64. # loops over all possible configuration combinations and calls
  65. # process_file_to_dataset for them in order to build a dataframe
  66. # which is then displayed and saved
  67. def main():
  68. result_path = "benchmark-results/"
  69. output_path = "benchmark-plots/"
  70. for engine_label in engine_counts:
  71. for thread_count in thread_counts:
  72. file = os.path.join(result_path, f"mtsubmit-{thread_count}-{engine_label}.json")
  73. process_file_to_dataset(file, engine_label, thread_count)
  74. df = pd.DataFrame(data)
  75. df.set_index(index, inplace=True)
  76. sns.barplot(x=x_label, y=y_label, hue=var_label, data=df, palette="rocket", errorbar="sd")
  77. plt.savefig(os.path.join(output_path, "plot-perf-mtsubmit.png"), bbox_inches='tight')
  78. plt.show()
  79. if __name__ == "__main__":
  80. main()