Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/evidence/own-gpu-driver/rung0/window.sh # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / evidence / own-gpu-driver / rung0 / window.sh` 49 lines ยท 2938 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # L332 rung 0, one spark-window: 3 # cell (a) idle control, Omega launch-cost test unprobed/probed/strace at two rep counts, idle again; 4 # cell (b) the live 35B server on 18091: attach perf+bpftrace (no ptrace) while one fixed greedy request decodes, and an 5 # attached idle control of the same length. The server is never restarted or signalled. 6 set -u 7 here=$(cd "$(dirname "$0")" && pwd) 8 BIN=${BIN:-$HOME/workspace/targets/l332-omega/gpu_launch_cost_test} 9 OUT=${OUT:-$here/a-$(date -u +%Y%m%dT%H%M%SZ)} 10 PORT=${PORT:-18091} 11 mkdir -p "$OUT" 12 while [ ! -x "$BIN" ]; do sleep 30; done 13 sha256sum "$BIN" > "$OUT/bin.sha256" 14 ledger note L332 "measure: in line for spark-window l332-rung0 ($OUT)" >/dev/null 2>&1 15 spark-window open l332-rung0 --ledger L332 --gb10 exclusive --lease 20 --wait > "$OUT/window.open" 2>&1 || { echo "window open failed" >> "$OUT/window.open"; exit 1; } 16 R="spark-window run $here/rung0.sh $OUT" 17 $R idle idle1 30 18 $R run run-r3 -- "$BIN" --reps 3 19 $R run run-r30 -- "$BIN" --reps 30 20 $R probe probe-r3 -- "$BIN" --reps 3 21 $R probe probe-r30 -- "$BIN" --reps 30 22 $R strace strace-r3 -- "$BIN" --reps 3 23 $R idle idle2 30 24 spark-window close > "$OUT/window.close" 2>&1 25 # cell (b): own window without the chip lock (the server takes /tmp/aien-gb10.lock per request itself), quiet lock for timing 26 spark-window open l332-rung0b --ledger L332 --gb10 none --lease 20 --wait > "$OUT/window-b.open" 2>&1 || { echo "window b open failed" >> "$OUT/window-b.open"; exit 1; } 27 # cell (b): 35B decode on the live server 28 SPID=$(ss -ltnpH "sport = :$PORT" | grep -o "pid=[0-9]*" | head -1 | cut -d= -f2) 29 if [ -n "$SPID" ]; then 30 tr "\0" " " < /proc/$SPID/cmdline > "$OUT/server.cmdline" 31 curl -s -m 5 127.0.0.1:$PORT/v1/models > "$OUT/server.models.json" 32 MODEL=$(python3 -c 'import json,sys;print(json.load(open(sys.argv[1]))["data"][0]["id"])' "$OUT/server.models.json") 33 LOG=$(readlink /proc/$SPID/fd/1); wc -l < "$LOG" > "$OUT/server.log.line0" 34 SECS=45 35 $R attach srv-idle "$SPID" "$SECS" 36 BODY='{"model":"'"$MODEL"'","temperature":0,"max_tokens":4096,"messages":[{"role":"user","content":"Write a long, detailed history of the bicycle, chapter by chapter."}]}' 37 ( sleep 4; date +%s%N > "$OUT/srv-decode.req_start_ns" 38 curl -s -m $((SECS-6)) 127.0.0.1:$PORT/v1/chat/completions -H "content-type: application/json" -d "$BODY" \ 39 > "$OUT/srv-decode.response.json"; echo "curl_exit $?" > "$OUT/srv-decode.curl"; date +%s%N > "$OUT/srv-decode.req_done_ns" ) & 40 $R attach srv-decode "$SPID" "$SECS" 41 wait 42 tail -n +$(( $(cat "$OUT/server.log.line0") + 1 )) "$LOG" > "$OUT/server.log.window" 43 else 44 echo "no listener on $PORT" > "$OUT/server.absent" 45 fi 46 spark-window close > "$OUT/window-b.close" 2>&1 47 sudo find "$OUT" -maxdepth 1 -name '*.perf.data*' -delete; sudo chown -R "$(id -un)" "$OUT" 48 ledger note L332 "measure: rung0 window done, results $OUT" >/dev/null 2>&1 49 echo DONE > "$OUT/DONE"