CudaDevice

Struct CudaDevice 

Source
pub struct CudaDevice {
    pub id: i32,
    pub name: String,
    pub compute_capability: (i32, i32),
    pub total_memory: usize,
    pub free_memory: usize,
    pub multiprocessor_count: i32,
    pub max_threads_per_block: i32,
    pub max_threads_per_mp: i32,
    pub warp_size: i32,
    pub shared_mem_per_block: usize,
    pub default_stream: CudaStream,
    pub memory_pool: Mutex<GpuMemoryPool>,
}
Expand description

CUDA device handle with real device properties

Fields§

§id: i32

Device ID

§name: String

Device name

§compute_capability: (i32, i32)

Compute capability (major, minor)

§total_memory: usize

Total memory in bytes

§free_memory: usize

Free memory in bytes

§multiprocessor_count: i32

Number of multiprocessors

§max_threads_per_block: i32

Max threads per block

§max_threads_per_mp: i32

Max threads per multiprocessor

§warp_size: i32

Warp size

§shared_mem_per_block: usize

Shared memory per block

§default_stream: CudaStream

Default stream

§memory_pool: Mutex<GpuMemoryPool>

Memory pool

Implementations§

Source§

impl CudaDevice

Source

pub fn init() -> CudaResult<()>

Initialize CUDA runtime

Source

pub fn count() -> CudaResult<i32>

Get number of CUDA devices

Source

pub fn new(device_id: i32) -> CudaResult<Self>

Create device handle for given device ID

Source

pub fn set_current(&self) -> CudaResult<()>

Set current device

Source

pub fn current() -> CudaResult<i32>

Get current device ID

Source

pub fn synchronize() -> CudaResult<()>

Synchronize device - wait for all operations to complete

Source

pub fn get_free_memory(&self) -> CudaResult<usize>

Get current free memory

Source

pub fn properties_string(&self) -> String

Get device properties as string

Source

pub fn has_tensor_cores(&self) -> bool

Check if device supports tensor cores

Source

pub fn supports_fp16(&self) -> bool

Check if device supports FP16

Source

pub fn supports_bf16(&self) -> bool

Check if device supports BF16

Source

pub fn optimal_block_size(&self, shared_mem_per_thread: usize) -> usize

Get optimal block size for a kernel

Trait Implementations§

Source§

impl Debug for CudaDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for CudaDevice

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V