#!/usr/bin/env bash
# interleaved A/B, one card (110 VM RTX 4090): a = origin/main 77832f37a, b = fix/exl3-head-stock-call-sites ab1575d12. a1 b1 a2 b2.
cd ~/headroute; exec 9>/run/lock/arbi-gpu-0.lock; flock -w 43200 9 || exit 1
for t in a1 b1 a2 b2; do
  scripts/hr_boot.sh ${t:0:1} $t 2>&1 | cut -c1-200 || { echo "$t BOOT FAILED"; continue; }
  python3 scripts/hr_drive.py out/$t/drive > out/$t/drive.log 2>&1
  echo "$t drive done $(date +%T) $(nvidia-smi --query-gpu=temperature.gpu,power.draw,power.limit --format=csv,noheader)"
  scripts/hr_stop.sh $t
done
echo JOB_AB_DONE
