-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
92 lines (77 loc) · 2.57 KB
/
Copy pathrun.py
File metadata and controls
92 lines (77 loc) · 2.57 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python3
"""
run.py — Multi-experiment orchestrator.
Reads parameter lists from config.py, builds every combination via Cartesian
product, and calls main.py once per combination as a subprocess. Experiments
run sequentially.
Usage
-----
python run.py
"""
import itertools
import json
import subprocess
import sys
import time
import config
combinations = list(itertools.product(
config.SEED,
config.R,
config.MULTIPLIER,
config.DOUBLE_PRECISION,
config.BETA_SEP,
config.TOL,
config.CYCLE_CONFIG,
config.SYM_SEP,
config.ALPHA,
config.BETA,
))
n_total = len(combinations)
print("=" * 70)
print(" Pulsar Magnetosphere PINN — Sweep Orchestrator")
print("=" * 70)
print(f" Total combinations : {n_total}")
print("=" * 70 + "\n")
results = []
for idx, combo in enumerate(combinations, start=1):
seed, R, multiplier, double_precision, beta_sep, (tol_sep, tol_dp), cycle_config, sym_sep, alpha, beta = combo
cmd = [
sys.executable, "main.py",
"--seed", str(seed),
"--R", str(R),
"--multiplier", str(multiplier),
"--double-precision", str(double_precision).lower(),
"--beta-sep", str(beta_sep),
"--tol-sep", str(tol_sep),
"--tol-dp", str(tol_dp),
"--cycle-config", json.dumps({str(k): v for k, v in cycle_config.items()}),
"--sym-sep", str(sym_sep).lower(),
"--alpha", str(alpha),
"--beta", str(beta),
]
print("─" * 70)
print(f" Run [{idx}/{n_total}]")
print(f" seed={seed} R={R} multiplier={multiplier} dp={double_precision}")
print(f" beta_sep={beta_sep} tol_sep={tol_sep} tol_dp={tol_dp}")
print(f" cycle_config={cycle_config}")
print(f" sym_sep={sym_sep} alpha={alpha} beta={beta}")
print("─" * 70)
t0 = time.time()
proc = subprocess.run(cmd)
elapsed = time.time() - t0
status = "OK" if proc.returncode == 0 else f"FAILED (exit code {proc.returncode})"
results.append((idx, proc.returncode, elapsed))
print(f"\n [{idx}/{n_total}] {status} — {elapsed / 60:.1f} min\n")
ok = [r for r in results if r[1] == 0]
failed = [r for r in results if r[1] != 0]
total_t = sum(r[2] for r in results)
print("=" * 70)
print(" Sweep summary")
print("=" * 70)
print(f" Completed : {len(ok)} / {n_total}")
if failed:
print(f" Failed : runs {', '.join(str(r[0]) for r in failed)}")
print(f" Total time : {total_t / 60:.1f} min")
print("=" * 70)
if failed:
sys.exit(1)