Skip to main content

Crate baracuda

Crate baracuda 

Source
Expand description

baracuda — idiomatic Rust wrappers for the NVIDIA CUDA stack.

Umbrella crate. Re-exports individual safe-API crates behind Cargo features. All features are opt-in; defaults enable just driver + runtime so downstream consumers pay for only what they use.

§Feature matrix

FeatureRe-exports
driverdriver — CUDA Driver API
runtimeruntime — CUDA Runtime API
nvrtc[nvrtc] — runtime C++→PTX compiler
nvjitlink[nvjitlink] — CUDA 12+ JIT linker
cublas[cublas] — BLAS
curand[curand] — RNG
cufft[cufft] — FFT
cusparse[cusparse] — sparse linear algebra
cusolver[cusolver] — dense/sparse solvers
cudnn[cudnn] — deep-learning primitives
nccl[nccl] — multi-GPU collectives
npp[npp] — performance primitives
nvjpeg[nvjpeg] — GPU JPEG codec
nvcomp[nvcomp] — GPU compression (scaffolding)
cvcuda[cvcuda] — CV-CUDA (scaffolding)
nvml[nvml] — driver-bundled GPU monitoring
cufile[cufile] — GPUDirect Storage (Linux only)

Bundles: math = cuBLAS + cuRAND + cuFFT + cuSPARSE + cuSOLVER; imaging = NPP + nvJPEG + CV-CUDA; ml = driver + runtime + nvrtc + nvjitlink + math + cuDNN + NCCL; full = ml + imaging + nvcomp + nvml + cufile.

§Quickstart

[dependencies]
baracuda = "0.1"
use baracuda::driver::{Context, Device, DeviceBuffer};
let device = Device::get(0)?;
let ctx = Context::new(&device)?;
let data = DeviceBuffer::from_slice(&ctx, &[1.0f32, 2.0, 3.0])?;

§Shared vocabulary

types (always available, no feature flag) exposes Half, BFloat16, Complex32, Complex64, DeviceRepr, CudaVersion, etc. — the types shared across every safe crate.

§Building your own kernels

baracuda wraps the runtime side of CUDA — launching kernels, managing memory, calling library APIs. To compile your own .cu files into a linkable library or PTX from build.rs, add the sibling crate baracuda-forge to your [build-dependencies]. It handles nvcc invocation, incremental rebuilds, parallel compilation, and CUTLASS integration.

§Acknowledgments

baracuda-forge is a vendored fork of cudaforge by Guoqing Bao, adapted to baracuda’s workspace conventions. Big thanks to Guoqing for releasing cudaforge under permissive terms.

Re-exports§

pub use baracuda_types as types;
pub use baracuda_driver as driver;
pub use baracuda_runtime as runtime;