Skip to main content

spawn_ranks

Function spawn_ranks 

Source
pub fn spawn_ranks<F, R>(size: usize, body: F) -> Vec<R>
where F: Fn(ThreadRankMpi) -> R + Send + Sync + Clone + 'static, R: Send + 'static,
Expand description

Build a size-rank simulated communicator and run body on each simulated rank in its own thread, returning each rank’s result in rank order. body receives a ready-to-use ThreadRankMpi handle; construct a DistributedOptimizationContext from it to drive a real algorithm.

§Panics

Propagates a panic from body on any rank (via JoinHandle::join’s Result::expect) rather than silently losing a rank’s failure.