aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / docs / inference / evidence / smifree-sysfs-telemetry-20261027 / receipt.sh
| 1 | #!/bin/sh |
| 2 | # Side-by-side receipt: old aien-cli GPU telemetry (nvidia-smi) vs new (sysfs/procfs). |
| 3 | # Read-only. It reads sysfs/procfs, runs the old binary's exact nvidia-smi query as the |
| 4 | # oracle, runs `aien-cli doctor` (HTTP GETs to localhost 18006/18082/18080/18081/18085 |
| 5 | # only) from both binaries, and writes only into OUT. It never writes sysfs, never |
| 6 | # touches 127.0.0.1:18091 beyond the /health GET, and loads nothing on the GPU. |
| 7 | # |
| 8 | # usage: receipt.sh OUT OLD_AIEN_CLI NEW_AIEN_CLI [N samples] [interval s] |
| 9 | set -eu |
| 10 | OUT=$1; OLD=$2; NEW=$3; N=${4:-30}; IVL=${5:-2} |
| 11 | mkdir -p "$OUT" |
| 12 | |
| 13 | tgpu_mc() { |
| 14 | for z in /sys/class/thermal/thermal_zone*; do |
| 15 | if [ "$(cat "$z/device/path" 2>/dev/null)" = '\_TZ_.TGPU' ]; then cat "$z/temp"; return; fi |
| 16 | done |
| 17 | echo NA |
| 18 | } |
| 19 | |
| 20 | # Pids holding an open fd on, or a mapping of, /dev/nvidia0|nvidiactl|nvidia-uvm |
| 21 | # (first-party replacement for --query-compute-apps pids). Only processes this |
| 22 | # user may inspect are seen; per-process GPU memory has no first-party source. |
| 23 | proc_pids() { |
| 24 | for p in /proc/[0-9]*; do |
| 25 | if ls -l "$p/fd" 2>/dev/null | grep -qE '/dev/nvidia(0|ctl|-uvm)$' || |
| 26 | grep -qE '/dev/nvidia(0|ctl|-uvm)' "$p/maps" 2>/dev/null; then |
| 27 | echo "${p#/proc/}" |
| 28 | fi |
| 29 | done | sort -n | tr '\n' ' ' |
| 30 | } |
| 31 | |
| 32 | smi_pids() { |
| 33 | nvidia-smi --query-compute-apps=pid --format=csv,noheader 2>&1 | sort -n | tr '\n' ' ' |
| 34 | } |
| 35 | |
| 36 | { |
| 37 | date -u +%FT%TZ |
| 38 | echo "## health 18091 (before)"; curl -s -m 5 127.0.0.1:18091/health; echo |
| 39 | echo "## kernel"; uname -r |
| 40 | echo "## /proc/driver/nvidia/version"; head -1 /proc/driver/nvidia/version |
| 41 | for d in /sys/bus/pci/devices/*; do |
| 42 | c=$(cat "$d/class"); [ $((c >> 16)) -eq 3 ] || continue |
| 43 | echo "## display device ${d##*/}" |
| 44 | echo "vendor=$(cat "$d/vendor") device=$(cat "$d/device") class=$c" |
| 45 | echo "driver=$(basename "$(readlink "$d/driver" 2>/dev/null)" 2>/dev/null)" |
| 46 | echo "power_state=$(cat "$d/power_state" 2>/dev/null) power/control=$(cat "$d/power/control" 2>/dev/null)" |
| 47 | echo "hwmon=$(ls "$d/hwmon" 2>/dev/null | tr '\n' ' ')" |
| 48 | done |
| 49 | echo "## thermal zones (type, ACPI path, m°C)" |
| 50 | for z in /sys/class/thermal/thermal_zone*; do |
| 51 | echo "${z##*/} $(cat "$z/type") $(cat "$z/device/path" 2>/dev/null) $(cat "$z/temp")" |
| 52 | done |
| 53 | echo "## hwmon names"; for h in /sys/class/hwmon/hwmon*; do echo "${h##*/} $(cat "$h/name")"; done |
| 54 | echo "## power_supply / powercap entries"; ls /sys/class/power_supply /sys/class/powercap 2>&1 |
| 55 | } > "$OUT/system.txt" 2>&1 |
| 56 | |
| 57 | timeout 120 "$OLD" doctor > "$OUT/doctor-old.txt" 2>&1 || echo "rc=$?" >> "$OUT/doctor-old.txt" |
| 58 | timeout 120 "$NEW" doctor > "$OUT/doctor-new.txt" 2>&1 || echo "rc=$?" >> "$OUT/doctor-new.txt" |
| 59 | |
| 60 | # ExecutionSurface::detect() (backend selection; printed by --version). |
| 61 | { echo "old: $("$OLD" --version 2>&1)"; echo "new: $("$NEW" --version 2>&1)"; } > "$OUT/version.txt" |
| 62 | echo "utc,smi_name,smi_temp_c,smi_mem_used,smi_mem_total,smi_util_pct,tgpu_mc" > "$OUT/samples.csv" |
| 63 | i=0 |
| 64 | while [ "$i" -lt "$N" ]; do |
| 65 | smi=$(nvidia-smi --query-gpu=name,temperature.gpu,memory.used,memory.total,utilization.gpu \ |
| 66 | --format=csv,noheader,nounits 2>&1 | sed 's/, /,/g') |
| 67 | echo "$(date -u +%FT%TZ),$smi,$(tgpu_mc)" >> "$OUT/samples.csv" |
| 68 | i=$((i + 1)); sleep "$IVL" |
| 69 | done |
| 70 | |
| 71 | # Interleaved GPU-user sets; order alternates so neither source always reads first. |
| 72 | echo "utc,first,smi_pids,proc_pids,equal" > "$OUT/gpu-users.csv" |
| 73 | i=0 |
| 74 | while [ "$i" -lt "$N" ]; do |
| 75 | if [ $((i % 2)) -eq 0 ]; then first=smi; s=$(smi_pids); q=$(proc_pids) |
| 76 | else first=proc; q=$(proc_pids); s=$(smi_pids); fi |
| 77 | [ "$s" = "$q" ] && eq=1 || eq=0 |
| 78 | echo "$(date -u +%FT%TZ),$first,$s,$q,$eq" >> "$OUT/gpu-users.csv" |
| 79 | i=$((i + 1)); sleep "$IVL" |
| 80 | done |
| 81 | |
| 82 | { echo "## health 18091 (after)"; curl -s -m 5 127.0.0.1:18091/health; echo; date -u +%FT%TZ; } >> "$OUT/system.txt" |