pub struct DistributedOptimizationContext<M: MPIInterface> { /* private fields */ }
Expand description
Distributed optimization context
Implementations§
Source§impl<M: MPIInterface> DistributedOptimizationContext<M>
impl<M: MPIInterface> DistributedOptimizationContext<M>
Sourcepub fn new(mpi: M, config: DistributedConfig) -> Self
pub fn new(mpi: M, config: DistributedConfig) -> Self
Create a new distributed optimization context
Sourcepub fn distribute_work(&mut self, total_work: usize) -> WorkAssignment
pub fn distribute_work(&mut self, total_work: usize) -> WorkAssignment
Distribute work among processes
Sourcepub fn synchronize(&self) -> ScirsResult<()>
pub fn synchronize(&self) -> ScirsResult<()>
Synchronize all processes
Sourcepub fn broadcast_parameters(&self, params: &mut Array1<f64>) -> ScirsResult<()>
pub fn broadcast_parameters(&self, params: &mut Array1<f64>) -> ScirsResult<()>
Broadcast parameters from master to all workers
Sourcepub fn gather_results(
&self,
local_result: &Array1<f64>,
) -> ScirsResult<Option<Array2<f64>>>
pub fn gather_results( &self, local_result: &Array1<f64>, ) -> ScirsResult<Option<Array2<f64>>>
Gather results from all workers to master
Sourcepub fn allreduce_sum(
&self,
local_data: &Array1<f64>,
) -> ScirsResult<Array1<f64>>
pub fn allreduce_sum( &self, local_data: &Array1<f64>, ) -> ScirsResult<Array1<f64>>
Perform all-reduce operation (sum)
Sourcepub fn stats(&self) -> &DistributedStats
pub fn stats(&self) -> &DistributedStats
Get performance statistics
Auto Trait Implementations§
impl<M> Freeze for DistributedOptimizationContext<M>where
M: Freeze,
impl<M> RefUnwindSafe for DistributedOptimizationContext<M>where
M: RefUnwindSafe,
impl<M> Send for DistributedOptimizationContext<M>where
M: Send,
impl<M> Sync for DistributedOptimizationContext<M>where
M: Sync,
impl<M> Unpin for DistributedOptimizationContext<M>where
M: Unpin,
impl<M> UnwindSafe for DistributedOptimizationContext<M>where
M: UnwindSafe,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.