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.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 | # Preliminary sensor validation, not an R15 qualification or PASS receipt. |
| 18 | set -euo pipefail |
| 19 | cd "$(dirname "$0")" |
| 20 | if [[ $# != 1 || -e "$1" ]]; then |
| 21 | echo "usage: collect.sh NEW-run-directory" >&2 |
| 22 | exit 2 |
| 23 | fi |
| 24 | run_dir="$1" |
| 25 | mkdir -p "$(dirname "$run_dir")" |
| 26 | mkdir "$run_dir" |
| 27 | run_dir="$(realpath "$run_dir")" |
| 28 | work_pid= |
| 29 | cleanup() { if [[ -n "$work_pid" ]]; then kill "$work_pid" 2>/dev/null || true; wait "$work_pid" 2>/dev/null || true; fi; } |
| 30 | trap cleanup EXIT |
| 31 | trap 'exit 130' INT |
| 32 | trap 'exit 143' TERM |
| 33 | hwmon= |
| 34 | for h in /sys/class/hwmon/hwmon*; do |
| 35 | if [[ $(cat "$h/name") == aien_spbm ]]; then |
| 36 | if [[ -n "$hwmon" ]]; then echo "ambiguous SPBM device" >&2; exit 1; fi |
| 37 | hwmon="$h" |
| 38 | fi |
| 39 | done |
| 40 | [[ -n "$hwmon" ]] |
| 41 | make tools check >"$run_dir/build.log" 2>&1 |
| 42 | uname -a >"$run_dir/uname.txt" |
| 43 | nvidia-smi -q >"$run_dir/nvidia-smi.txt" |
| 44 | mokutil --sb-state >"$run_dir/secure-boot.txt" |
| 45 | modinfo aien_spbm_readonly.ko >"$run_dir/module.txt" |
| 46 | cat /sys/module/aien_spbm_readonly/srcversion >"$run_dir/loaded-srcversion.txt" |
| 47 | [[ $(modinfo -F srcversion aien_spbm_readonly.ko) == $(cat "$run_dir/loaded-srcversion.txt") ]] |
| 48 | git rev-parse HEAD >"$run_dir/base-commit.txt" |
| 49 | git status --short >"$run_dir/worktree.txt" |
| 50 | ps -eo pid,comm,pcpu --sort=-pcpu >"$run_dir/processes-before.txt" |
| 51 | sudo -n cat /sys/firmware/acpi/tables/DSDT >"$run_dir/DSDT.dat" |
| 52 | cat /sys/devices/virtual/dmi/id/bios_version >"$run_dir/bios.txt" |
| 53 | cat /sys/devices/virtual/dmi/id/bios_date >>"$run_dir/bios.txt" |
| 54 | sha256sum *.c *.h Makefile collect.sh sample load reduce aien_spbm_readonly.ko >"$run_dir/source-binary.sha256" |
| 55 | for round in 1 2 3; do |
| 56 | ./sample "$hwmon" 10 "$run_dir/idle-$round.jsonl" |
| 57 | for group in p e; do |
| 58 | ./load "$group" 14 >"$run_dir/load-$group-$round.jsonl" & |
| 59 | work_pid=$! |
| 60 | sleep 2 |
| 61 | ./sample "$hwmon" 10 "$run_dir/$group-$round.jsonl" |
| 62 | wait "$work_pid" |
| 63 | work_pid= |
| 64 | done |
| 65 | done |
| 66 | ./reduce "$run_dir" >"$run_dir/summary.json" |
| 67 | printf '%s\n' '{"collection_complete":true,"qualified":false,"R15_PASS":false}' >"$run_dir/status.json" |
| 68 | (cd "$run_dir" && sha256sum *.jsonl *.json *.txt *.log *.sha256 DSDT.dat >SHA256SUMS) |