#!/usr/bin/env python3 """Verify speed-only L30 hashes on the 24 m crossing against L29.""" import re import subprocess import time from pathlib import Path ROOT = Path(__file__).resolve().parents[4] OUT = ROOT / "Saved/Linux/l30" OUT.mkdir(parents=True, exist_ok=True) BINARIES = { "clang": ROOT / "Saved/Linux/l30/bin/VoxelForgeCoreHeadless-linux30-speed-fade", "gcc": ROOT / "Saved/Linux/l30/bin/VoxelForgeCoreHeadless-linux30-speed-fade-gcc", } PATTERN = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M) passed = True for compiler, binary in BINARIES.items(): for recipe in ("surface-world", "floating-islands"): reference_path = ROOT / f"Saved/Linux/linux29-final-crossing24-{compiler}-{recipe}.log" reference = PATTERN.findall(reference_path.read_text(encoding="utf-8")) for workers in (1, 8, 12): name = f"crossing-speedonly-default-{compiler}-{recipe}-w{workers}" logfile = OUT / f"{name}.log" command = [ "prlimit", "--as=6442450944", "--", str(binary), str(ROOT / "Standalone/data/owner_world.json"), "--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline", "--stream-hash", "--force-generate", "--clip-radius=3", "--max-clip-level=8", f"--workers={workers}", "--camera-step=24,0,0", "--region-crossing", f"--recipe={recipe}", ] started = time.monotonic() with logfile.open("w", encoding="utf-8") as stream: subprocess.run(command, stdout=stream, stderr=subprocess.STDOUT, check=True, timeout=1800) elapsed = time.monotonic() - started rows = PATTERN.findall(logfile.read_text(encoding="utf-8", errors="replace")) ok = len(reference) == 12 and rows == reference passed &= ok print(f"{compiler} {recipe} W{workers} elapsed={elapsed:.3f}s " f"hash_rows={len(rows)} {'MATCH' if ok else 'MISMATCH'}", flush=True) print(f"[CrossingSpeedOnly] runs=12 status={'PASS' if passed else 'FAIL'}", flush=True) raise SystemExit(0 if passed else 1)