Skip to content

Commit ab9b7b1

Browse files
committed
add overhead eval data analysis pipeline
1 parent 870ee60 commit ab9b7b1

3 files changed

Lines changed: 67 additions & 67 deletions

File tree

.github/workflows/bench-instr-e2e.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import argparse
2+
import pandas as pd
3+
import numpy as np
4+
5+
parser = argparse.ArgumentParser()
6+
parser.add_argument("--res_folder", type=str, required=True)
7+
args = parser.parse_args()
8+
9+
res_folder = args.res_folder
10+
11+
# only need to handle the marco benchmark results
12+
# list all the files in the folder
13+
files = $(ls @(res_folder)).split()
14+
files = [f for f in files if f.startswith("e2e_")]
15+
16+
"""
17+
FORMAT OF THE DATA TO PRODUCE FOR E2E
18+
19+
task,method,overhead
20+
MNIST,systrace,549.57
21+
ResNet18,systrace,338.43
22+
Transformer,systrace,205.34
23+
MNIST,monkey-patch,148.22
24+
ResNet18,monkey-patch,29.62
25+
Transformer,monkey-patch,63.12
26+
MNIST,selective,1.61
27+
ResNet18,selective,1.07
28+
Transformer,selective,1.17
29+
"""
30+
31+
all_results = {}
32+
for f in files:
33+
series = np.loadtxt(f"{res_folder}/{f}")
34+
task = f.split("_")[1]
35+
method = f.split("_")[2].split(".")[0]
36+
if task not in all_results:
37+
all_results[task] = {}
38+
all_results[task][method] = series.mean()
39+
40+
overhead_results = []
41+
for task in all_results:
42+
assert "naive" in all_results[task], f"naive (base situtation) not found in {task}"
43+
for method in all_results[task]:
44+
if method == "naive":
45+
continue
46+
overhead = all_results[task][method] / all_results[task]["naive"]
47+
overhead_results.append([task, method, overhead])
48+
49+
50+
df = pd.DataFrame(overhead_results, columns=["task", "method", "overhead"])
51+
# dump to csv
52+
df.to_csv(f"{res_folder}/overhead_e2e.csv", index=False)

eval_scripts/perf_benchmark/run_all.xsh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
import os
22
import subprocess
33

4+
import argparse
5+
6+
parser = argparse.ArgumentParser()
7+
parser.add_argument("--res_folder", type=str, required=False)
8+
args = parser.parse_args()
9+
410
# configs
511
$RAISE_SUBPROC_ERROR = True
612
os.environ["PYTHONUNBUFFERED"] = "1"
713

814
SELC_INV_FILE = "sampled_100_invariants.json"
9-
COMMIT = $(git rev-parse --short HEAD)
10-
RES_FOLDER = f"perf_eval_res_{COMMIT}"
15+
COMMIT = $(git rev-parse --short HEAD).strip()
16+
17+
if args.res_folder:
18+
RES_FOLDER = args.res_folder
19+
else:
20+
RES_FOLDER = f"perf_eval_res_{COMMIT}"
1121

1222
MICRO_FOLDER = "overhead-micro"
1323
E2E_FOLDER = "overhead-e2e"
@@ -59,20 +69,20 @@ def run_exp(kill_sec: int = 100, workload: str = "mnist"):
5969
print("Running settrace setup")
6070
run_cmd(cmd_settrace, kill_sec)
6171
rm api_calls.log
62-
cp iteration_times.txt @(f"../../{RES_FOLDER}/e2e_{workload}_settrace.txt")
72+
cp iteration_times.txt @(f"../../{RES_FOLDER}/e2e_{workload}_systrace.txt")
6373
rm iteration_times.txt
6474

6575
# 3. traincheck proxy instrumentation
6676
print("Running traincheck proxy instrumentation")
6777
run_cmd(CMD_TRAINCHECK, kill_sec)
68-
cp traincheck/iteration_times.txt @(f"../../{RES_FOLDER}/e2e_{workload}_traincheck.txt")
78+
cp traincheck/iteration_times.txt @(f"../../{RES_FOLDER}/e2e_{workload}_monkey-patch.txt")
6979
rm -rf traincheck
7080
# rm iteration_times.txt
7181

7282
# 4. traincheck selective instrumentation
7383
print("Running traincheck selective instrumentation")
7484
run_cmd(CMD_TRAINCHECK_SELECTIVE, kill_sec)
75-
cp traincheck-selective/iteration_times.txt @(f"../../{RES_FOLDER}/e2e_{workload}_traincheck_selective.txt")
85+
cp traincheck-selective/iteration_times.txt @(f"../../{RES_FOLDER}/e2e_{workload}_selective.txt")
7686
rm -rf traincheck-selective
7787

7888
cd ../..

0 commit comments

Comments
 (0)