Add P6 benchmark code, locked protocol_bench, T2 study

- ml_porosity/benchmark/ runner, scripts 32-35, scripts/run_bench.sh;
  misspec= option in synth_d2 (default path reproduces P2r bit for bit).
- configs/protocol_bench.{yaml,sha256,lock.json} locked 29/10 14:39 UTC
  (sha256 aa763f0a...), configs/d2_synth_bench.yaml.
- T2 mechanism declaration and results; operations/p6_supervisor.py.
- Docs, report and paper edits of 29/10.

outputs/ stays out of git; the repository folder is synced as a whole to
the new server. Main S1 runs are still training at this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 01:06:59 +00:00
parent 0cfe202a8b
commit 381b5ffb06
47 changed files with 6263 additions and 58 deletions

41
scripts/run_bench.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# protocol_bench (configs/protocol_bench.yaml) driver on the Linux GPU server: every stage is wrapped by
# ml_porosity.runlog (logs/runs/<ts>_bench_<stage>/, logs/index.csv) and is restartable (completed jobs are skipped
# by fingerprint and checksum). Long runs: detach with `setsid nohup scripts/run_bench.sh ... > logs/bench_<x>.out 2>&1 &`.
# scripts/run_bench.sh lock # first lock (after the review of the draft)
# STUDIES="S1" DEVICE=cuda:0 WORKERS=4 scripts/run_bench.sh posterior train
# STUDIES="S3 S4 S8" DEVICE=cuda:1 scripts/run_bench.sh train
# scripts/run_bench.sh summarize | status | repro
# DEV=1 RIDS="902 903" STUDIES="S2" PRESETS="rp_L1 wv_L1" scripts/run_bench.sh posterior train # dev (never a result)
# Env: DEVICE (default cuda:0), WORKERS (4), THREADS per worker (2), MEM_GB per SMC worker (6), STUDIES, REGIMES,
# PRESETS, RIDS, DEV (1 → --dev), CONTROLS (1 → S2 controls), EXTRA (extra arguments).
set -euo pipefail
cd "$(dirname "$0")/.."
PY="${PY:-.venv/bin/python}"
DEVICE="${DEVICE:-cuda:0}"
WORKERS="${WORKERS:-4}"
THREADS="${THREADS:-2}"
MEM_GB="${MEM_GB:-6}"
STUDIES="${STUDIES:-S1 S2 S3 S4 S8}"
export OMP_NUM_THREADS=$THREADS MKL_NUM_THREADS=$THREADS OPENBLAS_NUM_THREADS=$THREADS NUMEXPR_NUM_THREADS=$THREADS \
NUMBA_NUM_THREADS=$THREADS PYTHONHASHSEED=0 PYTHONUTF8=1 CUBLAS_WORKSPACE_CONFIG=:4096:8
args=(--device "$DEVICE" --workers "$WORKERS" --threads "$THREADS" --gpu-mem-gb "$MEM_GB")
# shellcheck disable=SC2206
args+=(--studies $STUDIES)
[[ -n "${REGIMES:-}" ]] && args+=(--regimes $REGIMES)
[[ -n "${PRESETS:-}" ]] && args+=(--presets $PRESETS)
[[ -n "${RIDS:-}" ]] && args+=(--rids $RIDS)
[[ "${DEV:-0}" == "1" ]] && args+=(--dev)
[[ "${CONTROLS:-0}" == "1" ]] && args+=(--controls)
[[ -n "${EXTRA:-}" ]] && args+=($EXTRA)
tag="$(echo "$STUDIES" | tr ' ' '+')"
[[ "${DEV:-0}" == "1" ]] && tag="dev_$tag"
for stage in "${@:-status}"; do
case "$stage" in
status|lock|summarize|repro)
"$PY" -m ml_porosity.runlog -n "bench_${stage}" -- "$PY" scripts/34_run_bench.py "$stage" "${args[@]}" ;;
posterior|train|dev-budgets)
"$PY" -m ml_porosity.runlog -n "bench_${stage}_${tag}_${DEVICE//:/}" -- "$PY" scripts/34_run_bench.py "$stage" "${args[@]}" ;;
*) echo "unknown stage: $stage" >&2; exit 2 ;;
esac
done