omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / research / m15 / spbm / collect-c2.sh
| 1 | #!/usr/bin/env bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # R15 clarification C2 sensor validation: idle, CPU, GPU and combined load. |
| 18 | # Not an R15 qualification or PASS. Loads are deliberately bounded: 4 X925 |
| 19 | # cores (load p 14 4) and the resident GB10 seat (r15_gpu_load claims 14), |
| 20 | # 14 s per load period; the sampler records 10 s inside each period. |
| 21 | # Usage: collect-c2.sh NEW-run-directory PATH-TO-r15_gpu_load |
| 22 | set -euo pipefail |
| 23 | cd "$(dirname "$0")" |
| 24 | if [[ $# != 2 || -e "$1" || ! -x "$2" ]]; then |
| 25 | echo "usage: collect-c2.sh NEW-run-directory r15_gpu_load-binary" >&2 |
| 26 | exit 2 |
| 27 | fi |
| 28 | run_dir="$1" |
| 29 | ko="${SPBM_KO:-$PWD/aien_spbm_readonly.ko}" # the loaded module's file |
| 30 | gpu_load="$(realpath "$2")" |
| 31 | mkdir -p "$(dirname "$run_dir")" |
| 32 | mkdir "$run_dir" |
| 33 | run_dir="$(realpath "$run_dir")" |
| 34 | pids=() |
| 35 | cleanup() { for p in "${pids[@]}"; do kill "$p" 2>/dev/null || true; wait "$p" 2>/dev/null || true; done; } |
| 36 | trap cleanup EXIT |
| 37 | trap 'exit 130' INT |
| 38 | trap 'exit 143' TERM |
| 39 | hwmon= |
| 40 | for h in /sys/class/hwmon/hwmon*; do |
| 41 | if [[ $(cat "$h/name") == aien_spbm ]]; then |
| 42 | if [[ -n "$hwmon" ]]; then echo "ambiguous SPBM device" >&2; exit 1; fi |
| 43 | hwmon="$h" |
| 44 | fi |
| 45 | done |
| 46 | [[ -n "$hwmon" ]] |
| 47 | uname -a >"$run_dir/uname.txt" |
| 48 | nvidia-smi -q >"$run_dir/nvidia-smi.txt" |
| 49 | mokutil --sb-state >"$run_dir/secure-boot.txt" |
| 50 | cat /sys/kernel/security/lockdown >"$run_dir/lockdown.txt" |
| 51 | cat /sys/module/aien_spbm_readonly/srcversion >"$run_dir/loaded-srcversion.txt" |
| 52 | modinfo "$ko" >"$run_dir/module.txt" |
| 53 | [[ $(modinfo -F srcversion "$ko") == $(cat "$run_dir/loaded-srcversion.txt") ]] |
| 54 | git rev-parse HEAD >"$run_dir/base-commit.txt" |
| 55 | git status --short >"$run_dir/worktree.txt" |
| 56 | ps -eo pid,comm,pcpu --sort=-pcpu | head -40 >"$run_dir/processes-before.txt" |
| 57 | sha256sum *.c *.h Makefile collect-c2.sh sample load reduce "$ko" "$gpu_load" \ |
| 58 | >"$run_dir/source-binary.sha256" |
| 59 | start_cpu() { ./load p 14 4 >"$run_dir/load-cpu-$1.jsonl" & pids+=($!); } |
| 60 | start_gpu() { "$gpu_load" claims 14 >"$run_dir/load-gpu-$1.jsonl" 2>"$run_dir/load-gpu-$1.err" & pids+=($!); } |
| 61 | finish() { for p in "${pids[@]}"; do wait "$p"; done; pids=(); } |
| 62 | for round in 1 2 3; do |
| 63 | ./sample "$hwmon" 10 "$run_dir/idle-$round.jsonl" |
| 64 | start_cpu "$round"; sleep 2; ./sample "$hwmon" 10 "$run_dir/cpu-$round.jsonl"; finish |
| 65 | start_gpu "$round"; sleep 2; ./sample "$hwmon" 10 "$run_dir/gpu-$round.jsonl"; finish |
| 66 | start_cpu "b$round"; start_gpu "b$round"; sleep 2 |
| 67 | ./sample "$hwmon" 10 "$run_dir/both-$round.jsonl"; finish |
| 68 | done |
| 69 | ./reduce "$run_dir" idle cpu gpu both >"$run_dir/summary.json" |
| 70 | printf '%s\n' '{"collection_complete":true,"qualified":false,"R15_PASS":false}' >"$run_dir/status.json" |
| 71 | (cd "$run_dir" && sha256sum *.jsonl *.json *.txt *.sha256 *.err >SHA256SUMS) |