interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / evidence / GEMM-TUNE-20261027 / hold.sh

38 lines · 2046 bytes Raw Blame History
1#!/bin/bash
2# GemmTune chip hold wrapper: flock, health/compute apps before and after, BOARD GPU-START/END, 14-minute cap.
3# Exclusive-window guard (Main 07:45Z): no new hold while the last Main WINDOW-* line on BOARD is WINDOW-START,
4# and none while 18091 is not "status":"ok". Bounded: 3 h, then NOT_RUN.
5# usage: hold.sh <label> <logdir> <command...>
6set -u
7label=$1; logdir=$2; shift 2
8mkdir -p "$logdir"
9B=/home/drakestapleton/handoffs/BOARD.md
10window_open() { grep -E '^[0-9TZ:.-]+ Main: WINDOW-(START|END|ABORTED)' $B | tail -1 | grep -q 'WINDOW-START'; }
11live_ok() { curl -s -m 5 127.0.0.1:18091/health | grep -q '"status":"ok"'; }
12exec 9>/tmp/aien-gb10.lock
13deadline=$(( $(date +%s) + 10800 ))
14while :; do
15 if [ "$(date +%s)" -ge "$deadline" ]; then
16 echo "$(date -u +%FT%TZ) GemmTune: NOT_RUN $label (window open or 18091 not ok for 3 h)" >> $B; exit 75
17 fi
18 if window_open || ! live_ok; then sleep 30; continue; fi
19 if ! flock -w 900 9; then continue; fi
20 if window_open || ! live_ok; then flock -u 9; sleep 30; continue; fi
21 break
22done
23{
24 echo "# $label start $(date -u +%FT%TZ) load $(cat /proc/loadavg)"
25 echo "# health before: $(curl -s -m 5 127.0.0.1:18091/health)"
26 echo "# compute apps before: $(nvidia-smi --query-compute-apps=pid,process_name --format=csv,noheader | tr '\n' ';')"
27} > "$logdir/hold.log"
28echo "$(date -u +%FT%TZ) GemmTune: GPU-START $label (flock /tmp/aien-gb10.lock, <=14 min, beside live 35B; log $logdir)" >> $B
29timeout 840 "$@" > "$logdir/run.log" 2>&1
30rc=$?
31{
32 echo "# exit $rc end $(date -u +%FT%TZ)"
33 echo "# health after: $(curl -s -m 5 127.0.0.1:18091/health)"
34 echo "# compute apps after: $(nvidia-smi --query-compute-apps=pid,process_name --format=csv,noheader | tr '\n' ';')"
35} >> "$logdir/hold.log"
36apps=$(nvidia-smi --query-compute-apps=pid --format=csv,noheader | tr -d ' ' | sort -u | tr '\n' ' ')
37echo "$(date -u +%FT%TZ) GemmTune: GPU-END $label exit $rc; compute apps after: ${apps}; 18091 $(curl -s -m 5 127.0.0.1:18091/health | grep -o '"status":"[a-z]*"')" >> $B
38exit $rc