protocol_p3 (cee2ff0) was the rerun of P2 on new realizations, not the
plan's phase P3 (F3 field). Renamed to P2r before any of realizations 8-15
was generated: protocol, D2 config, dev runner and summary script, output
dir outputs/p2/diag/p2rdev, tag protocol-p3 -> protocol-p2r. Protocol
content changes only names plus two notes in p2_outcome: the deviation from
protocol_p2's if_fail rule (pivot) and what the diagnosis did not test
(sigma_b, rock-physics stress). Re-locked: sha256 eb887311...
Docs: plan §12 item 12 and report section closing P2 (locked verdict kept,
diagnosis, decision, deviation, untested items, link to phase P3 / G-C).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
5.5 KiB
Bash
84 lines
5.5 KiB
Bash
#!/usr/bin/env bash
|
||
# Dev experiments in preparation for protocol_p2r (plan §10): dev realizations 900/901 only; main grid 0–7 is not used.
|
||
# scripts/run_p2r_dev.sh # all stages in order
|
||
# scripts/run_p2r_dev.sh stability sigma_a # only the named stages
|
||
# screen SMC posterior over SNR {10, 5, 0, −5} dB × anchor density {full, half, topbottom} × c {1, 2} × N {4, 16}
|
||
# train training (scripts/15) in the screen cells with σ_post ≥ 1.5 ms (outputs/p2/diag/p2rdev/wide_cells.txt,
|
||
# written by scripts/17): M2-Sa, B3d-Sa, B3c-R, Oracle… 5 seeds, fixed budgets
|
||
# stability 4 independent SMC runs with P = 256 and 2 with P = 1024 (SNR 10, full): warp difference between runs
|
||
# stability_m5 as stability at SNR −5 dB, full (the F3-like regime): 2 runs with P = 1024 (the chosen setting)
|
||
# b3d_old supplementary: old protocol_p2 B3d (point-tie competitor for H2a) at SNR 10/0/−5, full, same seeds and budgets
|
||
# sigma_a registration with σ_a = 3.5 and 14 ms when the data are generated with σ_a = 7 ms (plan §5.5)
|
||
# train_sa training on the sigma_a posteriors (c 1 2; every method registered with the misspecified σ_a): does H2a hold?
|
||
# f3 SMC posterior on the 4 F3 wells (descriptive only, scripts/16)
|
||
# h3 H3 with the SMC posterior: 5-seed ensembles of M2-Sa, B3d-Sa… vs B5 in the protocol_p2 setting (c 1, 2)
|
||
# GPU jobs run on cuda:1 (override with DEVICE=...). Re-running after an interruption: scripts 14, 15 skip jobs that already have a CSV.
|
||
set -euo pipefail
|
||
cd "$(dirname "$0")/.."
|
||
PY="${PY:-.venv/bin/python}"
|
||
[[ -n "${RUNLOG_DIR:-}" ]] || exec "$PY" -m ml_porosity.runlog -n p2rdev -- bash "scripts/$(basename "$0")" "$@"
|
||
step() { "$PY" -m ml_porosity.runlog "$@" || echo "step failed: $*" >&2; }
|
||
DEVICE="${DEVICE:-cuda:1}"
|
||
WORKERS="${WORKERS:-6}"
|
||
# The machine environment presets OMP_NUM_THREADS=40 (also MKL, OpenBLAS): unless overridden, each worker opens a 40-thread pool.
|
||
THREADS="${THREADS:-2}"
|
||
export OMP_NUM_THREADS=$THREADS MKL_NUM_THREADS=$THREADS OPENBLAS_NUM_THREADS=$THREADS NUMEXPR_NUM_THREADS=$THREADS \
|
||
NUMBA_NUM_THREADS=$THREADS
|
||
OUT=outputs/p2/diag
|
||
POST=(scripts/14_diag_posterior.py --rids 900 901 --c 1 2 --n 4 16 --seeds 0 --device "$DEVICE")
|
||
TRAIN=(scripts/15_diag_train.py --rids 900 901 --n 4 16 --seeds 0 1 2 3 4 --device "$DEVICE" --variants a 1
|
||
--methods Oracle B3b B3c M2 B3c-R B3d-Sa M2-Sa B3d-S1 M2-S1 --budgets-from "$OUT/train/budgets.json" --save-preds)
|
||
|
||
for stage in ${@:-screen train stability sigma_a f3 h3}; do
|
||
case "$stage" in
|
||
screen)
|
||
for snr in 10 5 0 -5; do
|
||
for dens in full half topbottom; do
|
||
step -n "stress_snr${snr}_${dens}" -- "$PY" "${POST[@]}" --snr "$snr" --anchor-density "$dens" \
|
||
--wavelets estR true --workers "$WORKERS" --out-dir "$OUT/stress/snr${snr}_${dens}"
|
||
done
|
||
done ;;
|
||
train)
|
||
CUDA_VISIBLE_DEVICES= "$PY" scripts/17_summarize_p2r_dev.py --only screen > /dev/null
|
||
while read -r snr dens cs <&3; do
|
||
# shellcheck disable=SC2086 # cs is a list of c values and must be word-split
|
||
step -n "train_snr${snr}_${dens}" -- "$PY" "${TRAIN[@]}" --snr "$snr" --anchor-density "$dens" --c $cs \
|
||
--workers 4 --post-dir "$OUT/stress/snr${snr}_${dens}" --out-dir "$OUT/train_stress/snr${snr}_${dens}"
|
||
done 3< "$OUT/p2rdev/wide_cells.txt" ;;
|
||
stability)
|
||
step -n stab_p256 -- "$PY" "${POST[@]}" --smc-seeds 0 1 2 3 --wavelets estR --workers "$WORKERS" \
|
||
--out-dir "$OUT/stability/p256"
|
||
step -n stab_p1024 -- "$PY" "${POST[@]}" --particles 1024 --smc-seeds 0 1 --wavelets estR --workers 4 \
|
||
--gpu-mem-gb 6 --out-dir "$OUT/stability/p1024" ;;
|
||
stability_m5)
|
||
step -n stab_p1024_snr-5 -- "$PY" "${POST[@]}" --snr -5 --anchor-density full --particles 1024 --smc-seeds 0 1 \
|
||
--wavelets estR --workers 4 --gpu-mem-gb 6 --out-dir "$OUT/stability/p1024_snr-5" ;;
|
||
b3d_old)
|
||
B3D=(scripts/15_diag_train.py --rids 900 901 --n 4 16 --seeds 0 1 2 3 4 --c 1 2 --device "$DEVICE" --variants a
|
||
--methods B3d --budgets-from "$OUT/train/budgets.json" --workers 4)
|
||
step -n b3d_snr10_full -- "$PY" "${B3D[@]}" --post-dir "$OUT/posterior_gpu" --out-dir "$OUT/train_b3d/snr10_full"
|
||
for snr in 0 -5; do
|
||
step -n "b3d_snr${snr}_full" -- "$PY" "${B3D[@]}" --snr "$snr" --anchor-density full \
|
||
--post-dir "$OUT/stress/snr${snr}_full" --out-dir "$OUT/train_b3d/snr${snr}_full"
|
||
done ;;
|
||
sigma_a)
|
||
for sa in 3.5 14; do
|
||
step -n "stress_sa${sa}" -- "$PY" "${POST[@]}" --sigma-a-reg "$sa" --wavelets estR true --workers "$WORKERS" \
|
||
--out-dir "$OUT/stress/snr10_full_sa${sa}"
|
||
done ;;
|
||
train_sa)
|
||
for sa in 3.5 14; do
|
||
step -n "train_sa${sa}" -- "$PY" scripts/15_diag_train.py --rids 900 901 --n 4 16 --seeds 0 1 2 3 4 --c 1 2 \
|
||
--device "$DEVICE" --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --sigma-a-reg "$sa" \
|
||
--budgets-from "$OUT/train/budgets.json" --workers 4 --post-dir "$OUT/stress/snr10_full_sa${sa}" \
|
||
--out-dir "$OUT/train_sa/sa${sa}"
|
||
done ;;
|
||
f3)
|
||
OMP_NUM_THREADS=4 MKL_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 step -n f3_posterior -- "$PY" scripts/16_f3_posterior.py \
|
||
--device "$DEVICE" ;;
|
||
h3)
|
||
step -n h3_smc -- "$PY" "${TRAIN[@]}" --c 1 2 --workers 4 --post-dir "$OUT/posterior_gpu" --out-dir "$OUT/h3_smc" ;;
|
||
*) echo "unknown stage: $stage" >&2; exit 2 ;;
|
||
esac
|
||
done
|