Reach = 0.75 shell + 0.21 relief + 0.50/6 smooth-max support + 0.01 = 1.0533 m, used by proof, feature, fallback, off-grid bounds and the sweep cutoff. Removes the dead 4 m term (v225 added metres to core-voxel coordinates). Captures and mouth close-ups byte-identical; proof audit 0 misses over 25,728 shell/crest samples; floor 7.884 mm; seams, walkability, fast tier, Clang/GCC W1/W8/W12 green; timing equal within noise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
138 lines
6.3 KiB
Python
138 lines
6.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Five interleaved L80 near-ready runs per stratum/worker vs b96dd73."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import re
|
|
import statistics
|
|
import subprocess
|
|
import time
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
OUT = ROOT / "Saved/Linux/l130/timing"
|
|
PASS_ID = int(os.environ.get("VOXELFORGE_L130_TIMING_PASS", "1"))
|
|
REPLICATE_FIRST = (PASS_ID - 1) * 5 + 1
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
BINARIES = {
|
|
"b96dd73": ROOT / "Saved/Linux/l125/bin/VoxelForgeCoreHeadless-l125-clang",
|
|
"L130": ROOT / "Saved/Linux/l130/bin/VoxelForgeCoreHeadless-l130-clang",
|
|
}
|
|
CAMERAS = {
|
|
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),
|
|
}
|
|
PIPELINE_RE = re.compile(r"^\[StreamPipeline\] (.*)$", re.M)
|
|
FIELDS_RE = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
|
|
NEAR_RE = re.compile(
|
|
r"^\[WorldAssemblerNearLODReady\] lods=0-2 tiles=(\d+)/(\d+) cold_ready_s=([0-9.]+)$",
|
|
re.M)
|
|
|
|
|
|
def run(strate: int, workers: int, version: str, phase: str, replicate: int) -> dict:
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
pass_suffix = "" if PASS_ID == 1 else f"-p{PASS_ID}"
|
|
label = f"s{strate}-w{workers}-{version}-{phase}{replicate}-l130-v227{pass_suffix}"
|
|
log = OUT / f"{label}.log"
|
|
camera = ",".join(f"{value:.12f}" for value in CAMERAS[strate]) + ",0,0"
|
|
command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
|
"timeout", "1740s", str(BINARIES[version]), str(DATA),
|
|
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
|
|
f"--workers={workers}", "--clip-radius=3", "--max-clip-level=8",
|
|
"--max-level=8", f"--camera={camera}", "--profile-lod-work",
|
|
"--stream-scheduler-policy=3"]
|
|
started = time.monotonic()
|
|
with log.open("w", encoding="utf-8") as output:
|
|
result = subprocess.run(command, cwd=ROOT, stdout=output,
|
|
stderr=subprocess.STDOUT, check=False, timeout=1740)
|
|
content = log.read_text(encoding="utf-8", errors="replace")
|
|
pipeline, near = PIPELINE_RE.search(content), NEAR_RE.search(content)
|
|
if result.returncode or pipeline is None or near is None:
|
|
raise SystemExit(f"timing run failed: {log}; exit={result.returncode}")
|
|
fields = dict(FIELDS_RE.findall(pipeline.group(1)))
|
|
row = {"strate": strate, "workers": workers, "version": version,
|
|
"phase": phase, "replicate": replicate, "exit_code": result.returncode,
|
|
"wall_s": round(time.monotonic() - started, 3),
|
|
"lod02_ready_s": float(near.group(3)),
|
|
"whole_view_ready_s": float(fields["whole_view_ready"].removesuffix("s")),
|
|
"log": str(log.relative_to(ROOT))}
|
|
print("[L130TimingRun] " + json.dumps(row, sort_keys=True), flush=True)
|
|
return row
|
|
|
|
|
|
def main() -> int:
|
|
if any(not path.is_file() for path in (DATA, *BINARIES.values())):
|
|
raise SystemExit("missing L130 timing input")
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
load_1m = __import__("os").getloadavg()[0]
|
|
def cpu_idle(interval: float = 2.0) -> float:
|
|
def totals() -> tuple[int, int]:
|
|
fields = Path("/proc/stat").read_text().splitlines()[0].split()
|
|
values = [int(value) for value in fields[1:]]
|
|
return sum(values), values[3] + (values[4] if len(values) > 4 else 0)
|
|
before = totals()
|
|
time.sleep(interval)
|
|
after = totals()
|
|
return 100.0 * (after[1] - before[1]) / max(1, after[0] - before[0])
|
|
idle = cpu_idle()
|
|
pass_suffix = "" if PASS_ID == 1 else f"-p{PASS_ID}"
|
|
(OUT / f"machine-load-v227{pass_suffix}-before.txt").write_text(
|
|
f"1-minute load: {load_1m:.2f}\n2-second CPU idle: {idle:.1f}%\n")
|
|
print(f"[L130TimingGate] load_1m={load_1m:.2f} cpu_idle_2s={idle:.1f}%",
|
|
flush=True)
|
|
if load_1m >= 0.9 or idle < 97.0:
|
|
raise SystemExit("timing refused: machine is above the quiet-load gate")
|
|
|
|
rows = []
|
|
for strate in range(4):
|
|
for workers in (8, 12):
|
|
for version in BINARIES:
|
|
run(strate, workers, version, "warmup", 0)
|
|
for replicate in range(REPLICATE_FIRST, REPLICATE_FIRST + 5):
|
|
order = tuple(BINARIES) if replicate % 2 else tuple(reversed(BINARIES))
|
|
for version in order:
|
|
rows.append(run(strate, workers, version, "measured", replicate))
|
|
(OUT / f"runs-v227{pass_suffix}-partial.json").write_text(
|
|
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
|
prior_runs = []
|
|
if PASS_ID > 1:
|
|
previous = OUT / ("v227-summary.json" if PASS_ID == 2
|
|
else "v227-combined-summary.json")
|
|
if previous.is_file():
|
|
prior_runs = json.loads(previous.read_text(encoding="utf-8")).get("runs", [])
|
|
all_rows = prior_runs + rows
|
|
measured_rows = [row for row in all_rows if row["phase"] == "measured"]
|
|
summary = []
|
|
for strate in range(4):
|
|
for workers in (8, 12):
|
|
group_size = sum(row["strate"] == strate and row["workers"] == workers
|
|
for row in measured_rows) // 2
|
|
item = {"strate": strate, "workers": workers,
|
|
"replicates_per_version": group_size}
|
|
medians = {}
|
|
for version in BINARIES:
|
|
group = [row for row in measured_rows if row["strate"] == strate
|
|
and row["workers"] == workers and row["version"] == version]
|
|
medians[version] = {}
|
|
for key in ("lod02_ready_s", "whole_view_ready_s"):
|
|
values = [row[key] for row in group]
|
|
medians[version][key] = statistics.median(values)
|
|
item[f"{version}_{key}_values"] = values
|
|
item[f"{version}_{key}_median"] = medians[version][key]
|
|
for key in ("lod02_ready_s", "whole_view_ready_s"):
|
|
item[f"L130_vs_b96dd73_{key}_delta_pct"] = round(
|
|
100.0*(medians["L130"][key]/medians["b96dd73"][key]-1.0), 2)
|
|
summary.append(item)
|
|
summary_path = OUT / ("v227-summary.json" if PASS_ID == 1
|
|
else f"v227-combined-summary.json")
|
|
summary_path.write_text(json.dumps(
|
|
{"runs": all_rows, "summary": summary}, indent=2) + "\n", encoding="utf-8")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|