Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
cartan-gpu
Portable wgpu-based GPU compute primitives for the cartan ecosystem.
Part of the cartan workspace, but its own detached Cargo workspace so its wgpu/GPU build deps stay isolated from the rest of the stack.
Precision
WGSL has no f64. It offers f32, i32, u32 and, by extension, f16.
Anything computed through this crate is therefore single precision, while the
rest of cartan is f64 throughout.
That is fine for the workloads GPUs are usually pointed at here, embeddings and visualisation among them, and wrong for the scientific results the rest of the library is built to produce, where agreement is measured at 1e-14. Use the CPU path when the precision matters.
What this crate does
cartan-gpu exposes a small, opinionated GPU surface to the rest of the
cartan stack:
- Device:
wgpu29 adapter + device + queue, enforcing Vulkan backend. - GpuBuffer<T>: typed storage-buffer wrapper with upload (
from_slice) and synchronous readback (to_vec). - Kernel: minimal wgpu compute-pipeline scaffold (single storage buffer at group 0 binding 0). Sufficient for proof-of-life shaders; richer bind groups are wired in downstream crates.
FFT has moved to gpufft. With the fft feature, gpufft is
re-exported as cartan_gpu::gpufft for convenience. The vulkan, cuda,
and shared features gate the corresponding gpufft backends.
Quick start (wgpu compute)
use ;
let dev = new.unwrap;
let n = 512_usize;
let host: = .map.collect;
let buf = from_slice
.unwrap;
let kernel = from_wgsl.unwrap;
kernel.dispatch;
let out = buf.to_vec.unwrap;
FFT (via gpufft)
FFT was extracted to the standalone gpufft
crate in v0.6. Enable the fft (or vulkan / cuda / shared) feature to
pull it in and access it as cartan_gpu::gpufft:
[]
= { = "0.8", = ["vulkan"] }
use ;
use Complex32;
// gpufft owns device creation for FFT work; cartan_gpu::Device is for wgpu compute.
let fft_dev = new.unwrap;
let plan = new.unwrap;
// ... execute plan ...
Migrating from cartan-gpu 0.5
| v0.5 (cartan-gpu) | v0.6 (gpufft) |
|---|---|
cartan_gpu::Fft |
gpufft::Fft |
cartan_gpu::FftDirection |
gpufft::Direction |
cartan_gpu::VkFftBackend |
gpufft::vulkan::VulkanBackend |
cartan_gpu::CuFftBackend |
gpufft::cuda::CudaBackend |
cartan_gpu::UniBuffer |
gpufft::UniBuffer |
cartan_gpu::UniFftBackend |
gpufft::UniFftBackend |
cartan_gpu::SharedMemory |
gpufft::shared::SharedMemory |
cartan_gpu::SharedFftBuffer |
gpufft::shared::SharedFftBuffer |
Replace device.plan_* calls with gpufft::{vulkan,cuda}::*Plan::new(&fft_dev, PlanDesc { ... }).
Features
| Feature | Pulls in | Notes |
|---|---|---|
fft |
gpufft (no backends) |
Re-exports gpufft |
vulkan |
fft + gpufft/vulkan |
Vulkan FFT backend |
cuda |
fft + gpufft/cuda |
CUDA FFT backend |
shared |
vulkan + cuda + gpufft/shared |
Zero-copy Vk↔CUDA (Linux) |
Tests
cargo test --no-default-features --tests
The three remaining integration tests (device_smoke, hello_shader,
buffer_roundtrip) exercise the wgpu compute layer. FFT tests live in
gpufft/tests/.