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: i32Device ID
name: StringDevice name
compute_capability: (i32, i32)Compute capability (major, minor)
total_memory: usizeTotal memory in bytes
free_memory: usizeFree memory in bytes
multiprocessor_count: i32Number of multiprocessors
max_threads_per_block: i32Max threads per block
max_threads_per_mp: i32Max threads per multiprocessor
warp_size: i32Warp size
Shared memory per block
default_stream: CudaStreamDefault stream
memory_pool: Mutex<GpuMemoryPool>Memory pool
Implementations§
Source§impl CudaDevice
impl CudaDevice
Sourcepub fn init() -> CudaResult<()>
pub fn init() -> CudaResult<()>
Initialize CUDA runtime
Sourcepub fn count() -> CudaResult<i32>
pub fn count() -> CudaResult<i32>
Get number of CUDA devices
Sourcepub fn new(device_id: i32) -> CudaResult<Self>
pub fn new(device_id: i32) -> CudaResult<Self>
Create device handle for given device ID
Sourcepub fn set_current(&self) -> CudaResult<()>
pub fn set_current(&self) -> CudaResult<()>
Set current device
Sourcepub fn current() -> CudaResult<i32>
pub fn current() -> CudaResult<i32>
Get current device ID
Sourcepub fn synchronize() -> CudaResult<()>
pub fn synchronize() -> CudaResult<()>
Synchronize device - wait for all operations to complete
Sourcepub fn get_free_memory(&self) -> CudaResult<usize>
pub fn get_free_memory(&self) -> CudaResult<usize>
Get current free memory
Sourcepub fn properties_string(&self) -> String
pub fn properties_string(&self) -> String
Get device properties as string
Sourcepub fn has_tensor_cores(&self) -> bool
pub fn has_tensor_cores(&self) -> bool
Check if device supports tensor cores
Sourcepub fn supports_fp16(&self) -> bool
pub fn supports_fp16(&self) -> bool
Check if device supports FP16
Sourcepub fn supports_bf16(&self) -> bool
pub fn supports_bf16(&self) -> bool
Check if device supports BF16
Sourcepub fn optimal_block_size(&self, shared_mem_per_thread: usize) -> usize
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
impl Debug 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> 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