|
|
import os import json import pandas as pd from pandas.core.ops import methods from typing import List import seaborn as sns import matplotlib.pyplot as plt
runid = "Run ID" x_label = "Destination Node" y_label = "Source Node" v_label = "Throughput" title = "Copy Throughput for 1GiB Elements running on SRC Node"
data = []
def mean_without_outliers(x): return x.sort_values()[2:-2].mean()
def calc_throughput(size_bytes,time_ns): time_seconds = time_ns * 1e-9 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
def load_time_mesurements(file_path): with open(file_path, 'r') as file: data = json.load(file) iterations = data["list"][0]["task"]["iterations"]
return { "total": data["list"][0]["report"]["total"] / iterations, "combined": data["list"][0]["report"]["combined"], "submission": data["list"][0]["report"]["submission"], "completion": data["list"][0]["report"]["completion"] }
def process_file_to_dataset(file_path, src_node, dst_node): data_size = 1024*1024*1024
try: time = load_time_mesurements(file_path)["total"] run_idx = 0 for t in time: data.append({ runid : run_idx, x_label : dst_node, y_label : src_node, v_label: calc_throughput(data_size, t)}) run_idx = run_idx + 1 except FileNotFoundError: return
def main(): folder_path = "benchmark-results/"
for src_node in range(16): for dst_node in range(16): file = os.path .join(folder_path, f"copy-n{src_node}ton{dst_node}-1gib-1e.json") process_file_to_dataset(file, src_node, dst_node)
df = pd.DataFrame(data) data_pivot = df.pivot_table(index=y_label, columns=x_label, values=v_label, aggfunc=mean_without_outliers)
sns.heatmap(data_pivot, annot=True, palette="rocket", fmt=".0f")
plt.title(title) plt.savefig(os.path.join(folder_path, "plot-perf-peakthroughput.png"), bbox_inches='tight') plt.show()
if __name__ == "__main__": main()
|