Skip to main content

cuda_devices

Function cuda_devices 

Source
pub fn cuda_devices() -> Result<Vec<CudaDeviceInfo>, CudaDeviceError>
Expand description

Discover CUDA devices visible to the current process.

Discovery initializes the CUDA driver and queries device ordinals directly. It does not create a CUDA context, CUDA runtime, CubeCL runtime, backend, or client. Device ordinals are process-visible and may change when CUDA_VISIBLE_DEVICES changes. The returned values have deterministic Eq and Debug behavior only while that process-visible topology remains unchanged.

§Errors

Returns CudaDeviceError::Discovery for driver initialization, device enumeration, or device-name lookup failures.

§Examples

use tenferro_gpu::{cuda::cuda_devices, cuda::CudaDeviceError, cuda::CudaDeviceInfo};

let _discover: fn() -> Result<Vec<CudaDeviceInfo>, CudaDeviceError> = cuda_devices;