benchmarks-mv
Measurement harnesses and evidence bundles for AIEN on the NVIDIA DGX Spark GB10. Speed is reported against the machine's physical limit and my own previous run. Attachment of AienOS.
Brought by drakestapleton
benchmarks-mv / tests / orig3_judge.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | //! The native ORIG-3 judge reproduces the committed `judge.out` byte for byte from the |
| 17 | //! committed sealed per-record files, and refuses malformed input. |
| 18 | |
| 19 | use std::fs; |
| 20 | use std::path::Path; |
| 21 | use std::process::Command; |
| 22 | |
| 23 | const ROOT: &str = env!("CARGO_MANIFEST_DIR"); |
| 24 | const EVIDENCE: &str = "evidence/ORIG3-SELECTOR"; |
| 25 | |
| 26 | fn run(args: &[&Path]) -> (i32, String, String) { |
| 27 | let out = Command::new(env!("CARGO_BIN_EXE_bench_orig3_judge")) |
| 28 | .args(args) |
| 29 | .output() |
| 30 | .expect("run bench_orig3_judge"); |
| 31 | ( |
| 32 | out.status.code().expect("exit code"), |
| 33 | String::from_utf8(out.stdout).expect("utf-8 stdout"), |
| 34 | String::from_utf8(out.stderr).expect("utf-8 stderr"), |
| 35 | ) |
| 36 | } |
| 37 | |
| 38 | #[test] |
| 39 | fn committed_sealed_evidence_reproduces_judge_out() { |
| 40 | let dir = Path::new(ROOT).join(EVIDENCE); |
| 41 | let files: Vec<_> = ["mlp", "affine", "shuffled", "untrained"] |
| 42 | .iter() |
| 43 | .map(|a| dir.join(format!("sealed-{a}.records"))) |
| 44 | .collect(); |
| 45 | let refs: Vec<&Path> = files.iter().map(Path::new).collect(); |
| 46 | let (code, stdout, _) = run(&refs); |
| 47 | let want = fs::read_to_string(dir.join("judge.out")).expect("read judge.out"); |
| 48 | assert_eq!(stdout, want); |
| 49 | assert_eq!(code, 0); |
| 50 | assert!(stdout.ends_with("ORIG3_VERDICT=INCONCLUSIVE\n")); |
| 51 | } |
| 52 | |
| 53 | #[test] |
| 54 | fn refuses_malformed_line() { |
| 55 | let dir = Path::new(ROOT).join(EVIDENCE); |
| 56 | let tmp = std::env::temp_dir().join(format!("orig3-judge-bad-{}.records", std::process::id())); |
| 57 | fs::write(&tmp, "1 2 0 4 4 4 2 0 4 4 4 1 1 1 1 1\n").unwrap(); |
| 58 | let good = dir.join("sealed-mlp.records"); |
| 59 | let (code, stdout, stderr) = run(&[&tmp, &good, &good, &good]); |
| 60 | fs::remove_file(&tmp).ok(); |
| 61 | assert_eq!(code, 2); |
| 62 | assert_eq!(stdout, ""); |
| 63 | assert!(stderr.contains("16 columns, want 17")); |
| 64 | } |