CUDA Helpers¶
These helpers use NVIDIA's NVML bindings to decide whether a GPU-specific session should run. They are intentionally conservative: if the driver cannot be queried, they report that CUDA is unavailable.
liblaf.nox_recipes.cuda_driver_version
¶
cuda_driver_version() -> int | None
Return the CUDA driver version reported by NVIDIA's NVML library.
Returns:
-
int | None–The integer version returned by
-
int | None–pynvml.nvmlSystemGetCudaDriverVersion_v2(), orNonewhen NVML -
int | None–cannot be initialized or no supported NVIDIA driver is available.
Source code in src/liblaf/nox_recipes/_cuda.py
liblaf.nox_recipes.supports_cuda
¶
Return whether the current machine satisfies a CUDA requirement.
Parameters:
-
(version¶int | None, default:None) –Optional minimum CUDA driver version. When omitted, the function only checks whether any CUDA driver is available.
Returns:
-
bool–Trueif a CUDA driver is present and meets the requested minimum -
bool–version, otherwise
False.