AsianPlayer/TriDrive / code /eval /run_joint_evals_final_ecan_table3.sh
AsianPlayer's picture
download
raw
5.32 kB
#!/usr/bin/env bash
# cwm3/eval/run_joint_evals_final_ecan_table3.sh — the paired columns of the ECAN-version Table 3 (owner decision docs/decisions.md 2026-09-17T06:47:06Z item 1:
# "ECAN-version Table 3 with all paired columns (vs indep_ecan, none_ecan, naive_ecan, k0)"), CPU, layout guards on, idempotent (finished tags are skipped).
# Runs on the ECAN E base (E0_pooled_P_can_s<k>_v2): main = I1_all_minus_road2drv_s<k>_final_ecan, indep = I1_indep_s<k>_final_ecan (existing, WP4 batch 1),
# none / naive = I1_{none,naive}_s<k>_final_ecan (train/queue_r2_ecan_controls.txt: the ECAN main command line with only --variant swapped).
# Exactly the flags of the existing finalc_*ecan* pairs (eval/run_joint_evals_final_ecan.sh): v2 causal kin targets, both regimes, test split, n_boot 1000 device-cluster
# resamples, seeds 0/1/2. Joint cells through eval/pc_joint_locked.py (flock-guarded append; `parallel` at a time, MemAvailable >= 8 GB before each launch);
# P cells through eval/pressure_eval.py SEQUENTIALLY after the joint batch (it appends to results/paired_compare.csv without the lock).
# finalc_s<k>_allminusecan_vs_indepecan (exists from the ECAN lane; recomputed only if absent)
# finalc_s<k>_allminusecan_vs_noneecan, finalc_s<k>_allminusecan_vs_naiveecan
# finalc_s<k>_allminusecan_vs_k0 (--b none --b-k0: the k0 heuristic from the causal K0; driver cells only, base-rate rows = persistence)
# finalc_s<k>_noneecan_vs_indepecan, finalc_s<k>_naiveecan_vs_indepecan
# finalcv_s<k>_allminusecan_vs_indepecan masked protocol with the human-VERIFIED 3-route mask (results/targets_kin_causal_routes_v2/driver_box_verified_mask.json)
# finalP_s<k>_{allminusecan_vs_indepecan, allminusecan_vs_noneecan, allminusecan_vs_naiveecan, noneecan_vs_indepecan, naiveecan_vs_indepecan} P cells
# bash eval/run_joint_evals_final_ecan_table3.sh ["0 1 2"] [parallel=3] [render=1]
set -u
cd "$(dirname "$0")/.."
PY=python
export OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
SEEDS="${1:-0 1 2}"; PAR="${2:-3}"; RENDER="${3:-1}"
C="--kin-targets causal_routes --kin-version v2"
VMASK=results/targets_kin_causal_routes_v2/driver_box_verified_mask.json
have_tag() { grep -q ",$1,$2,test," results/paired_compare.csv 2>/dev/null; }
done_run() { [[ -f results/runs/$1/PRED_DONE && -f results/runs/$1/TRAIN_DONE ]]; }
JOBS=$(mktemp /tmp/ecan_t3_jobs.XXXXXX); PJOBS=$(mktemp /tmp/ecan_t3_pjobs.XXXXXX)
add() { # tag a b [extra...] (b = "none" for the k0 heuristic)
local tag="$1" a="$2" b="$3"; shift 3
done_run "$a" || { echo "skip $tag ($a not finished)"; return; }
[[ "$b" == none ]] || done_run "$b" || { echo "skip $tag ($b not finished)"; return; }
local bpath="results/runs/$b"; [[ "$b" == none ]] && bpath=none
for reg in manual engaged; do
have_tag "$tag" "$reg" && continue
echo "$tag results/runs/$a $bpath $reg $*" >> "$JOBS"
done
}
addP() { # tag a b
local tag="$1" a="$2" b="$3"
done_run "$a" && done_run "$b" || { echo "skip $tag (P cells; runs not finished)"; return; }
for reg in manual engaged; do
have_tag "$tag" "$reg" && continue
echo "$tag results/runs/$a results/runs/$b $reg" >> "$PJOBS"
done
}
for s in $SEEDS; do
M=I1_all_minus_road2drv_s${s}_final_ecan; I=I1_indep_s${s}_final_ecan; N=I1_none_s${s}_final_ecan; NV=I1_naive_s${s}_final_ecan
add "finalc_s${s}_allminusecan_vs_indepecan" $M $I $C
add "finalc_s${s}_allminusecan_vs_noneecan" $M $N $C
add "finalc_s${s}_allminusecan_vs_naiveecan" $M $NV $C
add "finalc_s${s}_allminusecan_vs_k0" $M none $C --b-k0
add "finalc_s${s}_noneecan_vs_indepecan" $N $I $C
add "finalc_s${s}_naiveecan_vs_indepecan" $NV $I $C
add "finalcv_s${s}_allminusecan_vs_indepecan" $M $I $C --mask-routes $VMASK
addP "finalP_s${s}_allminusecan_vs_indepecan" $M $I
addP "finalP_s${s}_allminusecan_vs_noneecan" $M $N
addP "finalP_s${s}_allminusecan_vs_naiveecan" $M $NV
addP "finalP_s${s}_noneecan_vs_indepecan" $N $I
addP "finalP_s${s}_naiveecan_vs_indepecan" $NV $I
done
n=$(wc -l < "$JOBS" | tr -d ' '); np=$(wc -l < "$PJOBS" | tr -d ' ')
echo "[$(date -u +%H:%M:%SZ)] $n joint pairing calls ($PAR in parallel, MemAvailable >= 8 GB gate) + $np P-cell calls (sequential)"
if [[ "$n" -gt 0 ]]; then
xargs -P "$PAR" -L 1 bash -c 'tag=$0; a=$1; b=$2; reg=$3; shift 3; until [ "$(awk "/MemAvailable/ {printf \"%d\", \$2/1048576}" /proc/meminfo)" -ge 8 ]; do sleep 30; done; echo "[$(date -u +%H:%M:%SZ)] == $tag $reg"; '"$PY"' eval/pc_joint_locked.py --regime "$reg" --a "$a" --b "$b" --tag "$tag" "$@" 2>&1 | grep -E "mask-routes|locked-append|appended|Error|Traceback|File \"|LAYOUT GUARD|no rows" | cut -c1-220' < "$JOBS"
fi
if [[ "$np" -gt 0 ]]; then
while read -r tag a b reg; do
until [ "$(awk '/MemAvailable/ {printf "%d", $2/1048576}' /proc/meminfo)" -ge 8 ]; do sleep 30; done
echo "[$(date -u +%H:%M:%SZ)] == $tag $reg (P cells)"
$PY eval/pressure_eval.py --regime "$reg" --a "$a" --b "$b" --tag "$tag" 2>&1 | grep -E "appended|Error|Traceback|File \"|LAYOUT GUARD" | cut -c1-220
done < "$PJOBS"
fi
rm -f "$JOBS" "$PJOBS"
if [[ "$RENDER" == "1" ]]; then
$PY eval/report_final_ecan_table3.py --seeds ${SEEDS// /,} --out results/tables/stage_final_ecan_table3.md 2>&1 | grep -E "written|VERDICT|B2|B1|missing"
fi
echo "[$(date -u +%H:%M:%SZ)] ECAN_TABLE3_EVALS_DONE"

Xet Storage Details

Size:
5.32 kB
·
Xet hash:
40572112525eafdecec7d132a7bcac521c1184294f5bc660a5fe5daf19ef50d8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.