Skip to main content

cuda_host

Function cuda_host 

Source
pub fn cuda_host() -> Option<CudaHost>
Expand description

Host-wide CUDA properties, or None when NVML is unavailable — no NVIDIA driver, the nvidia feature disabled, no device, or a driver reporting values that aren’t usable.

Shares the one process-wide NVML handle with detect, so calling this on a timer does not accumulate resources.

use gpu_probe::ComputeCapability;

if let Some(cuda) = gpu_probe::cuda_host() {
    println!("sm_{}{} on CUDA {}",
        cuda.compute_capability.major,
        cuda.compute_capability.minor,
        cuda.driver_version);

    if cuda.compute_capability >= ComputeCapability::new(8, 0) {
        // pick an Ampere-or-newer build
    }
}