pub fn pmap_lanes<L, C, T, U, E, F>(
world: &C,
lanes: &mut L,
options: PmapOptions,
root_items: Option<Vec<T>>,
f: F,
) -> Result<Option<Vec<U>>, PmapError>Expand description
Dynamically maps root-owned items across MPI ranks and caller-supplied lanes for each rank’s local batches.
Every rank must call this collective in the same order with identical
options. Only options.root supplies items and receives ordered results.
The call must originate on the MPI initialization/main thread, and MPI must
provide MPI_THREAD_FUNNELED or stronger, because the coordinator keeps MPI
progress on that thread while the lanes compute. Do not enter it from a
worker of the executor’s own pool.
The coordinator is the protocol loop on the calling thread: it dispatches
scheduler batches, keeps MPI progress, and applies the root’s immediate abort
rules before anything is joined. Lanes execute the local batches with the
requested LocalMode: Outer spreads a batch over the lanes, while
Sequential and Inner hand the batch to one lane. When
PmapOptions::prefetch is true, each remote domain may hold one additional
batch so blocking task/result transfer overlaps adjacent batch execution; the
root domain remains capacity one.
The per-item callback receives the lane resource of the lane that runs the
item (&mut L::Lane<'_>), so a backend adapter can hand its own per-worker
context, such as a tenferro child session, to the callback. pmap adapts
the ordinary Fn(T) shape to RayonLanes’ unit lane.
A lanes executor that reports LanesError::SingleLane falls back
explicitly to executing each batch on the coordinator thread through
Lanes::run between MPI progress steps. This is the documented one-lane
path; it never happens silently and never runs work twice.
§Errors
Returns PmapErrorKind::Preflight when the collective preconditions fail
(including entry from a Rayon worker), PmapErrorKind::User with a
converged error key when a callback fails, PmapErrorKind::Wire or
PmapErrorKind::Protocol for transport, protocol, or lane-executor
failures, and PmapErrorKind::Reentrant when pmap is already active on
this thread.