pub struct LoadBalancer { /* private fields */ }Expand description
Load balancer for tensor distribution
Implementations§
Source§impl LoadBalancer
impl LoadBalancer
Sourcepub fn new(cluster: Arc<ClusterState>, config: LoadBalanceConfig) -> Self
pub fn new(cluster: Arc<ClusterState>, config: LoadBalanceConfig) -> Self
Create new load balancer
Sourcepub fn with_runtime_profile(
cluster: Arc<ClusterState>,
profile: &RuntimeProfile,
) -> Self
pub fn with_runtime_profile( cluster: Arc<ClusterState>, profile: &RuntimeProfile, ) -> Self
Create a load balancer with configuration derived from the local runtime profile.
Sourcepub fn config(&self) -> LoadBalanceConfig
pub fn config(&self) -> LoadBalanceConfig
Access the current configuration.
Sourcepub fn distribute_layers(
&self,
layers: &[LayerSpec],
) -> Result<LoadDistributionPlan, String>
pub fn distribute_layers( &self, layers: &[LayerSpec], ) -> Result<LoadDistributionPlan, String>
Distribute tensor layers across nodes based on VRAM capacity
Sourcepub fn distribute_layers_with_runtime_profile(
&self,
layers: &[LayerSpec],
profile: &RuntimeProfile,
) -> Result<LoadDistributionPlan, String>
pub fn distribute_layers_with_runtime_profile( &self, layers: &[LayerSpec], profile: &RuntimeProfile, ) -> Result<LoadDistributionPlan, String>
Distribute layers and then chunk large node allocations to match worker parallelism.
Sourcepub fn shed_load(&self) -> Vec<(String, String)>
pub fn shed_load(&self) -> Vec<(String, String)>
Shed load from overloaded nodes to underloaded ones
Sourcepub fn reconfigure_from_system_profile(&self, profile: &SystemProfile)
pub fn reconfigure_from_system_profile(&self, profile: &SystemProfile)
Re-tune load-balancing thresholds from a system profile detected at runtime.
Sourcepub fn subscribe_to_watcher(
self: &Arc<Self>,
watcher: &SystemProfileWatcher,
) -> JoinHandle<()>
pub fn subscribe_to_watcher( self: &Arc<Self>, watcher: &SystemProfileWatcher, ) -> JoinHandle<()>
Subscribe to a SystemProfileWatcher’s broadcast channel and
automatically re-tune whenever hardware changes are detected.
Returns a JoinHandle that can be cancelled by dropping it.
Sourcepub fn distribute_with_deadlock_prevention(
&self,
layers: &[LayerSpec],
) -> Result<LoadDistributionPlan, String>
pub fn distribute_with_deadlock_prevention( &self, layers: &[LayerSpec], ) -> Result<LoadDistributionPlan, String>
Distribute layers with deadlock prevention
Trait Implementations§
Source§impl Clone for LoadBalancer
impl Clone for LoadBalancer
Source§fn clone(&self) -> LoadBalancer
fn clone(&self) -> LoadBalancer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LoadBalancer
impl RefUnwindSafe for LoadBalancer
impl Send for LoadBalancer
impl Sync for LoadBalancer
impl Unpin for LoadBalancer
impl UnsafeUnpin for LoadBalancer
impl UnwindSafe for LoadBalancer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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