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.

107 lines
3.9 KiB

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