| # Score several profiles at once, one worker per card. | |
| # | |
| # The serial scorer manages roughly one video per minute, so the 21 profiles of | |
| # a full batch cost most of a day on their own. Sharding by profile is safe | |
| # because each profile writes only into its own eval root, and `run_eval.sh` | |
| # skips anything already carrying a completion marker, so workers never contend | |
| # and a re-run is idempotent. | |
| set -uo pipefail | |
| cd /home/n2501108a/KV/experiments/rope_reindex_allmethods_20260824 | |
| GPUS=${LINGBOT_EVAL_GPUS:?usage: LINGBOT_EVAL_GPUS=1,3,4,5 run_eval_parallel.sh TAG...} | |
| [[ $# -gt 0 ]] || { echo "pass at least one profile tag" >&2; exit 2; } | |
| IFS=',' read -r -a cards <<<"$GPUS" | |
| log() { echo "[$(date '+%m-%d %H:%M:%S')] $*"; } | |
| # Round-robin so that a long profile does not leave one card idle at the end. | |
| declare -A shard | |
| index=0 | |
| for tag in "$@"; do | |
| card=${cards[$((index % ${#cards[@]}))]} | |
| shard[$card]="${shard[$card]:-} $tag" | |
| index=$((index + 1)) | |
| done | |
| pids=() | |
| for card in "${cards[@]}"; do | |
| tags=${shard[$card]:-} | |
| [[ -n "$tags" ]] || continue | |
| log "GPU $card <-$tags" | |
| LINGBOT_EVAL_GPU="$card" LINGBOT_RUNS_DIR="${LINGBOT_RUNS_DIR:-runs}" \ | |
| ./run_eval.sh $tags >"logs/eval_gpu${card}.log" 2>&1 & | |
| pids+=($!) | |
| done | |
| status=0 | |
| for pid in "${pids[@]}"; do | |
| wait "$pid" || status=1 | |
| done | |
| log "all shards finished (status $status)" | |
| exit "$status" | |