33 lines
856 B
Python
33 lines
856 B
Python
#!/usr/bin/env python3
|
|
# run_all.py -- run all lean4 bench scripts and write results.txt
|
|
|
|
import sys
|
|
import os
|
|
import importlib.util
|
|
import time
|
|
|
|
BENCH_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
def load_module(filename):
|
|
path = os.path.join(BENCH_DIR, filename)
|
|
spec = importlib.util.spec_from_file_location("mod", path)
|
|
mod = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(mod)
|
|
return mod
|
|
|
|
all_lines = []
|
|
|
|
for fname in ["bench-lean4-0001.py", "bench-lean4-0002.py", "bench-lean4-0003.py"]:
|
|
mod = load_module(fname)
|
|
lines = mod.run()
|
|
all_lines.extend(lines)
|
|
all_lines.append("")
|
|
print()
|
|
sys.stdout.flush()
|
|
|
|
out_path = os.path.join(BENCH_DIR, "results.txt")
|
|
with open(out_path, "w") as f:
|
|
f.write("\n".join(all_lines) + "\n")
|
|
|
|
print(f"results written to {out_path}")
|
|
sys.stdout.flush()
|