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.

97 lines
3.3 KiB

  1. import os
  2. import json
  3. from numpy import float64, int64
  4. from typing import List
  5. import pandas as pd
  6. import seaborn as sns
  7. import matplotlib.pyplot as plt
  8. from common import calc_throughput, index_from_element, load_time_mesurements
  9. runid = "Run ID"
  10. x_label = "Size of Submitted Task"
  11. y_label = "Throughput in GiB/s"
  12. var_label = "Submission Type"
  13. sizes = ["1kib", "4kib", "1mib", "128mib"]
  14. sizes_nice = ["1 KiB", "4 KiB", "1 MiB", "128 MiB"]
  15. types = ["bs10", "bs50", "ssaw"]
  16. types_nice = ["Batch, Size 10", "Batch, Size 50", "Single Submit"]
  17. title = \
  18. """Throughput showing Optimal Submission Method and Size\n
  19. Copy Operation tested Intra-Node on DDR with 1 Engine per WQ"""
  20. description = \
  21. """Throughput showing Optimal Submission Method and Size\n
  22. Batch uses a Batch Descriptor of given Size\n
  23. Multi-Submit fills the Work Queue with n Single Descriptors\n
  24. Single-Submit submits one Descriptor and immediately waits\n
  25. Copy Operation tested Intra-Node on DDR with 1 Engine per WQ"""
  26. index = [runid, x_label, var_label]
  27. data = []
  28. # loads the measurements from a given file and processes them
  29. # so that they are normalized, meaning that the timings returned
  30. # are nanoseconds per element transfered
  31. def get_timing(file_path,type_label) -> List[float64]:
  32. divisor = 0
  33. if type_label == "bs10": divisor = 10
  34. elif type_label == "bs50" : divisor = 50
  35. else: divisor = 1
  36. return [ x / divisor for x in load_time_mesurements(file_path)]
  37. # procceses a single file and appends the desired timings
  38. # to the global data-array, handles multiple runs with a runid
  39. # and ignores if the given file is not found as some
  40. # configurations may not be benchmarked
  41. def process_file_to_dataset(file_path, type_label,size_label):
  42. type_index = index_from_element(type_label,types)
  43. type_nice = types_nice[type_index]
  44. size_index = index_from_element(size_label, sizes)
  45. size_nice = sizes_nice[size_index]
  46. data_size = 0
  47. if size_label == "1kib": data_size = 1024;
  48. elif size_label == "4kib": data_size = 4 * 1024;
  49. elif size_label == "1mib": data_size = 1024 * 1024;
  50. elif size_label == "32mib": data_size = 32 * 1024 * 1024;
  51. elif size_label == "1gib": data_size = 1024 * 1024 * 1024;
  52. else: data_size = 0
  53. try:
  54. time = get_timing(file_path,type_label)
  55. run_idx = 0
  56. for t in time:
  57. data.append({ runid : run_idx, x_label: size_nice, var_label : type_nice, y_label : calc_throughput(data_size, t)})
  58. run_idx = run_idx + 1
  59. except FileNotFoundError:
  60. return
  61. # loops over all possible configuration combinations and calls
  62. # process_file_to_dataset for them in order to build a dataframe
  63. # which is then displayed and saved
  64. def main():
  65. result_path = "benchmark-results/"
  66. output_path = "benchmark-plots/"
  67. for type_label in types:
  68. for size in sizes:
  69. file = os.path.join(result_path, f"submit-{type_label}-{size}-1e.json")
  70. process_file_to_dataset(file, type_label, size)
  71. df = pd.DataFrame(data)
  72. df.set_index(index, inplace=True)
  73. df = df.sort_values(y_label)
  74. sns.barplot(x=x_label, y=y_label, hue=var_label, data=df, palette="rocket", errorbar="sd")
  75. plt.savefig(os.path.join(output_path, "plot-opt-submitmethod.pdf"), bbox_inches='tight')
  76. plt.show()
  77. if __name__ == "__main__":
  78. main()