scripts: archive obsolete one-off shell/python scripts to legacy/ (D2, D3)
D2: run_benchmark.sh and run_experiments.sh still pass --time-scale and --max-inflight-sessions to the replayer, but those flags were removed when the project moved to trace-driven dispatch. The scripts cannot run as-is. D3: ~25 ad-hoc analyze_* / compare_* / profile_* / final_* scripts and a handful of single-experiment run_*.sh point at /home/admin/cpfs paths, deleted output directories, or a sampled trace file that no longer exists. Keep them in scripts/legacy/ for historical reference; the scripts that remain in scripts/ (analyze_trace, analyze_breakdown, analyze_cache_hit, analyze_eviction, compare_results, compute_roofline, sample_trace, analyze_agentic_patterns, simulate_cache_policies, plus launch_*.sh, gpu_monitor.sh, bench.sh) cover the current workflow. Adds scripts/legacy/README.md to document the archival policy.
This commit is contained in:
59
scripts/legacy/compare_p2p.py
Normal file
59
scripts/legacy/compare_p2p.py
Normal file
@@ -0,0 +1,59 @@
|
||||
"""Compare P2P offload vs baseline."""
|
||||
import json, csv, statistics, os
|
||||
|
||||
def lat(path):
|
||||
rows = [json.loads(l) for l in open(path)]
|
||||
ok = [r for r in rows if not r.get("error")]
|
||||
ttfts = sorted([r["ttft_s"] for r in ok if r.get("ttft_s")])
|
||||
tpots = sorted([r["tpot_s"] for r in ok if r.get("tpot_s") and r["tpot_s"]>0])
|
||||
lats = sorted([r["latency_s"] for r in ok])
|
||||
p = lambda v,q: v[min(int(q*len(v)),len(v)-1)] if v else 0
|
||||
return {"ok": len(ok), "n": len(rows),
|
||||
"t50": p(ttfts,.5), "t90": p(ttfts,.9),
|
||||
"p50": p(tpots,.5), "p90": p(tpots,.9),
|
||||
"e50": p(lats,.5)}
|
||||
|
||||
def gpu(path):
|
||||
if not os.path.exists(path): return 0
|
||||
rows = list(csv.DictReader(open(path)))
|
||||
vals = [float(r["util_pct"]) for r in rows]
|
||||
return statistics.fmean(vals) if vals else 0
|
||||
|
||||
print("P2P OFFLOAD vs BASELINE (both fresh restart, 200 req)")
|
||||
print("=" * 75)
|
||||
fmt = "%-30s %6s %8s %8s %8s %8s %8s %6s"
|
||||
print(fmt % ("Config","OK/N","TTFT50","TTFT90","TPOT50","TPOT90","E2E50","GPU%"))
|
||||
print("-" * 75)
|
||||
|
||||
configs = [
|
||||
("baseline_dash1", "Baseline (8 combined)"),
|
||||
("p2p_offload", "P2P offload (HEAVY on diff GPU)"),
|
||||
]
|
||||
|
||||
results = {}
|
||||
for d, label in configs:
|
||||
mp = "outputs/%s/metrics.jsonl" % d
|
||||
if not os.path.exists(mp):
|
||||
print(" %s: NOT FOUND" % mp)
|
||||
continue
|
||||
s = lat(mp)
|
||||
g = gpu("outputs/%s/gpu_util.csv" % d)
|
||||
results[d] = s
|
||||
print(fmt % (label, "%d/%d" % (s["ok"],s["n"]),
|
||||
"%.3f" % s["t50"], "%.3f" % s["t90"],
|
||||
"%.3f" % s["p50"], "%.3f" % s["p90"],
|
||||
"%.3f" % s["e50"], "%.1f" % g))
|
||||
|
||||
if "baseline_dash1" in results and "p2p_offload" in results:
|
||||
b = results["baseline_dash1"]
|
||||
a = results["p2p_offload"]
|
||||
print()
|
||||
print("DELTA (P2P vs Baseline):")
|
||||
for label, bv, av in [
|
||||
("TTFT p50", b["t50"], a["t50"]),
|
||||
("TTFT p90", b["t90"], a["t90"]),
|
||||
("TPOT p90", b["p90"], a["p90"]),
|
||||
("E2E p50", b["e50"], a["e50"]),
|
||||
]:
|
||||
d = (av/bv-1)*100 if bv > 0 else 0
|
||||
print(" %s: %.3f -> %.3f (%+.1f%%)" % (label, bv, av, d))
|
||||
Reference in New Issue
Block a user