Skip to main content

Module gpu_bench

Module gpu_bench 

Source
Expand description

Performance benchmarks comparing CPU, wgpu, and CUDA backends.

This module measures throughput for the core compute kernels (SPH density, LBM collision, parallel scan) across available backends and reports wall-clock timing and effective GFLOP/s estimates.

§Quick usage

use oxiphysics_gpu::gpu_bench::{GpuBenchHarness, BackendKind};

let mut h = GpuBenchHarness::new();

// Benchmark SPH density summation for 256 particles
let reports = h.bench_sph_density(256);
for r in &reports {
    println!("{}", r);
}

// Compare available backends
let available = GpuBenchHarness::available_backends();
assert!(available.contains(&BackendKind::Cpu));

Structs§

CudaSpeedupReport
Computed speedup between a CPU and a CUDA benchmark report.
GpuBenchHarness
Timing harness for GPU/CPU backend comparison benchmarks.
GpuBenchReport
Result of a single GPU benchmark run.
SpeedupReport
Computed speedup between a CPU and a wgpu benchmark report.

Enums§

BackendKind
Identifies a compute backend for benchmark reporting.

Functions§

compute_cuda_speedup
Compute a speedup ratio from a pair of bench reports produced by GpuBenchHarness::cpu_vs_cuda_sph.
compute_speedup
Compute a speedup ratio from a pair of bench reports.
inclusive_scan_cpu
Sequential inclusive prefix scan (Σ) on f64 elements.