Exact through LOD2 (all near tile hashes equal L82). W8 LOD0-2: SW 1.09->1.06, FI 2.47->2.34, TN 2.39->2.43 (noise), VS 1.20->1.18 s. Fast tier PASS. Scaling W4/W8/W12/W16 (LOD0-2, FI): 3.59 / 2.48 / 2.33 / 2.34 s - flattens past W8-W12. Estimated infinite-worker floor ~1.0 s FI/TN = shape compile (0.35-0.41 s, not overlapped: no shape-free tiles in these views) + slowest single LOD0 tile service (0.51-0.59 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
79 lines
3.4 KiB
Python
79 lines
3.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Run three L77 sampler censuses per passage-heavy stratum."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
OUT = ROOT / "Saved/Linux/l83/census"
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
POST = len(sys.argv) > 1 and sys.argv[1] == "--post"
|
|
BINARY = (ROOT / "Saved/Linux/l83/profile-bin/VoxelForgeCoreHeadless-l83-profile-clang19"
|
|
if POST else ROOT / "Saved/Linux/l82/profile-bin/VoxelForgeCoreHeadless-clang19")
|
|
LABEL = "post" if POST else "pre"
|
|
CAMERAS = {
|
|
"FI": (25.8369140625, 3.19921875, -737.0),
|
|
"TN": (19.166015625, -14.2001953125, -753.3740234375),
|
|
}
|
|
SAMPLE = re.compile(r"^\[L77Sample\] pc=(0x\w+) lod=(\d+) .*?phase=(\S+) .*?weight=(\d+)$", re.M)
|
|
SAMPLER = re.compile(r"^\[L77Sampler\] action=stop .*?samples=(\d+).*?status=PASS$", re.M)
|
|
|
|
|
|
def run(world: str, rep: int) -> dict:
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
log = OUT / f"{LABEL}-{world.lower()}-r{rep}.log"
|
|
camera = ",".join(f"{value:.12f}" for value in CAMERAS[world]) + ",0,0"
|
|
command = [
|
|
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
|
"env", "VOXELFORGE_L81_PASSAGE_BOUND_PADDING_VOXELS=0", "timeout", "1740s",
|
|
str(BINARY), str(DATA), "--world-assembler-prototype", "--stream-benchmark",
|
|
"--stream-pipeline", "--workers=8", "--clip-radius=3", "--max-clip-level=8",
|
|
"--max-level=8", f"--camera={camera}", "--profile-lod-work", "--linux77-profile",
|
|
]
|
|
start = time.monotonic()
|
|
with log.open("w", encoding="utf-8") as stream:
|
|
result = subprocess.run(command, cwd=ROOT, stdout=stream,
|
|
stderr=subprocess.STDOUT, check=False, timeout=1740)
|
|
output = log.read_text(encoding="utf-8", errors="replace")
|
|
samples = [(int(lod), phase, int(weight))
|
|
for _pc, lod, phase, weight in SAMPLE.findall(output)]
|
|
sampler = SAMPLER.search(output)
|
|
if result.returncode or not samples or sampler is None:
|
|
raise RuntimeError(f"census failed: exit={result.returncode} {log}")
|
|
near = [row for row in samples if row[0] <= 2]
|
|
passage = sum(weight for _, phase, weight in near if phase == "passages")
|
|
total = sum(weight for _, _, weight in near)
|
|
row = {
|
|
"world": world, "replicate": rep, "exit_code": result.returncode,
|
|
"wall_s": round(time.monotonic() - start, 3),
|
|
"sampler_samples": int(sampler.group(1)), "near_lod_samples": len(near),
|
|
"near_lod_weighted_ticks": total, "near_lod_passage_weighted_ticks": passage,
|
|
"near_lod_passage_share_pct": 100.0 * passage / total,
|
|
"log": str(log.relative_to(ROOT)),
|
|
}
|
|
print("[L83CensusRun] " + json.dumps(row, sort_keys=True), flush=True)
|
|
return row
|
|
|
|
|
|
def main() -> int:
|
|
if not BINARY.is_file() or not DATA.is_file():
|
|
raise SystemExit(f"missing input: {BINARY} or {DATA}")
|
|
rows = [run(world, rep) for rep in (1, 2, 3) for world in CAMERAS]
|
|
by_world = {}
|
|
for world in CAMERAS:
|
|
values = [row["near_lod_passage_share_pct"] for row in rows if row["world"] == world]
|
|
by_world[world] = {"runs_pct": values, "mean_pct": sum(values) / len(values)}
|
|
(OUT / f"{LABEL}-summary.json").write_text(json.dumps(
|
|
{"runs": rows, "near_lod_passage_share": by_world}, indent=2) + "\n",
|
|
encoding="utf-8")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|