#!/usr/bin/env python3 """Compare L25 and 24 m crossing hash records for matching recipe/compiler/workers.""" import re from pathlib import Path ROOT = Path(__file__).resolve().parents[4] OUT = ROOT / "Saved/Linux/l31" pattern = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M) lines = [] failed = False for recipe in ("surface-world", "floating-islands"): for compiler in ("clang", "gcc"): for workers in (1, 8, 12): left = pattern.findall((OUT / f"l25-{compiler}-{recipe}-w{workers}.log").read_text()) right = pattern.findall((OUT / f"crossing24-{compiler}-{recipe}-w{workers}.log").read_text()) same = bool(left) and len(left) == 12 and left == right failed |= not same lines.append(f"{recipe},{compiler},W{workers},{'MATCH' if same else 'MISMATCH'}") path = OUT / "determinism-crossing-compare.log" path.write_text("\n".join(lines) + "\n", encoding="utf-8") print("\n".join(lines)) print(f"[L31CrossingHashCompare] comparisons={len(lines)} " f"pass={sum(line.endswith('MATCH') for line in lines)} fail={sum(line.endswith('MISMATCH') for line in lines)}") raise SystemExit(1 if failed else 0)