Skip to main content

Crate tenferro_gpu

Crate tenferro_gpu 

Source
Expand description

GPU backend implementations for tenferro tensors.

§Examples

#[cfg(feature = "cuda")]
use tenferro_gpu::{cuda::cuda_devices, cuda::CudaEngine};

#[cfg(feature = "cuda")]
fn first_cuda_backend() -> Result<Option<CudaEngine>, Box<dyn std::error::Error>> {
    let devices = cuda_devices()?;
    let Some(device) = devices.first() else {
        return Ok(None);
    };
    Ok(Some(CudaEngine::open(device.id())?))
}

// This ordinary doctest checks the discovery-based selection API without
// requiring CUDA hardware at test time.
#[cfg(feature = "cuda")]
let _example: fn() -> Result<Option<CudaEngine>, Box<dyn std::error::Error>> = first_cuda_backend;

Modules§

cuda
The CUDA backend: one engine over t4a-cuda-runtime and the t4a-cuda-kernels catalogue (issue #2208).
gpu
Backend-neutral GPU seam: storage identity, the allocation a buffer carries, and the failure vocabulary every GPU backend reports through.