pub struct GpuUtils { /* private fields */ }Expand description
GPU computing utilities
Implementations§
Source§impl GpuUtils
impl GpuUtils
Sourcepub fn init_devices(&mut self) -> Result<(), GpuError>
pub fn init_devices(&mut self) -> Result<(), GpuError>
Initialize GPU devices
Sourcepub fn get_devices(&self) -> &[GpuDevice]
pub fn get_devices(&self) -> &[GpuDevice]
Get available GPU devices
Sourcepub fn get_device(&self, id: u32) -> Option<&GpuDevice>
pub fn get_device(&self, id: u32) -> Option<&GpuDevice>
Get device by ID
Sourcepub fn get_best_device(&self) -> Option<&GpuDevice>
pub fn get_best_device(&self) -> Option<&GpuDevice>
Get best device for ML workloads
Sourcepub fn allocate_memory(
&self,
size: u64,
device_id: u32,
name: &str,
) -> Result<u64, GpuError>
pub fn allocate_memory( &self, size: u64, device_id: u32, name: &str, ) -> Result<u64, GpuError>
Allocate GPU memory
Sourcepub fn get_memory_stats(&self) -> HashMap<u32, MemoryStats>
pub fn get_memory_stats(&self) -> HashMap<u32, MemoryStats>
Get memory usage statistics
Sourcepub fn execute_kernel(
&self,
kernel: &GpuKernelInfo,
) -> Result<GpuKernelExecution, GpuError>
pub fn execute_kernel( &self, kernel: &GpuKernelInfo, ) -> Result<GpuKernelExecution, GpuError>
Execute GPU kernel
Sourcepub fn get_kernel_history(&self) -> Vec<GpuKernelExecution>
pub fn get_kernel_history(&self) -> Vec<GpuKernelExecution>
Get kernel execution history
Sourcepub fn get_performance_counters(&self) -> HashMap<String, f64>
pub fn get_performance_counters(&self) -> HashMap<String, f64>
Get performance counters
Sourcepub fn update_counter(&self, name: &str, value: f64)
pub fn update_counter(&self, name: &str, value: f64)
Update performance counter
Sourcepub fn estimate_throughput(
&self,
device_id: u32,
array_size: usize,
operation: &str,
) -> f64
pub fn estimate_throughput( &self, device_id: u32, array_size: usize, operation: &str, ) -> f64
Get throughput estimate for array operations
Sourcepub fn should_use_gpu(&self, array_size: usize, operation: &str) -> bool
pub fn should_use_gpu(&self, array_size: usize, operation: &str) -> bool
Check if operation should use GPU
Sourcepub fn get_utilization(&self) -> HashMap<u32, f64>
pub fn get_utilization(&self) -> HashMap<u32, f64>
Get GPU utilization
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpuUtils
impl RefUnwindSafe for GpuUtils
impl Send for GpuUtils
impl Sync for GpuUtils
impl Unpin for GpuUtils
impl UnwindSafe for GpuUtils
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