use cubecl_common::device::{Device, DeviceId};
pub const CUDA_MAX_BINDINGS: u32 = 1024;
#[derive(new, Clone, PartialEq, Eq, Default, Hash)]
pub struct CudaDevice {
pub index: usize,
}
impl core::fmt::Debug for CudaDevice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Cuda({})", self.index)
}
}
impl Device for CudaDevice {
fn from_id(device_id: DeviceId) -> Self {
Self {
index: device_id.index_id as usize,
}
}
fn to_id(&self) -> DeviceId {
DeviceId {
type_id: 0,
index_id: self.index as u16,
}
}
}