interplane.Get Omega
Read in your language

aien-train

AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.

Brought by drakestapleton

branch main Branches Tags History

aien-train / streams / own-fp4 / race2.sh

20 lines · 1213 bytes Raw Blame History
1#!/bin/bash
2# race2.sh (L284 oracle): like race.sh, but waits for an earlier queue to end and retries a run up to 6 times when the
3# GPU refuses a context at start-up (cuDevicePrimaryCtxRetain out of memory: other jobs' servers hold the GPU).
4# Usage: race2.sh WAIT_PID "recipe:seed[:extra] ..."
5D=$HOME/workspace/aien-train-own-fp4-data; H=$(cd "$(dirname "$0")" && pwd); PY=$HOME/.venv/bin/python
6mkdir -p $D/runs
7while kill -0 "$1" 2>/dev/null; do sleep 60; done
8for item in $2; do
9 IFS=: read -r rec seed extra <<<"$item"; out=$D/runs/$rec-s$seed
10 [ -f $out/result.json ] && { echo "skip $out"; continue; }
11 for try in 1 2 3 4 5 6; do
12 until timeout 120 $PY -I -c "import torch; torch.ones(1,device='cuda'); assert torch.cuda.mem_get_info()[0] > 6e9" >/dev/null 2>&1; do echo "$(date -u +%H:%MZ) waiting for GPU ($rec)"; sleep 120; done
13 echo "$(date -u +%H:%MZ) start $rec seed $seed try $try"
14 nice -n 10 $PY -I $H/train.py --recipe $rec --seed $seed --out $out $extra > $out.log 2>&1; rc=$?
15 echo "$(date -u +%H:%MZ) end $rec rc=$rc $(tail -1 $out.log | cut -c1-200)"
16 [ $rc = 0 ] && break
17 grep -q "cuDevicePrimaryCtxRetain\|out of memory" $out.log || break
18 sleep 120
19 done
20done