pub struct Device(/* private fields */);Expand description
A CUDA device (Runtime API view — a bare ordinal).
Implementations§
Source§impl Device
impl Device
Sourcepub const fn from_ordinal(ordinal: u32) -> Self
pub const fn from_ordinal(ordinal: u32) -> Self
Construct a Device for the given ordinal. Does not validate — use
Device::all if you want a checked enumeration.
Sourcepub fn set_current(&self) -> Result<()>
pub fn set_current(&self) -> Result<()>
Set this device as current on the calling thread. Subsequent Runtime API calls (allocations, launches, …) operate on this device.
Sourcepub fn compute_capability(&self) -> Result<(u32, u32)>
pub fn compute_capability(&self) -> Result<(u32, u32)>
Compute capability as (major, minor).
Sourcepub fn multiprocessor_count(&self) -> Result<u32>
pub fn multiprocessor_count(&self) -> Result<u32>
Multiprocessor count.
Sourcepub fn attribute(&self, attr: i32) -> Result<i32>
pub fn attribute(&self, attr: i32) -> Result<i32>
Raw device-attribute query. See baracuda_cuda_sys::runtime::types::cudaDeviceAttr.
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 peer-access peer’s allocations (P2P).
Call Device::enable_peer_access before actually using peer
pointers in kernels.
Sourcepub fn enable_peer_access(peer: &Device) -> Result<()>
pub fn enable_peer_access(peer: &Device) -> Result<()>
Enable peer access from the current device to peer’s
allocations. Call Device::set_current() on the accessing device
first.
Sourcepub fn disable_peer_access(peer: &Device) -> Result<()>
pub fn disable_peer_access(peer: &Device) -> Result<()>
Disable peer access previously enabled via
Device::enable_peer_access.