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.
 
 
 
 
 
 

91 lines
3.1 KiB

import os
import json
import pandas as pd
from pandas.core.ops import methods
import seaborn as sns
import matplotlib.pyplot as plt
x_label = "Copy Type"
y_label = "Throughput in GiB/s"
var_label = "Configuration"
types = ["intersock-n0ton4", "internode-n0ton1"]
types_nice = ["Inter-Socket Copy", "Inter-Node Copy"]
copy_methods = ["dstcopy", "srccopy", "xcopy"]
copy_methods_nice = [ "Engine on DST-Node", "Engine on SRC-Node", "Cross-Copy / Both Engines" ]
title = "Performance of Engine Location - Copy Operation on DDR with Size 1 MiB"
data = {
x_label : types_nice,
copy_methods_nice[0] : [],
copy_methods_nice[1] : [],
copy_methods_nice[2] : []
}
def calc_throughput(size_bytes,time_microseconds):
time_seconds = time_microseconds * 1e-6
size_gib = size_bytes / (1024 ** 3)
throughput_gibs = size_gib / time_seconds
return throughput_gibs
def index_from_element(value,array):
for (idx,val) in enumerate(array):
if val == value: return idx
return 0
# Function to load and process the JSON file for the new benchmark
def load_and_process_copy_json(file_path, method_label):
with open(file_path, 'r') as file:
data = json.load(file)
# Extracting time from JSON structure
if method_label == "xcopy":
# For xcopy method, add times from two entries and divide by 4
time_entry1 = data["list"][0]["report"]["time"]["combined_avg"]
time_entry2 = data["list"][1]["report"]["time"]["combined_avg"]
time_microseconds = (time_entry1 + time_entry2) / 4
else:
# For other methods, use the time from the single entry
time_microseconds = data["list"][0]["report"]["time"]["combined_avg"]
return time_microseconds
# Function to plot the graph for the new benchmark
def plot_copy_graph(file_paths, method_label):
times = []
for file_path in file_paths:
# Load and process JSON file for the new benchmark
time_microseconds = load_and_process_copy_json(file_path, method_label)
times.append(time_microseconds)
method_index = index_from_element(method_label,copy_methods)
method_nice = copy_methods_nice[method_index]
throughput = [calc_throughput(1024*1024, t) for t in times]
data[method_nice] = throughput
# Main function to iterate over files and create plots for the new benchmark
def main():
folder_path = "benchmark-results/cross-copy-bench/" # Replace with the actual path to your folder
for method_label in copy_methods:
copy_file_paths = [os.path.join(folder_path, f"{method_label}-{type_label}-1mib-4e.json") for type_label in types]
plot_copy_graph(copy_file_paths, method_label)
df = pd.DataFrame(data)
dfm = pd.melt(df, id_vars=x_label, var_name=var_label, value_name=y_label)
sns.catplot(x=x_label, y=y_label, hue=var_label, data=dfm, kind='bar', height=5, aspect=1, palette="viridis")
plt.title(title)
plt.savefig(os.path.join(folder_path, "plot-perf-enginelocation.png"), bbox_inches='tight')
plt.show()
if __name__ == "__main__":
main()