Support for UG kernels. (#2579)

* Support for UG kernels.

* Add a dedicated test.
This commit is contained in:
Laurent Mazare
2024-10-27 13:37:19 +01:00
committed by GitHub
parent 37e0ab8c64
commit 594d984f9c
8 changed files with 139 additions and 2 deletions

View File

@ -130,6 +130,14 @@ impl Device {
Ok(Self::Cuda(crate::CudaDevice::new(ordinal)?))
}
pub fn as_cuda_device(&self) -> Result<&crate::CudaDevice> {
match self {
Self::Cuda(d) => Ok(d),
Self::Cpu => crate::bail!("expected a cuda device, got cpu"),
Self::Metal(_) => crate::bail!("expected a cuda device, got Metal"),
}
}
pub fn new_cuda_with_stream(ordinal: usize) -> Result<Self> {
Ok(Self::Cuda(crate::CudaDevice::new_with_stream(ordinal)?))
}