pub struct MultiGpuScheduler { /* private fields */ }Expand description
Implementations§
Source§impl MultiGpuScheduler
impl MultiGpuScheduler
Sourcepub fn new(
devices: Vec<(Arc<GpuDevice>, f32)>,
strategy: LoadBalanceStrategy,
) -> Result<Self>
pub fn new( devices: Vec<(Arc<GpuDevice>, f32)>, strategy: LoadBalanceStrategy, ) -> Result<Self>
Create a new scheduler from a list of (device, weight) pairs.
§Errors
Returns GpuError::NotSupported if devices is empty.
Sourcepub fn equal_weight(devices: Vec<Arc<GpuDevice>>) -> Result<Self>
pub fn equal_weight(devices: Vec<Arc<GpuDevice>>) -> Result<Self>
Create a scheduler from a list of devices with equal weights using the
default LeastLoaded strategy.
§Errors
Returns an error if devices is empty.
Sourcepub fn device_count(&self) -> usize
pub fn device_count(&self) -> usize
Number of devices managed by this scheduler.
Sourcepub fn select_device(&self) -> usize
pub fn select_device(&self) -> usize
Select the best device slot index for the next frame according to the current strategy.
Sourcepub fn dispatch<F, T>(&self, work_fn: F) -> Result<(T, usize)>
pub fn dispatch<F, T>(&self, work_fn: F) -> Result<(T, usize)>
Dispatch a frame to the best available device.
Returns the index of the selected device slot.
The work_fn closure receives the selected GpuDevice and performs
the actual GPU work. On success the measured latency (in seconds) is
reported via on_complete; on failure on_failure is called.
Sourcepub fn device_stats(&self) -> Vec<DeviceStats>
pub fn device_stats(&self) -> Vec<DeviceStats>
Get a snapshot of per-device statistics.
Sourcepub fn total_dispatched(&self) -> u64
pub fn total_dispatched(&self) -> u64
Total frames dispatched across all devices.
Sourcepub fn total_completed(&self) -> u64
pub fn total_completed(&self) -> u64
Total frames completed (successfully) across all devices.
Sourcepub fn slot(&self, index: usize) -> Option<&DeviceSlot>
pub fn slot(&self, index: usize) -> Option<&DeviceSlot>
Get a reference to the device slot at index.
Returns None if the index is out of range.
Auto Trait Implementations§
impl !Freeze for MultiGpuScheduler
impl !RefUnwindSafe for MultiGpuScheduler
impl Send for MultiGpuScheduler
impl Sync for MultiGpuScheduler
impl Unpin for MultiGpuScheduler
impl UnsafeUnpin for MultiGpuScheduler
impl !UnwindSafe for MultiGpuScheduler
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
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>
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>
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