interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / research / m15 / spbm / collect-c2.sh

71 lines · 3314 bytes Raw Blame History
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
22set -euo pipefail
23cd "$(dirname "$0")"
24if [[ $# != 2 || -e "$1" || ! -x "$2" ]]; then
25 echo "usage: collect-c2.sh NEW-run-directory r15_gpu_load-binary" >&2
26 exit 2
27fi
28run_dir="$1"
29ko="${SPBM_KO:-$PWD/aien_spbm_readonly.ko}" # the loaded module's file
30gpu_load="$(realpath "$2")"
31mkdir -p "$(dirname "$run_dir")"
32mkdir "$run_dir"
33run_dir="$(realpath "$run_dir")"
34pids=()
35cleanup() { for p in "${pids[@]}"; do kill "$p" 2>/dev/null || true; wait "$p" 2>/dev/null || true; done; }
36trap cleanup EXIT
37trap 'exit 130' INT
38trap 'exit 143' TERM
39hwmon=
40for 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
45done
46[[ -n "$hwmon" ]]
47uname -a >"$run_dir/uname.txt"
48nvidia-smi -q >"$run_dir/nvidia-smi.txt"
49mokutil --sb-state >"$run_dir/secure-boot.txt"
50cat /sys/kernel/security/lockdown >"$run_dir/lockdown.txt"
51cat /sys/module/aien_spbm_readonly/srcversion >"$run_dir/loaded-srcversion.txt"
52modinfo "$ko" >"$run_dir/module.txt"
53[[ $(modinfo -F srcversion "$ko") == $(cat "$run_dir/loaded-srcversion.txt") ]]
54git rev-parse HEAD >"$run_dir/base-commit.txt"
55git status --short >"$run_dir/worktree.txt"
56ps -eo pid,comm,pcpu --sort=-pcpu | head -40 >"$run_dir/processes-before.txt"
57sha256sum *.c *.h Makefile collect-c2.sh sample load reduce "$ko" "$gpu_load" \
58 >"$run_dir/source-binary.sha256"
59start_cpu() { ./load p 14 4 >"$run_dir/load-cpu-$1.jsonl" & pids+=($!); }
60start_gpu() { "$gpu_load" claims 14 >"$run_dir/load-gpu-$1.jsonl" 2>"$run_dir/load-gpu-$1.err" & pids+=($!); }
61finish() { for p in "${pids[@]}"; do wait "$p"; done; pids=(); }
62for 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
68done
69./reduce "$run_dir" idle cpu gpu both >"$run_dir/summary.json"
70printf '%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)