Skip to main content

try_driver

Function try_driver 

Source
pub fn try_driver() -> CudaResult<&'static DriverApi>
Expand description

Get a reference to the lazily-loaded CUDA driver API function table.

On the first call, this function dynamically loads the CUDA shared library and resolves all required symbols. Subsequent calls return the cached result with only an atomic load.

§Errors

Returns CudaError::NotInitialized if the driver could not be loaded — for instance, on macOS, or on a system without an NVIDIA GPU driver installed.

§Examples

let api = try_driver()?;
let result = unsafe { (api.cu_init)(0) };