#[cfg(not(feature = "cuda"))]
use crate::error::Error;
use crate::error::Result;
use crate::runtime::Device;
pub fn cpu() -> Result<Device> {
Ok(Device::default())
}
#[cfg(feature = "cuda")]
pub fn cuda(index: usize) -> Result<crate::runtime::CudaDevice> {
let _ = index;
Ok(crate::runtime::CudaDevice::default())
}
#[cfg(not(feature = "cuda"))]
pub fn cuda(_index: usize) -> Result<Device> {
Err(Error::Config(
"CUDA is not available. Enable the 'cuda' feature in Cargo.toml:\n\
[dependencies]\n\
multiscreen-rs = { version = \"0.1\", features = [\"cuda\"] }"
.to_string(),
))
}
pub fn auto_device() -> Result<Device> {
cpu()
}