Skip to main content

Crate zer_compute

Crate zer_compute 

Source
Expand description

zer-compute, hardware-accelerated backend for entity resolution.

Provides DeviceComparator and DeviceScorer as drop-in replacements for the CPU-only counterparts in zer-compare. Both implement the same zer_core::traits::Comparator and zer_core::traits::Scorer traits, so the rest of the pipeline is backend-agnostic.

§Backend selection

use std::sync::Arc;
use zer_compute::{GpuBackend, DeviceComparator, DeviceScorer};
use zer_core::schema::{FieldKind, SchemaBuilder};

let schema = SchemaBuilder::new()
    .field("naam",  FieldKind::Name)
    .field("datum", FieldKind::Date)
    .build()
    .unwrap();

// Auto-detect: tries CUDA → AVX2 → CPU in order.
let backend    = Arc::new(GpuBackend::auto_detect());
let comparator = DeviceComparator::new(Arc::clone(&backend), &schema).unwrap();
let scorer     = DeviceScorer::new(Arc::clone(&backend));

§Feature flags

FlagDescription
cudaNVIDIA CUDA via cudarc, requires CUDA Toolkit 13.1+ and nvcc at build time
vulkanVulkan 1.3 compute via ash, requires slangc on PATH at build time
avx2x86_64 AVX2 SIMD via std::arch, no external toolchain required
cpuExplicit scalar CPU path backed by zer-compare (Rayon parallel)
debug-shadersEmbed debug info in compiled CUDA kernels for cuda-gdb / Nsight stepping

When no flag is set the crate compiles and runs normally using the always-available scalar CPU fallback backed by zer-compare.

Re-exports§

pub use backend::BackendPreference;
pub use backend::DeviceBackend;
pub use backend::GpuBackend;
pub use batch_sizer::BatchSizer;
pub use comparator::DeviceComparator;
pub use error::GpuError;
pub use scorer::DeviceScorer;

Modules§

backend
Backend abstraction, DeviceBackend enum, BackendPreference, and auto-detection logic.
batch_sizer
Auto-tunes the GPU batch size from available VRAM using the exact buffer layout.
comparator
DeviceComparator, implements the Comparator trait.
error
kernel
Core trait definitions for the kernel dispatch system.
kernels
Typed kernel descriptors, one module per compute operation.
scorer
DeviceScorer, implements the Scorer trait with GPU-accelerated EM.
soa