diff --git a/scripts/dist-exps/e2e_bfs-pull_test/adj/1/bfs-pull-0_0.out b/scripts/dist-exps/e2e_bfs-pull_test/adj/1/bfs-pull-0_0.out new file mode 100644 index 0000000..16f150e --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/adj/1/bfs-pull-0_0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 3317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/adj/1/bfs-pull-0_1.out b/scripts/dist-exps/e2e_bfs-pull_test/adj/1/bfs-pull-0_1.out new file mode 100644 index 0000000..87b11d5 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/adj/1/bfs-pull-0_1.out @@ -0,0 +1,8 @@ +Benchmark results for bfs-pull: +Duration: 3297970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/adj/1/bfs-pull-0_2.out b/scripts/dist-exps/e2e_bfs-pull_test/adj/1/bfs-pull-0_2.out new file mode 100644 index 0000000..3980cf6 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/adj/1/bfs-pull-0_2.out @@ -0,0 +1,8 @@ +Benchmark results for bfs-pull: +Duration: 3342929 nanoseconds +Max RSS: 243780 KB +Cache Misses: 232 +Cache References: 55329 +Instructions: 12527067 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/adj/1/total_e2e.out b/scripts/dist-exps/e2e_bfs-pull_test/adj/1/total_e2e.out new file mode 100644 index 0000000..796506a --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/adj/1/total_e2e.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 5317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/adj/2/total_e2e.out b/scripts/dist-exps/e2e_bfs-pull_test/adj/2/total_e2e.out new file mode 100644 index 0000000..16f150e --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/adj/2/total_e2e.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 3317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/adj/4/total_e2e.out b/scripts/dist-exps/e2e_bfs-pull_test/adj/4/total_e2e.out new file mode 100644 index 0000000..77495ab --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/adj/4/total_e2e.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 817062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/bfs-pull-0_0.out b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/bfs-pull-0_0.out new file mode 100644 index 0000000..16f150e --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/bfs-pull-0_0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 3317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/bfs-pull-0_1.out b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/bfs-pull-0_1.out new file mode 100644 index 0000000..87b11d5 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/bfs-pull-0_1.out @@ -0,0 +1,8 @@ +Benchmark results for bfs-pull: +Duration: 3297970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/bfs-pull-0_2.out b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/bfs-pull-0_2.out new file mode 100644 index 0000000..3980cf6 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/bfs-pull-0_2.out @@ -0,0 +1,8 @@ +Benchmark results for bfs-pull: +Duration: 3342929 nanoseconds +Max RSS: 243780 KB +Cache Misses: 232 +Cache References: 55329 +Instructions: 12527067 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/total_e2e.out b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/total_e2e.out new file mode 100644 index 0000000..8974a76 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/1/total_e2e.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 4317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lccsr/2/total_e2e.out b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/2/total_e2e.out new file mode 100644 index 0000000..3da0158 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/2/total_e2e.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 2317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lccsr/4/total_e2e.out b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/4/total_e2e.out new file mode 100644 index 0000000..8d80072 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lccsr/4/total_e2e.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 717062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/bfs-pull-0_0.out b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/bfs-pull-0_0.out new file mode 100644 index 0000000..16f150e --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/bfs-pull-0_0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 3317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/bfs-pull-0_1.out b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/bfs-pull-0_1.out new file mode 100644 index 0000000..87b11d5 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/bfs-pull-0_1.out @@ -0,0 +1,8 @@ +Benchmark results for bfs-pull: +Duration: 3297970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/bfs-pull-0_2.out b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/bfs-pull-0_2.out new file mode 100644 index 0000000..3980cf6 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/bfs-pull-0_2.out @@ -0,0 +1,8 @@ +Benchmark results for bfs-pull: +Duration: 3342929 nanoseconds +Max RSS: 243780 KB +Cache Misses: 232 +Cache References: 55329 +Instructions: 12527067 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/total_e2e.out b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/total_e2e.out new file mode 100644 index 0000000..16f150e --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/1/total_e2e.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 3317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lscsr/2/total_e2e.out b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/2/total_e2e.out new file mode 100644 index 0000000..1f23c07 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/2/total_e2e.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/e2e_bfs-pull_test/lscsr/4/total_e2e.out b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/4/total_e2e.out new file mode 100644 index 0000000..23af520 --- /dev/null +++ b/scripts/dist-exps/e2e_bfs-pull_test/lscsr/4/total_e2e.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 617062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/perhost_partitioning_csv.py b/scripts/dist-exps/perhost_partitioning_csv.py new file mode 100644 index 0000000..9ad4e52 --- /dev/null +++ b/scripts/dist-exps/perhost_partitioning_csv.py @@ -0,0 +1,127 @@ +# SPDX-License-Identifier: BSD-2-Clause +# Copyright (c) 2023. University of Texas at Austin. All rights reserved. + +import subprocess +import re +import matplotlib.pyplot as plt +import numpy as np +import csv +import argparse +import os + + +def parse(log_path: str, algo: str): + print(f"Export {log_path} on {algo} to csv..") + command = f"cat {log_path}" + + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + stdout, stderr = process.communicate() + + output = stdout.decode() + + # Parse batch number and duration + ingestion_pattern = re.compile(rf"Benchmark {algo} ingestion results for batch (\d+):.*?Duration: (\d+) nanoseconds", re.DOTALL) + algorithm_pattern = re.compile(rf"Benchmark {algo} algorithm results for batch (\d+):.*?Duration: (\d+) nanoseconds", re.DOTALL) + + ingestion_durations = {} + algorithm_durations = {} + + ingestion_matches = re.findall(ingestion_pattern, output) + algorithm_matches = re.findall(algorithm_pattern, output) + + for batch, duration in ingestion_matches: + ingestion_durations[int(batch)] = int(duration) / 1000000 + + for batch, duration in algorithm_matches: + algorithm_durations[int(batch)] = int(duration) / 1000000 + + print(">> ingestion_durations:", ingestion_durations) + print(">> algorithm_durations:", algorithm_durations) + + return ingestion_durations, algorithm_durations + +def save_policy_to_csv(results, filepath): + with open(filepath, 'w', newline='') as csvfile: + fieldnames = ['Policy', 'Hosts', 'HostID', 'Ingestion_Duration', 'Algorithm_Duration'] + writer = csv.DictWriter(csvfile, fieldnames=fieldnames) + + writer.writeheader() + print("results:", results) + for policy in results.keys(): + for hosts in results[policy].keys(): + for host_id in range(int(hosts)): + data = results[policy][hosts][host_id] + ingestion_duration = data['ingestion'][0] if data['ingestion'] != {} else 0 + algorithm_duration = data['algorithm'][0] if data['algorithm'] != {} else 0 + print("ing:", ingestion_duration, " algo:", algorithm_duration) + writer.writerow({ + 'Policy': policy, + 'Hosts': hosts, + 'HostID': str(host_id), + 'Ingestion_Duration': ingestion_duration, + 'Algorithm_Duration': algorithm_duration + }) + +def main(): + """ + This script expects the following directory structure. + + [app_name]_[input_graph] + |_ [partitioning_policy1] + | |_ [num_hosts0] + | | |_ [host_0].out + | | |_ [host_1].out + | | ... + | | |_ [host_[num_hosts0-1]].out + | | + | |_ [num_hosts1] + | + |_ [partitioning_policy2] + ... + """ + parser = argparse.ArgumentParser(description='Run and plot benchmark results based on command line flags.') + # parser.add_argument('--ingest', action='store_true', help='Plot ingestion durations.') + parser.add_argument('--output', type=str, help='Output file path to plot.', default=None) + + args = parser.parse_args() + + output_path = args.output + if not output_path: + print("No output file path provided. Use --output.") + return + + # The output_path's last directory name format is [algo]_[input_graph] + fname = os.path.basename(os.path.normpath(output_path)) + fname_split = fname.split('_') + assert fname_split[0] == "ppolicy", " Output directory's prefix should be 'ppolicy'" + algo_name = fname_split[1] + input_name = fname_split[2] + + print("algo name:", algo_name, "input name: ", input_name) + perhost_comp_results = {} + for ppolicy in os.listdir(output_path): + perhost_comp_results[ppolicy] = {} + for hosts in os.listdir(output_path+"/"+ppolicy): + + perhost_comp_results[ppolicy][hosts] = {} + + # We have interest on e2e execution time per-host or/and all execution. + # The e2e execution file names are total_e2e.out and host[host number]_e2e.out. + # We do not parse per-batch results. + + for host_id in range(int(hosts)): + perhost_fname = f"{str(host_id)}.out" + log_path = output_path+"/"+ppolicy+"/"+hosts+"/"+perhost_fname + print("host_id:", host_id, " log path:", log_path) + ingestion_durations, algorithm_durations = parse(log_path, algo_name) + perhost_comp_results[ppolicy][hosts][host_id] = { + 'ingestion': ingestion_durations, + 'algorithm': algorithm_durations, + } + + print(perhost_comp_results) + save_policy_to_csv(perhost_comp_results, f"ppolicy_{algo_name}_{input_name}.csv") + + +if __name__ == "__main__": + main() diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/1/0.out b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/1/0.out new file mode 100644 index 0000000..16f150e --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/1/0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 3317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/2/0.out b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/2/0.out new file mode 100644 index 0000000..3da0158 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/2/0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 2317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/2/1.out b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/2/1.out new file mode 100644 index 0000000..f29a7a5 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/2/1.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 2297970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/0.out b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/0.out new file mode 100644 index 0000000..1f23c07 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/1.out b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/1.out new file mode 100644 index 0000000..f548f92 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/1.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1297970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/2.out b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/2.out new file mode 100644 index 0000000..f548f92 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/2.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1297970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/3.out b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/3.out new file mode 100644 index 0000000..f548f92 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/cvc/4/3.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1297970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/divija/1/0.out b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/1/0.out new file mode 100644 index 0000000..52d88a4 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/1/0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 5417062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/divija/2/0.out b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/2/0.out new file mode 100644 index 0000000..b2bd833 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/2/0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 4417062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/divija/2/1.out b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/2/1.out new file mode 100644 index 0000000..67285fc --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/2/1.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 4397970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/0.out b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/0.out new file mode 100644 index 0000000..989a2b7 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1417062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/1.out b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/1.out new file mode 100644 index 0000000..fdb53f4 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/1.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1397970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/2.out b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/2.out new file mode 100644 index 0000000..3a8733c --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/2.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1497970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/3.out b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/3.out new file mode 100644 index 0000000..706d17e --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/divija/4/3.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1997970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/oec/1/0.out b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/1/0.out new file mode 100644 index 0000000..16f150e --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/1/0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 3317062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/oec/2/0.out b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/2/0.out new file mode 100644 index 0000000..91f040e --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/2/0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 2017062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/oec/2/1.out b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/2/1.out new file mode 100644 index 0000000..eaead0b --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/2/1.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 2097970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/0.out b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/0.out new file mode 100644 index 0000000..a1f764b --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/0.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1017062 nanoseconds +Max RSS: 243780 KB +Cache Misses: 947 +Cache References: 57356 +Instructions: 12526376 +Minor Page Faults: 3 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/1.out b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/1.out new file mode 100644 index 0000000..c86fb47 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/1.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1097970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/2.out b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/2.out new file mode 100644 index 0000000..c86fb47 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/2.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1097970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/3.out b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/3.out new file mode 100644 index 0000000..c86fb47 --- /dev/null +++ b/scripts/dist-exps/ppolicy_bfs-pull_test/oec/4/3.out @@ -0,0 +1,8 @@ +Benchmark bfs-pull algorithm results for batch 0: +Duration: 1097970 nanoseconds +Max RSS: 243780 KB +Cache Misses: 316 +Cache References: 55377 +Instructions: 12524946 +Minor Page Faults: 0 +Major Page Faults: 0 diff --git a/scripts/dist-exps/ppolicy_plot.R b/scripts/dist-exps/ppolicy_plot.R new file mode 100644 index 0000000..3f7388c --- /dev/null +++ b/scripts/dist-exps/ppolicy_plot.R @@ -0,0 +1,46 @@ +library("optparse") +library("data.table") +library(dplyr) +library(ggplot2) +library(Rmisc) +library(RColorBrewer) +library(ggh4x) + +args=commandArgs(trailingOnly=TRUE) + +data_summary <- function(data, varname, groupnames) { + require(plyr) + summary_func <- function(x, col) { + c(mean = mean(x[[col]], na.rm=TRUE), sd = sd(x[[col]], na.rm=TRUE)) + } + data_sum <- ddply(data, groupnames, .fun=summary_func, varname) + data_sum <- rename(data_sum, c("mean" = varname)) + return (data_sum) +} + +num_hosts <- args[1] +data <- read.csv(args[2], header=T, fileEncoding="UTF-8-BOM") +data <- data %>% filter(data$Hosts == num_hosts) +data <- data_summary(data, varname="Algorithm_Duration", groupnames=c("Policy", "Hosts", "HostID")) +data$Policy <- factor(data$Policy, levels=c("oec", "divija", "cvc")) + +time_plot <- ggplot(data=data, aes(x=factor(Policy), fill=factor(HostID), y=Algorithm_Duration +)) + + geom_bar(mapping=aes(x=factor(Policy), fill=factor(HostID), y=Algorithm_Duration), + position=position_dodge(), stat="identity") + + labs(fill="Number of Hosts", y="Total Computation Time (s)", x="Graph Partitioning Policies")+ + theme(axis.title = element_text(color="black", size=20), + axis.text.y = element_text(color="black", size=20), + axis.text.x = element_text(color="black", size=20, angle=90), + axis.title.y = element_text(margin=margin(t=0, r=0, l=20, b=0), size=20), + axis.title.x = element_text(margin=margin(t=20, r=0, l=0, b=0), size=20)) + + #scale_fill_manual(values = c("oec"="#FF6600", "divija"="66", "cvc"="blue")) + + geom_text(aes(label=sprintf("%1.2f", Algorithm_Duration)), + position=position_dodge(1), vjust=0) + + #theme_minimal() + + geom_errorbar(aes(ymin=Algorithm_Duration + -sd, ymax=Algorithm_Duration + +sd), width=.2, position=position_dodge(.9)) + +ggsave(args[3], height=6, width=6) + diff --git a/scripts/dist-exps/sample_perhost_bfs-pull_test.pdf b/scripts/dist-exps/sample_perhost_bfs-pull_test.pdf new file mode 100644 index 0000000..ef376b7 Binary files /dev/null and b/scripts/dist-exps/sample_perhost_bfs-pull_test.pdf differ diff --git a/scripts/dist-exps/sample_totale2e_bfs-pull_test.pdf b/scripts/dist-exps/sample_totale2e_bfs-pull_test.pdf new file mode 100644 index 0000000..f044d00 Binary files /dev/null and b/scripts/dist-exps/sample_totale2e_bfs-pull_test.pdf differ diff --git a/scripts/dist-exps/test_plot.sh b/scripts/dist-exps/test_plot.sh new file mode 100644 index 0000000..a387916 --- /dev/null +++ b/scripts/dist-exps/test_plot.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +E2E_OUTPUT_DIR=$1 +PPOLICY_OUTPUT_DIR=$2 + +python total_e2e_csv.py --output $E2E_OUTPUT_DIR +Rscript totale2e_plot.R totale2e_bfs-pull_test.csv sample_totale2e_bfs-pull_test.pdf + +python perhost_partitioning_csv.py --output $PPOLICY_OUTPUT_DIR +Rscript ppolicy_plot.R 4 ppolicy_bfs-pull_test.csv sample_perhost_bfs-pull_test.pdf diff --git a/scripts/dist-exps/total_e2e_csv.py b/scripts/dist-exps/total_e2e_csv.py new file mode 100644 index 0000000..d32a451 --- /dev/null +++ b/scripts/dist-exps/total_e2e_csv.py @@ -0,0 +1,118 @@ +# SPDX-License-Identifier: BSD-2-Clause +# Copyright (c) 2023. University of Texas at Austin. All rights reserved. + +import subprocess +import re +import matplotlib.pyplot as plt +import numpy as np +import csv +import argparse +import os + + +def parse(log_path: str, algo: str): + print(f"Export {log_path} on {algo} to csv..") + command = f"cat {log_path}" + + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + stdout, stderr = process.communicate() + + output = stdout.decode() + + # Parse batch number and duration + ingestion_pattern = re.compile(rf"Benchmark {algo} ingestion results for batch (\d+):.*?Duration: (\d+) nanoseconds", re.DOTALL) + algorithm_pattern = re.compile(rf"Benchmark {algo} algorithm results for batch (\d+):.*?Duration: (\d+) nanoseconds", re.DOTALL) + + ingestion_durations = {} + algorithm_durations = {} + + ingestion_matches = re.findall(ingestion_pattern, output) + algorithm_matches = re.findall(algorithm_pattern, output) + + for batch, duration in ingestion_matches: + ingestion_durations[int(batch)] = int(duration) / 1000000 + + for batch, duration in algorithm_matches: + algorithm_durations[int(batch)] = int(duration) / 1000000 + + # print(">> ingestion_durations:", ingestion_durations) + # print(">> algorithm_durations:", algorithm_durations) + + return ingestion_durations, algorithm_durations + +def save_totale2e_to_csv(results, filepath): + with open(filepath, 'w', newline='') as csvfile: + fieldnames = ['Graph_Type', 'Hosts', 'Ingestion_Duration', 'Algorithm_Duration'] + writer = csv.DictWriter(csvfile, fieldnames=fieldnames) + + writer.writeheader() + print("results:", results) + for graph_type in results.keys(): + for hosts in results[graph_type].keys(): + data = results[graph_type][hosts] + ingestion_duration = data['ingestion'][0] if data['ingestion'] != {} else 0 + algorithm_duration = data['algorithm'][0] if data['algorithm'] != {} else 0 + print("ing:", ingestion_duration, " algo:", algorithm_duration) + writer.writerow({ + 'Graph_Type': graph_type, + 'Hosts': hosts, + 'Ingestion_Duration': ingestion_duration, + 'Algorithm_Duration': algorithm_duration + }) + +def main(): + """ + This script expects the following directory structure. + + e2e_[app_name]_[input_graph] + |_ [graph_type1] + | |_ [num_hosts0] + | | |_ total_e2e.out + | | + | |_ [num_hosts1] + | |_ total_e2e.out + | + |_ [graph_type2] + ... + """ + parser = argparse.ArgumentParser(description='Run and plot benchmark results based on command line flags.') + # parser.add_argument('--ingest', action='store_true', help='Plot ingestion durations.') + parser.add_argument('--output', type=str, help='Output file path to plot.', default=None) + + args = parser.parse_args() + + output_path = args.output + if not output_path: + print("No output file path provided. Use --output.") + return + + # The output_path's last directory name format is [algo]_[input_graph] + fname = os.path.basename(os.path.normpath(output_path)) + fname_split = fname.split('_') + assert fname_split[0] == "e2e", " Output directory's prefix should be 'e2e'" + algo_name = fname_split[1] + input_name = fname_split[2] + + total_e2e_results = {} + for graph in os.listdir(output_path): + total_e2e_results[graph] = {} + for hosts in os.listdir(output_path+"/"+graph): + total_e2e_results[graph][hosts] = {} + + # We have interest on e2e execution time per-host or/and all execution. + # The e2e execution file names are total_e2e.out and host[host number]_e2e.out. + # We do not parse per-batch results. + + total_e2e_fname = "total_e2e.out" + log_path = output_path+"/"+graph+"/"+hosts+"/"+total_e2e_fname + ingestion_durations, algorithm_durations = parse(log_path, algo_name) + total_e2e_results[graph][hosts] = { + 'ingestion': ingestion_durations, + 'algorithm': algorithm_durations + } + + save_totale2e_to_csv(total_e2e_results, f"totale2e_{algo_name}_{input_name}.csv") + + +if __name__ == "__main__": + main() diff --git a/scripts/dist-exps/totale2e_plot.R b/scripts/dist-exps/totale2e_plot.R new file mode 100644 index 0000000..133dccd --- /dev/null +++ b/scripts/dist-exps/totale2e_plot.R @@ -0,0 +1,43 @@ +library("optparse") +library("data.table") +library(dplyr) +library(ggplot2) +library(Rmisc) +library(RColorBrewer) +library(ggh4x) + +args=commandArgs(trailingOnly=TRUE) + +data_summary <- function(data, varname, groupnames) { + require(plyr) + summary_func <- function(x, col) { + c(mean = mean(x[[col]], na.rm=TRUE), sd = sd(x[[col]], na.rm=TRUE)) + } + data_sum <- ddply(data, groupnames, .fun=summary_func, varname) + data_sum <- rename(data_sum, c("mean" = varname)) + return (data_sum) +} + +data <- read.csv(args[1], header=T, fileEncoding="UTF-8-BOM") +data <- data_summary(data, varname="Algorithm_Duration", groupnames=c("Graph_Type", "Hosts")) +data$Graph_Type <- factor(data$Graph_Type, levels=c("adj", "lccsr", "lscsr")) + +time_plot <- ggplot(data=data, aes(x=factor(Hosts), fill=factor(Graph_Type), y=Algorithm_Duration +)) + + geom_bar(mapping=aes(x=factor(Hosts), fill=factor(Graph_Type), y=Algorithm_Duration), + position=position_dodge(), stat="identity") + + labs(fill="Graph Type", y="End-To-End Execution time (s)", x="Number of Hosts")+ + theme(axis.title = element_text(color="black", size=20), + axis.text.y = element_text(color="black", size=20), + axis.text.x = element_text(color="black", size=20), + axis.title.y = element_text(margin=margin(t=0, r=0, l=20, b=0), size=20), + axis.title.x = element_text(margin=margin(t=20, r=0, l=0, b=0), size=20)) + + scale_fill_manual(values = c("adj"="#FF6600", "lccsr"="66", "lscsr"="blue")) + + geom_text(aes(label=sprintf("%1.2f", Algorithm_Duration)), + position=position_dodge(1), vjust=0) + + #theme_minimal() + + geom_errorbar(aes(ymin=Algorithm_Duration + -sd, ymax=Algorithm_Duration + +sd), width=.2, position=position_dodge(.9)) + +ggsave(args[2], height=6, width=10)