Extend oracle gap P06 bracket

This commit is contained in:
2026-07-13 22:21:17 +08:00
parent 34e1f4c144
commit a9e7e9991e
3 changed files with 105 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ from analyze import CONFIGS, PHASES, atomic_json, score_trial, summarize_trials
SCHEMA = 1
AMENDMENT = "A-OG-1"
REMOTE_ROOT = Path("/home/admin/cpfs/wjh/oracle-gap-20260713")
RUN_ROOT = REMOTE_ROOT / "runs"
STATE = RUN_ROOT / "controller-state.json"
@@ -56,7 +57,10 @@ BASE_RATES = {
"P01": (32.0, 26.0, 36.0, 28.0, 34.0, 30.0),
"P06": (1.7, 1.4, 2.0, 1.5, 1.9, 1.6, 1.8),
}
UP_EXTENSIONS = {"P01": (38.0, 40.0, 42.0), "P06": (2.1, 2.2, 2.3)}
UP_EXTENSIONS = {
"P01": (38.0, 40.0, 42.0),
"P06": (2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.8, 3.0),
}
DOWN_EXTENSIONS = {"P01": (24.0, 22.0, 20.0), "P06": (1.3, 1.2, 1.1)}
TIMELINE = {
"P01": {"warmup": 60, "clean": 60, "drain": 120},
@@ -207,6 +211,9 @@ def fingerprint() -> dict[str, Any]:
return {
"controller_sha256": sha256_file(Path(__file__).resolve()),
"analyzer_sha256": sha256_file(Path(__file__).with_name("analyze.py")),
"protocol_sha256": sha256_file(
REPO / "docs/opprof/oracle-gap-protocol.md"
),
"p5_client_sha256": sha256_file(P5_CLIENT),
"p3_client_sha256": sha256_file(P3_CLIENT_DIR / "opprof_phase3_client.py"),
"repo_commit": run_text(["git", "-C", str(REPO), "rev-parse", "HEAD"]).strip(),
@@ -220,9 +227,27 @@ def fingerprint() -> dict[str, Any]:
"driver": run_text(["nvidia-smi", "--query-gpu=driver_version", "--format=csv,noheader"]).splitlines()[0],
"config_details": CONFIG_DETAILS,
"base_rates": {key: list(value) for key, value in BASE_RATES.items()},
"up_extensions": {
key: list(value) for key, value in UP_EXTENSIONS.items()
},
}
def resume_compatible(old: dict[str, Any], current: dict[str, Any]) -> bool:
immutable = (
"p5_client_sha256",
"p3_client_sha256",
"vllm_commit",
"model",
"manifests",
"runtime",
"driver",
"config_details",
"base_rates",
)
return all(old.get(key) == current.get(key) for key in immutable)
def ensure_provenance(current: dict[str, Any]) -> None:
destination = RUN_ROOT / "provenance"
destination.mkdir(parents=True, exist_ok=True)
@@ -235,10 +260,18 @@ def ensure_provenance(current: dict[str, Any]) -> None:
):
target = destination / source.name
if target.exists() and sha256_file(target) != sha256_file(source):
raise RuntimeError(f"provenance file changed: {target}")
digest = sha256_file(source)
target = destination / f"{source.stem}.{digest[:12]}{source.suffix}"
if target.exists() and sha256_file(target) != sha256_file(source):
raise RuntimeError(f"content-addressed provenance mismatch: {target}")
if not target.exists():
shutil.copy2(source, target)
atomic_json(destination / "fingerprint.json", current)
fingerprint_path = (
destination / f"fingerprint.{current['repo_commit'][:8]}.json"
)
atomic_json(fingerprint_path, current)
if not (destination / "fingerprint.json").exists():
atomic_json(destination / "fingerprint.json", current)
atomic_json(destination / "host-before.json", gpu_snapshot())
(destination / "nvidia-smi-q.txt").write_text(run_text(["nvidia-smi", "-q"]))
@@ -607,7 +640,28 @@ def execute(resume: bool) -> None:
assert_idle()
current = fingerprint()
if state["fingerprint"] and state["fingerprint"] != current:
raise RuntimeError("resume fingerprint changed")
if not (
resume
and state.get("status") == "failed"
and resume_compatible(state["fingerprint"], current)
):
raise RuntimeError("resume fingerprint changed incompatibly")
state.setdefault("amendments", []).append(
{
"id": AMENDMENT,
"accepted_at": time.time(),
"reason": (
"C00/P06 feasible through the original 2.3-rps "
"upper extension"
),
"completed_trials_before": len(
state.get("completed_trials", [])
),
"gpu_hours_before": state.get("gpu_hours"),
"old_fingerprint": state["fingerprint"],
"new_fingerprint": current,
}
)
state["fingerprint"] = current
state["status"] = "running"
save_state(state)