Skip to main content

GpuMonitor

Trait GpuMonitor 

Source
pub trait GpuMonitor: Send + Sync {
    // Required methods
    fn gpu_count(&self) -> usize;
    fn snapshot<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<GpuSnapshot>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Abstraction over a source of GPU telemetry.

Implementors must be Send + Sync so that the monitor can be shared across tasks behind an Arc.

Required Methods§

Source

fn gpu_count(&self) -> usize

The number of GPUs this monitor is tracking.

This is the value at construction time; implementations that support hot-plug / hot-unplug (such as MockGpuMonitor for test scenarios) may return a different value after the monitor has been mutated.

Source

fn snapshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<GpuSnapshot>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Take a snapshot of all GPUs currently visible to this monitor.

Implementors§