gpu-head-to-head
aien-dev/gpu-head-to-head
Brought by drakestapleton
gpu-head-to-head / bench / run_all.sh
| 1 | #!/usr/bin/env bash |
| 2 | # Runs the sessions listed in bench/schedule.txt (one ARM:ROUND per line, '#' comments), in order. |
| 3 | # PROTOCOL.md section 7 + A2/A3: the 8-bit arms of every engine interleaved first (R1 forward, R2 |
| 4 | # reversed), then the optional reference and 4-bit arms. The schedule file is re-read before every |
| 5 | # session, so queued arms can be appended while a session runs. Each session runs from a snapshot |
| 6 | # of run_arm.sh (editing the script cannot disturb a running session). A session whose |
| 7 | # results/logs/<ARM>-<ROUND>/DONE exists is skipped (resume after interruption). |
| 8 | set -u |
| 9 | cd "$(dirname "$0")/.." |
| 10 | REPO=$PWD |
| 11 | while :; do |
| 12 | next= |
| 13 | while read -r s; do |
| 14 | s=${s%%#*}; s=${s// /}; [ -n "$s" ] || continue |
| 15 | [ -e "results/logs/${s%:*}-${s#*:}/DONE" ] && continue |
| 16 | [ -e "results/logs/${s%:*}-${s#*:}/NOT_RUN" ] && continue |
| 17 | next=$s; break |
| 18 | done < bench/schedule.txt |
| 19 | [ -n "$next" ] || { echo "$(date -u +%FT%TZ) schedule complete"; break; } |
| 20 | snap=$(mktemp /tmp/h2h-run_arm.XXXXXX.sh) |
| 21 | cp bench/run_arm.sh "$snap" |
| 22 | echo "$(date -u +%FT%TZ) session $next (run_arm.sh sha256 $(sha256sum < "$snap" | cut -c1-16))" |
| 23 | H2H_REPO=$REPO bash "$snap" "${next%:*}" "${next#*:}" |
| 24 | rc=$? |
| 25 | rm -f "$snap" |
| 26 | # exit 3 = /tmp/aien-gb10.lock busy for 900 s (another lane's GPU job): the session never took |
| 27 | # the GPU and ran no cell, so its pre-lock logs go to attempts/ and the same session is retried |
| 28 | if [ $rc -eq 3 ]; then |
| 29 | mv "results/logs/${next%:*}-${next#*:}" "results/logs/attempts/${next%:*}-${next#*:}-lockwait-$(date -u +%H%M%S)" |
| 30 | sleep 30; continue |
| 31 | fi |
| 32 | # a session that neither finished nor recorded NOT_RUN would loop forever: record it and move on |
| 33 | if [ ! -e "results/logs/${next%:*}-${next#*:}/DONE" ] && [ ! -e "results/logs/${next%:*}-${next#*:}/NOT_RUN" ]; then |
| 34 | echo "exit $rc without DONE" > "results/logs/${next%:*}-${next#*:}/NOT_RUN" |
| 35 | fi |
| 36 | done |