Skip to content

Commit

Permalink
Fix compile error when cuda feature is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
KarelPeeters committed Jan 26, 2024
1 parent f1c8d3d commit f8df592
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kn-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ impl Device {

/// Returns the first available cuda device if any.
pub fn first_cuda() -> Option<Device> {
Some(Device::Cuda(CudaDevice::all().next()?))
#[cfg(feature = "cuda")]
if let Some(device) = CudaDevice::all().next()? {
return Some(Device::Cuda(device));
}

None
}
}

Expand Down

0 comments on commit f8df592

Please sign in to comment.