pub struct Device(/* private fields */);Expand description
A CUDA device (a physical GPU, or a logical slice of one under MIG).
Cheap Copy type — it’s just an ordinal.
Implementations§
Source§impl Device
impl Device
Sourcepub fn total_memory(&self) -> Result<u64>
pub fn total_memory(&self) -> Result<u64>
Total global memory on this device, in bytes.
Sourcepub fn compute_capability(&self) -> Result<(u32, u32)>
pub fn compute_capability(&self) -> Result<(u32, u32)>
Compute capability as (major, minor), e.g. (9, 0) for Hopper.
Sourcepub fn multiprocessor_count(&self) -> Result<u32>
pub fn multiprocessor_count(&self) -> Result<u32>
Multiprocessor count (SM count).
Sourcepub fn attribute(&self, attr: i32) -> Result<i32>
pub fn attribute(&self, attr: i32) -> Result<i32>
Query an arbitrary CUdevice_attribute. See
baracuda_cuda_sys::types::CUdevice_attribute for the full list.
Sourcepub fn luid(&self) -> Result<([u8; 8], u32)>
pub fn luid(&self) -> Result<([u8; 8], u32)>
Return the device’s Windows LUID and 32-bit device-node mask (Windows only; Linux returns zeros).
Sourcepub fn p2p_attribute(&self, peer: &Device, attr: i32) -> Result<i32>
pub fn p2p_attribute(&self, peer: &Device, attr: i32) -> Result<i32>
Query a peer-to-peer attribute between self (as source) and
peer (as destination). Pass a constant from
baracuda_cuda_sys::types::CUdevice_P2PAttribute.
Sourcepub fn exec_affinity_support(&self, affinity_type: i32) -> Result<bool>
pub fn exec_affinity_support(&self, affinity_type: i32) -> Result<bool>
Query whether this device supports a given exec-affinity type (e.g. SM-count partitioning at context-creation time).
Sourcepub fn can_access_peer(&self, peer: &Device) -> Result<bool>
pub fn can_access_peer(&self, peer: &Device) -> Result<bool>
true if this device can directly access allocations on peer.
Peer access still requires a matching Context::enable_peer_access
on the accessing side before kernels can dereference peer pointers.
Sourcepub fn primary_ctx_state(&self) -> Result<(u32, bool)>
pub fn primary_ctx_state(&self) -> Result<(u32, bool)>
Query the primary-context state for this device.
Returns (flags, active) — flags is the same bitmask
crate::Context::with_flags takes, active is true if some
caller currently holds a retained primary-context reference.
Sourcepub fn set_primary_ctx_flags(&self, flags: u32) -> Result<()>
pub fn set_primary_ctx_flags(&self, flags: u32) -> Result<()>
Set the flags used when the primary context is later created.
Returns CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE if the primary context
already exists; reset with Context::reset_primary first.