Expand description
Safe Rust wrappers for NVIDIA cuFFT.
v0.1 covers cufftPlan1d/cufftPlan2d/cufftPlan3d and the R2C/C2R/C2C
single-precision transforms. Multi-GPU (cufftXt) and batched
descriptor-style plans land in a follow-up.
use baracuda_driver::{Context, Device, DeviceBuffer};
use baracuda_cufft::{Plan1d, Transform};
let device = Device::get(0)?;
let ctx = Context::new(&device)?;
let host: Vec<f32> = (0..1024).map(|i| (i as f32 * 0.05).sin()).collect();
let mut d_in = DeviceBuffer::from_slice(&ctx, &host)?;
let mut d_out: DeviceBuffer<baracuda_types::Complex32> =
DeviceBuffer::new(&ctx, host.len() / 2 + 1)?;
let plan = Plan1d::new(host.len() as i32, Transform::R2C, 1)?;
plan.exec_r2c(&mut d_in, &mut d_out)?;Modules§
- callback
- Pre/post callbacks attached to a cuFFT plan via the
cufftXt*callback entry points. The callback ABI is fixed by NVIDIA: each callback receives the input/output element index, a caller-info pointer, and the data; see the cuFFT reference for the exact signatures by callback type. We expose only the raw setters because the function-pointer types are PTX-shaped, not regularextern "C"functions — they ship as device-side__device__functions linked into the user’s CUBIN. - xt
- Multi-GPU (XT) extension helpers. Use these to distribute a cuFFT
plan across multiple GPUs via
cufftXtSetGPUs+cufftXtExec.
Structs§
- Plan
- Generic cuFFT plan that supports the modern two-step creation flow:
Plan::creategets you a fresh handle, then one of themake_plan_*methods configures the rank and reports the workspace size — useful when you want to allocate the work area yourself (call [set_auto_allocation(false)] beforemake_plan_*). - Plan1d
- A 1-D cuFFT plan.
- Plan2d
- A 2-D cuFFT plan.
- Plan3d
- Owned 3-D cuFFT plan.
- Plan
Many - A batched / many-rank plan (
cufftPlanMany). Handles arbitrary rank + advanced-data-layout transforms.
Enums§
Functions§
- estimate_
1d - Sizing estimates (workspace bytes) for a plan shape.
- estimate_
2d - 2-D workspace-size estimate (bytes) for a plan of the given shape.
Wraps
cufftEstimate2d. - estimate_
3d - 3-D workspace-size estimate (bytes) for a plan of the given shape.
Wraps
cufftEstimate3d. - get_
size - Scratch bytes this plan currently needs.
- set_
auto_ allocation - Disable / re-enable automatic work-area allocation.
- set_
work_ ⚠area - Set a user-allocated scratch work area (
cufftSetWorkArea). - version
- cuFFT library version, e.g.
11300for cuFFT 11.3.0.