Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Example: Safe Vectorization Benchmarks

Crate: kwavers
Run: cargo run -p kwavers --example safe_vectorization_benchmarks
Source: crates/kwavers/examples/safe_vectorization_benchmarks.rs

What This Example Demonstrates

This example benchmarks safe vectorized kernels against more traditional implementation patterns. The emphasis is on demonstrating that high-level abstractions can still deliver strong throughput and bandwidth for scientific workloads.

ComponentAPIValue
Benchmark recordBenchmarkResultStores ops/s, bandwidth, relative performance, and numerical error
Benchmark suiteBenchmarkSuiteOrganizes the benchmark categories and collected results
Kernel familiesarray ops / linear algebra / signal processing / physics updatesCovers both general numeric work and simulation-specific kernels

Key Code Snippet

pub struct BenchmarkResult {
    pub test_name: String,
    pub implementation: String,
    pub array_size: usize,
    pub operations_per_second: f64,
    pub memory_bandwidth_gb_per_s: f64,
    pub relative_performance: f64,
    pub accuracy_error: f64,
}

Expected Output (if applicable)

The output is a grouped benchmark report showing throughput, bandwidth, and relative speedups across the tested kernel families.

Book Chapter

← Performance and Memory