diff --git a/kn-runtime/src/lib.rs b/kn-runtime/src/lib.rs index c338488..e7410bc 100644 --- a/kn-runtime/src/lib.rs +++ b/kn-runtime/src/lib.rs @@ -107,7 +107,12 @@ impl Device { /// Returns the first available cuda device if any. pub fn first_cuda() -> Option { - Some(Device::Cuda(CudaDevice::all().next()?)) + #[cfg(feature = "cuda")] + if let Some(device) = CudaDevice::all().next()? { + return Some(Device::Cuda(device)); + } + + None } }