1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Unified GPU-accelerated FFT for Rust.
//!
//! `gpufft` exposes a single trait surface that works the same across
//! multiple GPU backends. Backends are selected at build time via Cargo
//! features; at least one must be enabled.
//!
//! | Feature | Backend module | Underlying library |
//! |----------|----------------------|--------------------|
//! | `vulkan` | [`vulkan`] | VkFFT (vendored) |
//! | `cuda` | `cuda` (when enabled)| cuFFT (system) |
//!
//! # Quick start
//!
//! ```no_run
//! # #[cfg(feature = "vulkan")]
//! # fn demo() -> Result<(), Box<dyn std::error::Error>> {
//! use gpufft::{
//! vulkan::VulkanBackend, BufferOps, C2cPlanOps, Device, Direction, PlanDesc, Shape,
//! };
//! use num_complex::Complex32;
//!
//! let device = VulkanBackend::new_device(Default::default())?;
//! let mut buffer = device.alloc::<Complex32>(1024)?;
//! buffer.write(&vec![Complex32::default(); 1024])?;
//!
//! let mut plan = device.plan_c2c::<Complex32>(&PlanDesc {
//! shape: Shape::D1(1024),
//! batch: 1,
//! normalize: false,
//! })?;
//! plan.execute(&mut buffer, Direction::Forward)?;
//! # Ok(())
//! # }
//! ```
//!
//! # Transform kinds
//!
//! Each backend exposes three plan types, constructed through distinct
//! device methods:
//!
//! | Method | Trait | Use |
//! |----------------------------------|---------------------------------|-----------------------------------|
//! | [`Device::plan_c2c`] | [`C2cPlanOps`] | complex-to-complex, in-place |
//! | [`Device::plan_r2c`] | [`R2cPlanOps`] | real-to-complex, forward only |
//! | [`Device::plan_c2r`] | [`C2rPlanOps`] | complex-to-real, inverse only |
//!
//! R2C output buffers and C2R input buffers are Hermitian-symmetric
//! half-spectra (last dimension `n / 2 + 1`), matching VkFFT and cuFFT
//! conventions. Use [`Shape::complex_half_elements`] to size them.
//!
//! Buffers and plans are typed by their backend, so feeding a Vulkan buffer
//! into a CUDA plan is a compile error.
pub use ;
pub use Error;
pub use ;
pub use ;