#!/usr/bin/env python3 """Benchmark the exact exported owner plan at its four arrivals.""" from __future__ import annotations import subprocess from pathlib import Path ROOT = Path(__file__).resolve().parents[4] OWNER = ROOT / "Standalone/data/owner_world.json" BIN = ROOT / "Saved/Linux/l70/bin/VoxelForgeCoreHeadless-l70-clang" OUT = ROOT / "Saved/Linux/l70/headless-arrivals" SPAWNS_M = { 0: (8.0, 16.0, -372.2626953125), 1: (25.8369140625, 3.19921875, -737.0), 2: (19.166015625, -14.2001953125, -753.3740234375), 3: (-20.0625, -5.068359375, -900.353515625), } def main() -> int: if not BIN.is_file() or not OWNER.is_file(): raise SystemExit(f"missing headless binary or owner export: {BIN} {OWNER}") OUT.mkdir(parents=True, exist_ok=True) result_codes = [] for strate, spawn in SPAWNS_M.items(): camera = ",".join([*(f"{x:.9f}" for x in spawn), "0", "0"]) log = OUT / f"strate{strate}.log" command = [ str(BIN), str(OWNER), "--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline", "--force-generate", "--workers=12", "--clip-radius=3", "--max-clip-level=8", "--max-level=8", f"--camera={camera}", ] wrapped = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--", "timeout", "1740s", *command] with log.open("w", encoding="utf-8") as stream: result = subprocess.run(wrapped, cwd=ROOT, stdout=stream, stderr=subprocess.STDOUT, timeout=1740, check=False) result_codes.append(result.returncode) print(f"[L70HeadlessArrival] strate={strate} camera_m={camera} exit={result.returncode} log={log}", flush=True) return 0 if all(code == 0 for code in result_codes) else 2 if __name__ == "__main__": raise SystemExit(main())