pub struct ParameterServer { /* private fields */ }Expand description
Parameter server supporting BSP, ASP, and SSP consistency models
Implementations§
Source§impl ParameterServer
impl ParameterServer
Sourcepub fn new(config: ParamServerConfig) -> Self
pub fn new(config: ParamServerConfig) -> Self
Create a new parameter server with the given configuration
Sourcepub fn register_worker(&mut self) -> usize
pub fn register_worker(&mut self) -> usize
Register a new worker and return its ID
Sourcepub fn init_parameter(&mut self, key: impl Into<String>, values: Vec<f64>)
pub fn init_parameter(&mut self, key: impl Into<String>, values: Vec<f64>)
Initialize a parameter with the given key and values
Sourcepub fn push(&mut self, update: ParameterUpdate) -> CoreResult<()>
pub fn push(&mut self, update: ParameterUpdate) -> CoreResult<()>
Push an update from a worker
Behavior depends on the consistency model:
- BSP: buffers until all workers push, then applies via
barrier_sync - ASP: applies immediately
- SSP: applies if within staleness bound, otherwise buffers
Sourcepub fn pull(&self, key: &str, worker_id: usize) -> CoreResult<(Vec<f64>, u64)>
pub fn pull(&self, key: &str, worker_id: usize) -> CoreResult<(Vec<f64>, u64)>
Pull current parameter values for a given key
Sourcepub fn aggregate_updates(
updates: &[ParameterUpdate],
method: &AggregationMethod,
) -> Vec<f64>
pub fn aggregate_updates( updates: &[ParameterUpdate], method: &AggregationMethod, ) -> Vec<f64>
Aggregate updates using the configured method
Sourcepub fn barrier_sync(&mut self) -> CoreResult<()>
pub fn barrier_sync(&mut self) -> CoreResult<()>
BSP barrier synchronization
Applies all buffered updates and increments the global version. Returns an error if not all alive workers have pushed.
Sourcepub fn checkpoint(&self) -> ServerCheckpoint
pub fn checkpoint(&self) -> ServerCheckpoint
Create a checkpoint of the current server state
Sourcepub fn restore(
checkpoint: &ServerCheckpoint,
config: ParamServerConfig,
) -> CoreResult<Self>
pub fn restore( checkpoint: &ServerCheckpoint, config: ParamServerConfig, ) -> CoreResult<Self>
Restore a parameter server from a checkpoint
Sourcepub fn global_version(&self) -> u64
pub fn global_version(&self) -> u64
Get the current global version
Sourcepub fn num_workers(&self) -> usize
pub fn num_workers(&self) -> usize
Get number of registered workers
Sourcepub fn workers(&self) -> &[WorkerState]
pub fn workers(&self) -> &[WorkerState]
Get a reference to the worker states
Sourcepub fn workers_mut(&mut self) -> &mut Vec<WorkerState>
pub fn workers_mut(&mut self) -> &mut Vec<WorkerState>
Get a mutable reference to the worker states
Sourcepub fn config(&self) -> &ParamServerConfig
pub fn config(&self) -> &ParamServerConfig
Get the configuration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParameterServer
impl RefUnwindSafe for ParameterServer
impl Send for ParameterServer
impl Sync for ParameterServer
impl Unpin for ParameterServer
impl UnsafeUnpin for ParameterServer
impl UnwindSafe for ParameterServer
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.