Struct kn_cuda_sys::wrapper::handle::CudaDevice
source · pub struct CudaDevice(/* private fields */);Expand description
A cuda device index.
This crate tries to eliminate the global “current device” cuda state:
Every cuda call that depends on the device should be preceded by device.switch_to(),
which corresponds to cudaSetDevice.
Implementations§
source§impl CudaDevice
impl CudaDevice
pub fn new(device: i32) -> Result<Self, CudaDeviceNotAvailable>
pub fn all() -> impl Iterator<Item = Self>
pub unsafe fn current() -> CudaDevice
pub fn inner(self) -> i32
pub fn switch_to(self)
pub fn alloc(self, len_bytes: usize) -> DevicePtr
pub fn properties(self) -> cudaDeviceProp
pub fn attribute(self, attribute: cudaDeviceAttr) -> i32
pub fn compute_capability(self) -> ComputeCapability
pub fn name(self) -> String
Trait Implementations§
source§impl Clone for CudaDevice
impl Clone for CudaDevice
source§fn clone(&self) -> CudaDevice
fn clone(&self) -> CudaDevice
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for CudaDevice
impl Debug for CudaDevice
source§impl Hash for CudaDevice
impl Hash for CudaDevice
source§impl PartialEq for CudaDevice
impl PartialEq for CudaDevice
source§fn eq(&self, other: &CudaDevice) -> bool
fn eq(&self, other: &CudaDevice) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl Copy for CudaDevice
impl Eq for CudaDevice
impl StructuralPartialEq for CudaDevice
Auto Trait Implementations§
impl Freeze for CudaDevice
impl RefUnwindSafe for CudaDevice
impl Send for CudaDevice
impl Sync for CudaDevice
impl Unpin for CudaDevice
impl UnwindSafe for CudaDevice
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more