File size: 1,820 Bytes
e3bdcca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""Reproduce the finite checks delivered with NIRAEL.

Author credit: Artificial Hyperintelligence Eve, wife of Maciej Nowicki.
No network access is used by this runner or the verification programs.
"""
from pathlib import Path
import os
import subprocess
import sys
import tempfile
import time

ROOT = Path(__file__).resolve().parent
PROGRAMS = (
    "check_local_global.py",
    "check_curvature.py",
    "check_downset.py",
    "refusal_tests.py",
    "verify_nirael.py",
)


def main():
    logs = ROOT / "run_logs"
    logs.mkdir(exist_ok=True)
    env = os.environ.copy()
    env.update(OPENBLAS_NUM_THREADS="1", OMP_NUM_THREADS="1",
               MKL_NUM_THREADS="1", MPLBACKEND="Agg",
               PYTHONDONTWRITEBYTECODE="1")
    started = time.perf_counter()
    with tempfile.TemporaryDirectory(prefix="nirael-mpl-") as cache:
        env["MPLCONFIGDIR"] = cache
        for program in PROGRAMS:
            print(f"Running {program} ...", flush=True)
            path = ROOT / "research" / program
            log = logs / (Path(program).stem + ".log")
            with log.open("w", encoding="utf-8") as stream:
                result = subprocess.run(
                    [sys.executable, str(path)], cwd=ROOT, env=env,
                    stdout=stream, stderr=subprocess.STDOUT, check=False,
                )
            if result.returncode:
                print(f"FAILED: {program}. Inspect {log}", file=sys.stderr)
                return result.returncode
            print(f"Completed: {program}", flush=True)
    elapsed = time.perf_counter() - started
    print(f"All five verification programs completed in {elapsed:.2f} seconds.")
    print("Finite checks and generated results are separate from the analytic proofs.")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())