//! Run the Vulkan probes (bandwidth, launch overhead) against the //! first discrete-compute device on this host. Pretty-print results. //! //! Phase C verification harness. The signing path is not exercised //! here — the goal is to confirm the probes return sane numbers on //! real hardware before they get folded into the full appraise CLI. use everycycle_appraise::enumerate::enumerate; use everycycle_appraise::probe::{ BandwidthError, LaunchError, TimingSource, VulkanContext, VulkanContextError, measure_bandwidth, measure_launch_overhead, }; fn main() { let host = match enumerate() { Ok(h) => h, Err(e) => { eprintln!("enumeration failed: {e}"); std::process::exit(1); } }; let Some(device) = host.devices.first() else { eprintln!("no discrete-compute devices found"); std::process::exit(1); }; eprintln!("host: {}", host.host.hostname); eprintln!("device: {} @ {}", device.device_name, device.bus_address); eprintln!("driver: {}", device.driver_version); eprintln!(); let ctx = match VulkanContext::new(&device.bus_address) { Ok(c) => c, Err(e) => { eprintln!("vulkan context bring-up failed: {}", render_ctx_err(&e)); std::process::exit(1); } }; eprintln!("running launch-overhead probe ..."); match measure_launch_overhead(&ctx) { Ok(r) => { eprintln!(" null launch: {:>10.1} ns", r.null_launch_ns); eprintln!(" memcpy 1MiB: {:>10.1} ns", r.memcpy_1mib_ns); } Err(e) => eprintln!(" failed: {}", render_launch_err(&e)), } eprintln!(); eprintln!("running bandwidth probe ..."); match measure_bandwidth(&ctx) { Ok(r) => { eprintln!(" read: {:>7.1} GB/s", r.read_bps / 1e9); eprintln!(" write: {:>7.1} GB/s", r.write_bps / 1e9); eprintln!(" clock: {}", timing_label(r.timing)); } Err(e) => eprintln!(" failed: {}", render_bw_err(&e)), } } fn timing_label(t: TimingSource) -> &'static str { match t { TimingSource::DeviceTimestamps => "device timestamps", TimingSource::HostWallClock => "host wall clock (lower bound)", } } fn render_ctx_err(e: &VulkanContextError) -> String { format!("{e:?}") } fn render_launch_err(e: &LaunchError) -> String { format!("{e:?}") } fn render_bw_err(e: &BandwidthError) -> String { format!("{e:?}") }