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 / tests / omegallm / setup-fail-check.sh

51 lines · 2644 bytes Raw Blame History
1#!/bin/sh
2# L1014: a failed GPU setup must print its stage and error on stderr and exit 75, never trap BOUNDS (103).
3# Builds the gb10 source, then scratch copies whose nvstart fails at its first step, before it opens
4# /dev/nvidiactl, with a chosen nvstage and error: 35:81 (RM NV_ERR_NO_MEMORY at the step that waits
5# while another job holds the chip: the busy text), 21:81 (the same status at a memory allocation with
6# no wait: the no-wait text) and 35:22 (any other error: the general text). Each case expects
7# exit 75, empty stdout, its own text and neither of the other two. No /dev/nvidia* file is opened, so
8# the GPU and its driver are never touched.
9# Usage: OMC=<omc> CK=<checkpoint, V 4096> sh tests/omegallm/setup-fail-check.sh (CORE as in build.sh)
10# gdiag loads CK and a small generated token file (u16 little-endian, 8192 tokens below 4096), then
11# ggopen fails in the shim; gpu buffers 2 and 3 are never allocated, the case that trapped before.
12set -eu
13here=$(cd "$(dirname "$0")" && pwd)
14out=${OUT:-$(mktemp -d)}
15TARGET=gb10 OUT=$out sh "$here/build.sh" >/dev/null
16src=$out/ollm.om
17old='put nvstage 0 1
18r = fopen nvctl 0 len nvctl 524290 0'
19fail=0
20python3 -I -c "import sys; open(sys.argv[1],'wb').write(b''.join(((i*7919)%4096).to_bytes(2,'little') for i in range(8192)))" "$out/tokens.bin"
21busy='seen while another job holds the GPU'
22nofit='at a step with no wait and no retry'
23other='positive is driver status, negative is errno'
24for c in 35:81 21:81 35:22; do
25 st=${c%:*}; e=${c#*:}
26 OLD="$old" STG=$st ERR=$e python3 -I - "$src" "$out/shim$st-$e.om" <<'PY'
27import os, sys
28s = open(sys.argv[1]).read()
29o = os.environ['OLD']
30assert s.count(o) == 1
31a, b = o.split('\n', 1)
32open(sys.argv[2], 'w').write(s.replace(o, a + '\nif ne get nvstate 0 0\nput nvstage 0 %s\nput nverr 0 %s\nret false\nend\n' % (os.environ['STG'], os.environ['ERR']) + b))
33PY
34 "${OMC:?set OMC}" < "$out/shim$st-$e.om" > "$out/shim$st-$e"
35 chmod +x "$out/shim$st-$e"
36 case $c in
37 35:81) want=$busy; no1=$nofit; no2=$other ;;
38 21:81) want=$nofit; no1=$busy; no2=$other ;;
39 *) want=$other; no1=$busy; no2=$nofit ;;
40 esac
41 rc=0
42 "$out/shim$st-$e" gdiag "${CK:?set CK}" "$out/tokens.bin" 0 > "$out/shim$st-$e.out" 2> "$out/shim$st-$e.err" < /dev/null || rc=$?
43 er=$out/shim$st-$e.err
44 if [ "$rc" != 75 ] || [ -s "$out/shim$st-$e.out" ] || ! grep -q "GPU setup failed at stage $st, error $e (" "$er" \
45 || ! grep -qF "$want" "$er" || grep -qF "$no1" "$er" || grep -qF "$no2" "$er"; then
46 echo "FAIL stage=$st error=$e rc=$rc"; cat "$er"; fail=1
47 else
48 echo "PASS stage=$st error=$e rc=75: $(cat "$er")"
49 fi
50done
51exit $fail