File size: 879 Bytes
87b48de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Reproduce all registered trusted benchmarks (configs/solver_registry.yaml) and write docs/benchmarks/solver_benchmarks.json."""
import json
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))

from matter_os.app import MatterOS  # noqa: E402
from simulation.benchmarks import run_all  # noqa: E402

if __name__ == "__main__":
    app = MatterOS()
    res = run_all(app, app.create_project("benchmarks").project_id)
    out = ROOT / "docs" / "benchmarks"; out.mkdir(parents=True, exist_ok=True)
    (out / "solver_benchmarks.json").write_text(json.dumps(res, indent=1, default=str))
    for r in res:
        print(f"{r['benchmark']:28s} computed={r.get('computed')} {r.get('unit')}  ref={r.get('reference', {}).get('value')}  "
              f"dev={r.get('deviation')}  -> {'PASS' if r.get('passed') else 'FAIL'}")