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 duplicate 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
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more