diff options
Diffstat (limited to 'ep_run/ep_jacreg_grid.py')
| -rw-r--r-- | ep_run/ep_jacreg_grid.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ep_run/ep_jacreg_grid.py b/ep_run/ep_jacreg_grid.py new file mode 100644 index 0000000..8be0c63 --- /dev/null +++ b/ep_run/ep_jacreg_grid.py @@ -0,0 +1,27 @@ +import time, os, re, subprocess, math +os.chdir("/home/yurenh2/ept/ep_run"); LOG="runs/ep_jacreg.log" +def alive(): return subprocess.run(["pgrep","-f","ckpt runs/ep_jacreg.pt"],capture_output=True).returncode==0 +def latest(): + try: ls=[l for l in open(LOG) if l.startswith("step")] + except Exception: return None + if not ls: return None + l=ls[-1] + ms=re.search(r"step\s+(\d+)",l); mv=re.search(r"val CE ([\d.eE+-]+)",l) + mb=re.search(r"best ([\d.eE+-]+)",l); mr=re.search(r"res=([\d.eE+-]+)",l); mj=re.search(r"jr=([\d.eE+-]+)",l) + if not (ms and mv and mb and mr): return None + return (int(ms.group(1)),float(mv.group(1)),float(mb.group(1)),float(mr.group(1)),float(mj.group(1)) if mj else 0.0) +d0=latest(); B0=d0[2] if d0 else 3.13 +nb=(math.ceil(B0*10)-1)/10.0 +fired=None; best_seen=99.0; best_step=0; t0=time.time() +while fired is None and time.time()-t0<12*3600: + time.sleep(90) + d=latest() + if not alive(): fired=f"ep_jacreg EXITED; last {d}"; break + if not d: continue + step,val,best,res,jr=d + if best<best_seen: best_seen=best; best_step=step + if val>10 or res>0.3: fired=f"ep_jacreg DIVERGED @step{step} val{val:.2f} res{res:.1e} jr={jr:.1f} best{best:.4f} -> adaptive jacreg did NOT hold"; break + if jr>=15.5 and res>5e-3: fired=f"ep_jacreg jr SATURATED @step{step} jr={jr:.1f}(max16) res={res:.1e} best{best:.4f} -> controller maxed, can't hold (jacreg insufficient/over-tax)"; break + if best<=nb+1e-9: fired=f"ep_jacreg reached {nb:.2f}: step{step} best{best:.4f} val{val:.4f} res{res:.1e} jr={jr:.2f}"; break + if step-best_step>=1500 and best>nb: fired=f"ep_jacreg STALLED above {nb:.2f}: best{best:.4f} no-improve {step-best_step} res{res:.1e} jr={jr:.2f}"; break +print(f"=== EP_JACREG GRID (target {nb:.2f}) ==="); print(fired or "12h timeout"); print("last:",latest()) |
