streaming: near LODs first (walkable ring, LOD0, LOD1, LOD2, then far); exact passage trims (L78)
- Headless and Unreal schedulers drain the collision-critical ring, then LOD0-2, then far LODs at low priority. LOD0-2 ready (W8 medians): SW 4.36->1.76, FI 6.89->5.26, TN 4.88->3.22, VS 2.71->1.56 s. Whole view roughly unchanged (FI/VS slightly later). KNOWN RISK: far tiles wait until every near tile is ready, so far LODs may starve while moving fast (to address next). - Exact composer trims: tile-level upper-mouth candidate list, segment-index min/max rejection before lower_bound, 64-entry thread-local value-noise corner cache. Passage share 65 -> 63%. - World exact: 24/24 hash matrix + pinned L75 owner hash. Fast tier PASS. Linux UE host builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
1 parent
5e091d254c
commit
ec20994a8e
10 files changed
+718
-52
No files matched your search
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Summarize sampler closure, phase cost, and route census from L78 timing logs."""
|
||||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import json
|
||||
import re
|
||||
import statistics
|
||||
from collections import defaultdict
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
TIMING = ROOT / "Saved/Linux/l78/timing"
|
||||
OUT = ROOT / "Saved/Linux/l78"
|
||||
SAMPLE = re.compile(
|
||||
r"^\[L77Sample\] pc=\S+ lod=(\d+) stage=(\S+) route=(\S+) "
|
||||
r"phase=(\S+) halo=(\d+) weight=(\d+)$", re.M)
|
||||
SAMPLER = re.compile(
|
||||
r"^\[L77Sampler\] action=stop .*?samples=(\d+) .*?lost=(\d+) "
|
||||
r"timer_overruns=(\d+).*?profiled_thread_cpu_s=([0-9.]+).*?"
|
||||
r"handler_cpu_ms=([0-9.]+) handler_share_pct=([0-9.]+) "
|
||||
r"observed_us_per_tick=([0-9.]+)", re.M)
|
||||
DISPATCH = re.compile(
|
||||
r"^\[WorldAssemblerL77Dispatch\] lod=(\d+) stage=(\S+) route=(\S+) "
|
||||
r"calls=(\d+) points=(\d+)$", re.M)
|
||||
LOD_COST = re.compile(
|
||||
r"^\[WorldAssemblerLODCostDetail\] lod=(\d+) tiles=(\d+).*?"
|
||||
r"mc_grid_ms=([0-9.]+).*?worker_ms_per_tile=([0-9.]+)", re.M)
|
||||
|
||||
|
||||
def analyze(row: dict) -> tuple[dict, list[dict], list[dict]]:
|
||||
path = ROOT / row["log"]
|
||||
content = path.read_text(encoding="utf-8", errors="replace")
|
||||
sampler_match = SAMPLER.search(content)
|
||||
if sampler_match is None:
|
||||
raise SystemExit(f"sampler summary missing from {path}")
|
||||
samples = [
|
||||
(int(lod), stage, route, phase, int(halo), int(weight))
|
||||
for lod, stage, route, phase, halo, weight in SAMPLE.findall(content)
|
||||
]
|
||||
sample_count, lost, overruns = map(int, sampler_match.group(1, 2, 3))
|
||||
profiled_cpu_s, handler_cpu_ms, handler_share_pct, period_us = map(
|
||||
float, sampler_match.group(4, 5, 6, 7))
|
||||
period_s = period_us / 1_000_000.0
|
||||
lod_costs = {
|
||||
int(lod): (int(tiles), float(grid_ms) / 1000.0,
|
||||
float(worker_ms) * int(tiles) / 1000.0)
|
||||
for lod, tiles, grid_ms, worker_ms in LOD_COST.findall(content)
|
||||
}
|
||||
dispatch = {
|
||||
(int(lod), stage, route): (int(calls), int(points))
|
||||
for lod, stage, route, calls, points in DISPATCH.findall(content)
|
||||
}
|
||||
|
||||
scope_metrics = []
|
||||
for scope, predicate in (("LOD0-2", lambda lod: 0 <= lod <= 2),
|
||||
("whole_view", lambda lod: 0 <= lod <= 8)):
|
||||
selected = [item for item in samples if predicate(item[0])]
|
||||
sampled_cpu_s = sum(item[5] for item in selected) * period_s
|
||||
sampled_grid_s = sum(item[5] for item in selected if item[1] == "grid_fill") * period_s
|
||||
sampled_passage_s = sum(item[5] for item in selected
|
||||
if item[3] == "passages") * period_s
|
||||
sampled_support_s = sum(item[5] for item in selected
|
||||
if item[3] == "support") * period_s
|
||||
direct_grid_s = sum(value[1] for lod, value in lod_costs.items() if predicate(lod))
|
||||
direct_worker_s = sum(value[2] for lod, value in lod_costs.items() if predicate(lod))
|
||||
scope_metrics.append({
|
||||
"strate": row["strate"], "mode": row["mode"], "pair": row["pair"],
|
||||
"scope": scope, "sample_events": len(selected),
|
||||
"sampled_cpu_s": sampled_cpu_s,
|
||||
"sampled_grid_fill_s": sampled_grid_s,
|
||||
"direct_grid_fill_s": direct_grid_s,
|
||||
"grid_closure_pct": 100.0 * sampled_grid_s / direct_grid_s if direct_grid_s else 0.0,
|
||||
"sampled_passage_s": sampled_passage_s,
|
||||
"sampled_passage_pct": 100.0 * sampled_passage_s / sampled_cpu_s
|
||||
if sampled_cpu_s else 0.0,
|
||||
"sampled_support_s": sampled_support_s,
|
||||
"sampled_support_pct": 100.0 * sampled_support_s / sampled_cpu_s
|
||||
if sampled_cpu_s else 0.0,
|
||||
"direct_worker_cpu_s": direct_worker_s,
|
||||
})
|
||||
|
||||
route_metrics = []
|
||||
scopes = (("LOD0-2", lambda lod: 0 <= lod <= 2),
|
||||
("whole_view", lambda lod: 0 <= lod <= 8))
|
||||
for scope, predicate in scopes:
|
||||
route_keys = {
|
||||
(item[1], item[2]) for item in samples if predicate(item[0])
|
||||
} | {
|
||||
(stage, route) for (lod, stage, route) in dispatch if predicate(lod)
|
||||
}
|
||||
sampled_total = sum(item[5] for item in samples if predicate(item[0])) * period_s
|
||||
for stage, route in sorted(route_keys):
|
||||
weighted = sum(item[5] for item in samples
|
||||
if predicate(item[0]) and item[1] == stage and item[2] == route)
|
||||
calls = sum(value[0] for (lod, current_stage, current_route), value in dispatch.items()
|
||||
if predicate(lod) and current_stage == stage and current_route == route)
|
||||
points = sum(value[1] for (lod, current_stage, current_route), value in dispatch.items()
|
||||
if predicate(lod) and current_stage == stage and current_route == route)
|
||||
sampled_s = weighted * period_s
|
||||
route_metrics.append({
|
||||
"strate": row["strate"], "mode": row["mode"], "pair": row["pair"],
|
||||
"scope": scope, "caller_stage": stage, "route": route,
|
||||
"calls": calls, "points": points, "sampled_cpu_s": sampled_s,
|
||||
"share_scope_sampled_cpu_pct": 100.0 * sampled_s / sampled_total
|
||||
if sampled_total else 0.0,
|
||||
})
|
||||
|
||||
summary = {
|
||||
"strate": row["strate"], "mode": row["mode"], "pair": row["pair"],
|
||||
"log": row["log"], "sampler_events": sample_count,
|
||||
"parsed_sampler_events": len(samples), "lost": lost,
|
||||
"timer_overruns": overruns, "profiled_thread_cpu_s": profiled_cpu_s,
|
||||
"handler_cpu_ms": handler_cpu_ms, "handler_share_pct": handler_share_pct,
|
||||
"observed_us_per_tick": period_us,
|
||||
}
|
||||
return summary, scope_metrics, route_metrics
|
||||
|
||||
|
||||
def write_csv(path: Path, rows: list[dict]) -> None:
|
||||
if not rows:
|
||||
return
|
||||
with path.open("w", encoding="utf-8", newline="") as stream:
|
||||
writer = csv.DictWriter(stream, fieldnames=list(rows[0]))
|
||||
writer.writeheader()
|
||||
writer.writerows(rows)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
timing = json.loads((TIMING / "summary.json").read_text(encoding="utf-8"))
|
||||
sampler_rows, scope_rows, route_rows = [], [], []
|
||||
for row in timing["runs"]:
|
||||
sampler, scopes, routes = analyze(row)
|
||||
sampler_rows.append(sampler)
|
||||
scope_rows.extend(scopes)
|
||||
route_rows.extend(routes)
|
||||
|
||||
write_csv(OUT / "sampler-census.csv", sampler_rows)
|
||||
write_csv(OUT / "closure-census.csv", scope_rows)
|
||||
write_csv(OUT / "route-census.csv", route_rows)
|
||||
|
||||
averaged = []
|
||||
for strate in range(4):
|
||||
for mode in ("before", "after"):
|
||||
samples = [row for row in scope_rows
|
||||
if row["strate"] == strate and row["mode"] == mode]
|
||||
for scope in ("LOD0-2", "whole_view"):
|
||||
values = [row for row in samples if row["scope"] == scope]
|
||||
averaged.append({
|
||||
"strate": strate, "mode": mode, "scope": scope,
|
||||
"runs": len(values),
|
||||
"sampled_cpu_s_mean": statistics.mean(row["sampled_cpu_s"] for row in values),
|
||||
"sampled_grid_fill_s_mean": statistics.mean(row["sampled_grid_fill_s"] for row in values),
|
||||
"direct_grid_fill_s_mean": statistics.mean(row["direct_grid_fill_s"] for row in values),
|
||||
"grid_closure_pct_mean": statistics.mean(row["grid_closure_pct"] for row in values),
|
||||
"passage_s_mean": statistics.mean(row["sampled_passage_s"] for row in values),
|
||||
"passage_sample_pct_mean": statistics.mean(
|
||||
row["sampled_passage_pct"] for row in values),
|
||||
"support_s_mean": statistics.mean(row["sampled_support_s"] for row in values),
|
||||
"support_sample_pct_mean": statistics.mean(
|
||||
row["sampled_support_pct"] for row in values),
|
||||
"direct_worker_cpu_s_mean": statistics.mean(row["direct_worker_cpu_s"] for row in values),
|
||||
})
|
||||
(OUT / "profile-summary.json").write_text(
|
||||
json.dumps({"sampler_runs": sampler_rows, "scope_summary": averaged}, indent=2) + "\n",
|
||||
encoding="utf-8")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,46 @@
|
||||
# Linux78 report
|
||||
|
||||
## Passage cost and world identity
|
||||
|
||||
The expensive path is `ApplyResolvedStratePassageCarves`: negative density samples enter the passage loop and query the segment index even when their tile has little passage overlap. The route relief calls `VF_FieldPassageWallRelief`, three 3D value-noise octaves at 43/29/19 voxel wavelengths; mouth relief uses the three-octave surface relief. A representative W8 tunnel LOD0 composer census recorded 6.0M composer queries, 18.1M passage iterations, 45.1M segment visits, and 40.8M relief calls.
|
||||
|
||||
The retained exact changes are a conservative tile-level upper-mouth candidate list and early return, segment-index min/max rejection before `lower_bound`, and a 64-entry thread-local cache of value-noise lattice corners. The cache preserves the existing interpolation operations and values. The passage share remains high: FI/TN near-LOD passage phase averages 63.0%/63.7% after the change, versus 64.6%/65.9% before; support is 13.8%/13.5% versus 14.1%/13.2%.
|
||||
|
||||
The world is exact. The L75 full-grid owner hash and all 24 Clang/GCC × W1/W8/W12 × four-strate density, mesh, payload, and topology comparisons match. No version bump or new captures were needed. Fast-tier passage audits passed.
|
||||
|
||||
## Readiness, W8, three interleaved pairs, median seconds
|
||||
|
||||
| Strate | LOD0–2 before | LOD0–2 after | Whole view before | Whole view after |
|
||||
|---|---:|---:|---:|---:|
|
||||
| SurfaceWorld | 4.36 | 1.76 | 4.36 | 3.43 |
|
||||
| FloatingIslands | 6.89 | 5.26 | 6.89 | 6.93 |
|
||||
| TunnelNetwork | 4.88 | 3.22 | 4.88 | 4.55 |
|
||||
| VerticalShafts | 2.71 | 1.56 | 2.71 | 2.84 |
|
||||
|
||||
The headless and Unreal schedulers now submit the collision-critical walkable ring first, then LOD0, LOD1, and LOD2. Far LOD work waits until the requested near LODs are ready and runs at lower priority. The ~1 s near-LOD target is not met for FI/TN; their medians are 5.26 s and 3.22 s. Whole-view times are reported separately above.
|
||||
|
||||
## L77 sampler closure and phase census
|
||||
|
||||
Values are mean sampled grid-fill/direct grid-fill closure; passage and support are their sampled CPU shares. Near is LOD0–2.
|
||||
|
||||
| Strate | Near closure B/A | Whole closure B/A | Passage share near B/A | Support share near B/A |
|
||||
|---|---:|---:|---:|---:|
|
||||
| SurfaceWorld | 99.1% / 99.9% | 100.1% / 99.6% | 45.1% / 47.6% | 15.0% / 12.8% |
|
||||
| FloatingIslands | 99.9% / 99.5% | 99.8% / 99.8% | 64.6% / 63.0% | 14.1% / 13.8% |
|
||||
| TunnelNetwork | 99.9% / 100.1% | 99.8% / 100.2% | 65.9% / 63.7% | 13.2% / 13.5% |
|
||||
| VerticalShafts | 100.0% / 100.2% | 99.9% / 100.9% | 45.9% / 42.9% | 5.9% / 6.6% |
|
||||
|
||||
Sampler handler cost stayed below 0.05% of profiled thread CPU. Detailed samples and route counts are in `Saved/Linux/l78/sampler-census.csv`, `closure-census.csv`, and `route-census.csv`.
|
||||
|
||||
## Builds and checks
|
||||
|
||||
- Fast tier: PASS, 366.8 s.
|
||||
- Hash matrix: PASS, 24/24; the pinned L75 full-grid owner hash also matches.
|
||||
- Linux VFHostEditor: PASS after timing, `-MaxParallelActions=4`, no address-space limit; UBT reported 70.35 s in its parallel executor.
|
||||
- No installs, commit, push, or stash.
|
||||
|
||||
## Failed runs and rejected experiment
|
||||
|
||||
- The first fast-tier launch pointed at an output directory without its expected verifier binaries; corrected, then the final fast tier passed.
|
||||
- L76's broad per-tile passage-loop experiment caused 612 density mismatches and changed mesh, payload, and topology hashes on 24 tiles; L76 rejected it. It is not part of the accepted L76 reference. In L78, per-brick and direct per-sample feature-bound filters also failed the pinned L75 owner hash, so both were removed. The retained path matches the accepted L76 matrix and pinned L75 owner hash.
|
||||
- The first direct UBT call could not find `dotnet` in PATH; rerunning through the engine `Build.sh` wrapper succeeded.
|
||||
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare L78 exact tile hashes with the retained L76/L77-equivalent matrix."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
OUT = ROOT / "Saved/Linux/l78/hashes"
|
||||
DATA = ROOT / "Standalone/data/owner_world.json"
|
||||
BINARIES = {
|
||||
"clang": ROOT / "Saved/Linux/l78/bin/VoxelForgeCoreHeadless-l78-clang",
|
||||
"gcc": ROOT / "Saved/Linux/l78/bin/VoxelForgeCoreHeadless-l78-gcc",
|
||||
}
|
||||
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),
|
||||
}
|
||||
HASH = re.compile(
|
||||
r"^\[PipelineTileHash\] lod=(\d+) x=(-?\d+) y=(-?\d+) z=(-?\d+) "
|
||||
r"density=(0x[0-9a-fA-F]+) mesh=(0x[0-9a-fA-F]+) "
|
||||
r"payload=(0x[0-9a-fA-F]+) topology=(0x[0-9a-fA-F]+)$",
|
||||
re.M,
|
||||
)
|
||||
|
||||
|
||||
def read_hashes(path: Path) -> dict[tuple[int, int, int, int], tuple[str, ...]]:
|
||||
content = path.read_text(encoding="utf-8", errors="replace")
|
||||
return {
|
||||
tuple(int(match.group(i)) for i in range(1, 5)):
|
||||
tuple(value.lower() for value in match.groups()[4:])
|
||||
for match in HASH.finditer(content)
|
||||
}
|
||||
|
||||
|
||||
def run(compiler: str, workers: int, strate: int) -> dict:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
log = OUT / compiler / f"w{workers}" / f"strate{strate}-after.log"
|
||||
log.parent.mkdir(parents=True, exist_ok=True)
|
||||
camera = ",".join(f"{value:.12f}" for value in CAMERAS[strate]) + ",0,0"
|
||||
command = [
|
||||
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
||||
"timeout", "1740s", str(BINARIES[compiler]), str(DATA),
|
||||
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
|
||||
"--force-generate", f"--workers={workers}", "--clip-radius=3",
|
||||
"--max-clip-level=8", "--max-level=8", f"--camera={camera}",
|
||||
"--stream-hash-tiles",
|
||||
]
|
||||
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)
|
||||
hashes = read_hashes(log)
|
||||
if result.returncode != 0 or not hashes:
|
||||
raise SystemExit(f"hash generation failed: {log}; exit={result.returncode}")
|
||||
reference = ROOT / "Saved/Linux/l76/hashes" / compiler / f"w{workers}" / f"strate{strate}-before.log"
|
||||
expected = read_hashes(reference)
|
||||
missing, extra = expected.keys() - hashes.keys(), hashes.keys() - expected.keys()
|
||||
mismatches = {name: 0 for name in ("density", "mesh", "payload", "topology")}
|
||||
examples = []
|
||||
for key in sorted(expected.keys() & hashes.keys()):
|
||||
for index, name in enumerate(mismatches):
|
||||
if expected[key][index] != hashes[key][index]:
|
||||
mismatches[name] += 1
|
||||
if len(examples) < 12:
|
||||
examples.append({"tile": key, "field": name,
|
||||
"before": expected[key][index],
|
||||
"after": hashes[key][index]})
|
||||
row = {
|
||||
"compiler": compiler,
|
||||
"workers": workers,
|
||||
"strate": strate,
|
||||
"exit_code": result.returncode,
|
||||
"wall_s": round(time.monotonic() - started, 3),
|
||||
"expected_tiles": len(expected),
|
||||
"candidate_tiles": len(hashes),
|
||||
"missing_keys": len(missing),
|
||||
"extra_keys": len(extra),
|
||||
"mismatches": mismatches,
|
||||
"examples": examples,
|
||||
"equal": not missing and not extra and not any(mismatches.values()),
|
||||
"reference": str(reference.relative_to(ROOT)),
|
||||
"log": str(log.relative_to(ROOT)),
|
||||
}
|
||||
print("[L78HashCompare] " + json.dumps(row, sort_keys=True), flush=True)
|
||||
return row
|
||||
|
||||
|
||||
def main() -> int:
|
||||
missing = [str(path) for path in (DATA, *BINARIES.values()) if not path.is_file()]
|
||||
if missing:
|
||||
raise SystemExit("missing input: " + ", ".join(missing))
|
||||
rows = []
|
||||
for compiler in ("clang", "gcc"):
|
||||
for workers in (1, 8, 12):
|
||||
for strate in range(4):
|
||||
row = run(compiler, workers, strate)
|
||||
rows.append(row)
|
||||
(OUT / "summary-partial.json").write_text(
|
||||
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
||||
if not row["equal"]:
|
||||
raise SystemExit(f"hash mismatch; see {row['log']}")
|
||||
result = {"comparisons": rows, "equal": all(row["equal"] for row in rows)}
|
||||
(OUT / "summary.json").write_text(json.dumps(result, indent=2) + "\n",
|
||||
encoding="utf-8")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run interleaved L77/L78 cold readiness pairs for the four owner strates."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
import statistics
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
OUT = ROOT / "Saved/Linux/l78/timing"
|
||||
DATA = ROOT / "Standalone/data/owner_world.json"
|
||||
BINARIES = {
|
||||
"before": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-l77-clang",
|
||||
"after": ROOT / "Saved/Linux/l78/bin/VoxelForgeCoreHeadless-l78-clang-profile",
|
||||
}
|
||||
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.compile(r"^\[StreamPipeline\] (.*)$", re.M)
|
||||
FIELDS = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
|
||||
LOD_READY = re.compile(
|
||||
r"^\[WorldAssemblerL77LODReady\] lod=(\d+) tiles=(\d+) cold_ready_s=([0-9.]+)$",
|
||||
re.M,
|
||||
)
|
||||
STAMP = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=(\S+)$", re.M)
|
||||
ORDERS = (("before", "after"), ("after", "before"), ("before", "after"))
|
||||
|
||||
|
||||
def run(strate: int, pair: int, mode: str) -> dict:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
log = OUT / f"strate{strate}-pair{pair}-{mode}.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[mode]), 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",
|
||||
]
|
||||
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_match = PIPELINE.search(content)
|
||||
ready = {int(lod): {"tiles": int(tiles), "seconds": float(seconds)}
|
||||
for lod, tiles, seconds in LOD_READY.findall(content)}
|
||||
if result.returncode != 0 or pipeline_match is None or any(lod not in ready for lod in (0, 1, 2)):
|
||||
raise SystemExit(f"readiness run failed or LOD0-2 data missing: {log}; exit={result.returncode}")
|
||||
pipeline = dict(FIELDS.findall(pipeline_match.group(1)))
|
||||
row = {
|
||||
"strate": strate,
|
||||
"pair": pair,
|
||||
"mode": mode,
|
||||
"exit_code": result.returncode,
|
||||
"wall_s": round(time.monotonic() - started, 3),
|
||||
"lod02_ready_s": max(ready[lod]["seconds"] for lod in (0, 1, 2)),
|
||||
"lod_ready_s": {str(lod): ready[lod]["seconds"] for lod in sorted(ready)},
|
||||
"whole_view_ready_s": float(pipeline["whole_view_ready"].removesuffix("s")),
|
||||
"whole_tiles": int(pipeline["whole_tiles"].split("/")[0]),
|
||||
"sampler": next((line for line in content.splitlines()
|
||||
if line.startswith("[L77Sampler] action=stop")), None),
|
||||
"source_stamp": STAMP.search(content).group(1) if STAMP.search(content) else None,
|
||||
"log": str(log.relative_to(ROOT)),
|
||||
}
|
||||
print("[L78TimingRun] " + json.dumps(row, sort_keys=True), flush=True)
|
||||
return row
|
||||
|
||||
|
||||
def main() -> int:
|
||||
missing = [str(path) for path in (DATA, *BINARIES.values()) if not path.is_file()]
|
||||
if missing:
|
||||
raise SystemExit("missing input: " + ", ".join(missing))
|
||||
rows = []
|
||||
for strate in range(4):
|
||||
for pair, order in enumerate(ORDERS, 1):
|
||||
paired = {}
|
||||
for mode in order:
|
||||
row = run(strate, pair, mode)
|
||||
rows.append(row)
|
||||
paired[mode] = row
|
||||
(OUT / "runs-partial.json").write_text(
|
||||
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
||||
summary_row = {
|
||||
"strate": strate,
|
||||
"pair": pair,
|
||||
"before_lod02_s": paired["before"]["lod02_ready_s"],
|
||||
"after_lod02_s": paired["after"]["lod02_ready_s"],
|
||||
"before_whole_s": paired["before"]["whole_view_ready_s"],
|
||||
"after_whole_s": paired["after"]["whole_view_ready_s"],
|
||||
}
|
||||
print("[L78TimingPair] " + json.dumps(summary_row, sort_keys=True), flush=True)
|
||||
summary = []
|
||||
for strate in range(4):
|
||||
group = [row for row in rows if row["strate"] == strate]
|
||||
before_near = [row["lod02_ready_s"] for row in group if row["mode"] == "before"]
|
||||
after_near = [row["lod02_ready_s"] for row in group if row["mode"] == "after"]
|
||||
before_whole = [row["whole_view_ready_s"] for row in group if row["mode"] == "before"]
|
||||
after_whole = [row["whole_view_ready_s"] for row in group if row["mode"] == "after"]
|
||||
summary.append({
|
||||
"strate": strate,
|
||||
"pairs": len(before_near),
|
||||
"before_lod02_s": before_near,
|
||||
"after_lod02_s": after_near,
|
||||
"before_lod02_median_s": statistics.median(before_near),
|
||||
"after_lod02_median_s": statistics.median(after_near),
|
||||
"before_whole_s": before_whole,
|
||||
"after_whole_s": after_whole,
|
||||
"before_whole_median_s": statistics.median(before_whole),
|
||||
"after_whole_median_s": statistics.median(after_whole),
|
||||
})
|
||||
result = {"runs": rows, "summary": summary}
|
||||
(OUT / "summary.json").write_text(json.dumps(result, indent=2) + "\n",
|
||||
encoding="utf-8")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user