#!/usr/bin/env bash # P4 Volve (configs/protocol_volve.yaml) on the Linux GPU server; same stages as scripts/run_p4.ps1. # scripts/run_p4.sh # register, train, summarize (primary σ_a arm) # scripts/run_p4.sh benchmark | lock | status # runtime pilot, first lock, progress # ARMS=sensitivity scripts/run_p4.sh register train # σ_a = 3.5 / 14 ms arms; then ARMS=all ... summarize # DEVICE (default cuda:1), WORKERS (default 4) and THREADS per worker (default 2) can be overridden. # register/train/summarize refuse to run unless the protocol, code, inputs and environment match the lock, and skip # completed jobs whose fingerprints and checksums match, so the driver can be restarted. set -euo pipefail cd "$(dirname "$0")/.." PY="${PY:-.venv/bin/python}" DEVICE="${DEVICE:-cuda:1}" WORKERS="${WORKERS:-4}" THREADS="${THREADS:-2}" ARMS="${ARMS:-primary}" 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 for stage in ${@:-register train summarize}; do "$PY" -m ml_porosity.runlog -n "p4_${stage}_${ARMS}" -- "$PY" scripts/24_run_volve.py "$stage" \ --device "$DEVICE" --workers "$WORKERS" --arms "$ARMS" done