pub struct SimulatedBackend { /* private fields */ }Expand description
In-process backend using std::sync::mpsc channels.
Designed for testing collectives and DDP without spawning processes.
Create all ranks via SimulatedBackend::create_group, which returns
one SimulatedBackend per rank.
Implementations§
Source§impl SimulatedBackend
impl SimulatedBackend
Sourcepub fn create_group(world_size: usize) -> FerrotorchResult<Vec<Self>>
pub fn create_group(world_size: usize) -> FerrotorchResult<Vec<Self>>
Create a group of world_size simulated backends, one per rank.
Returns a Vec<SimulatedBackend> where index i is rank i.
Trait Implementations§
Source§impl Backend for SimulatedBackend
impl Backend for SimulatedBackend
Source§fn world_size(&self) -> usize
fn world_size(&self) -> usize
Total number of ranks in the process group.
Source§fn recv(&self, dst: &mut [u8], src_rank: usize) -> FerrotorchResult<()>
fn recv(&self, dst: &mut [u8], src_rank: usize) -> FerrotorchResult<()>
Receive into
dst from src_rank. The caller must allocate dst
with the correct length before calling.Source§fn recv_timeout(
&self,
dst: &mut [u8],
src_rank: usize,
timeout: Duration,
) -> FerrotorchResult<()>
fn recv_timeout( &self, dst: &mut [u8], src_rank: usize, timeout: Duration, ) -> FerrotorchResult<()>
Source§fn barrier(&self) -> FerrotorchResult<()>
fn barrier(&self) -> FerrotorchResult<()>
Block until every rank has reached this barrier.
Auto Trait Implementations§
impl Freeze for SimulatedBackend
impl RefUnwindSafe for SimulatedBackend
impl Send for SimulatedBackend
impl Sync for SimulatedBackend
impl Unpin for SimulatedBackend
impl UnsafeUnpin for SimulatedBackend
impl UnwindSafe for SimulatedBackend
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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