#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
use dsfb_gpu_debug_demo::cli;
use std::process::ExitCode;
fn main() -> ExitCode {
let argv: Vec<String> = std::env::args().collect();
let mut args = argv.iter().skip(1).cloned();
let Some(subcommand) = args.next() else {
print_usage();
return ExitCode::from(1);
};
let rest: Vec<String> = args.collect();
match subcommand.as_str() {
"help" | "--help" | "-h" => {
print_usage();
ExitCode::SUCCESS
}
"version" | "--version" | "-V" => {
println!("dsfb-gpu-debug {}", env!("CARGO_PKG_VERSION"));
ExitCode::SUCCESS
}
"generate-fixture" => cli::generate_fixture::parse_and_run(&rest),
"run-cpu" => cli::run_cpu::parse_and_run(&rest),
"run-gpu" => cli::run_gpu::parse_and_run(&rest),
"compare" => cli::compare::parse_and_run(&rest),
"bench" => cli::bench::parse_and_run(&rest),
"bench-gpu-scale" => cli::bench_gpu_scale::parse_and_run(&rest),
"s-real-audit" | "s-real-1-audit" => cli::s_real_audit::parse_and_run(&rest),
other => {
eprintln!("dsfb-gpu-debug: unknown subcommand '{other}'");
print_usage();
ExitCode::from(1)
}
}
}
fn print_usage() {
eprintln!(
"dsfb-gpu-debug {ver}\n\
\n\
Subcommands:\n\
generate-fixture produce the canonical synthetic trace fixture\n\
run-cpu run the CPU reference pipeline (section G)\n\
run-gpu run the CUDA-accelerated pipeline (section H)\n\
compare compare two case files and emit a verdict (section G)\n\
validate-contract recompute input/bank/registry hashes inside contract (section G)\n\
bench measure CPU/GPU pipeline wall-clock (section O onward)\n\
bench-gpu-scale R.7 headline money-table benchmark + reports/money_table.txt\n\
s-real-audit S-REAL real-dataset audit gauntlet (20 sealed fixtures across S-REAL.1/2/3)\n\
`s-real-1-audit` accepted as historical alias\n",
ver = env!("CARGO_PKG_VERSION")
);
}