pub enum ParShape {
Seq,
Team(NonZeroUsize, DispatchCosts),
}Expand description
the shape of a Par: which kind of parallelism and how many threads, without the
right to run anything. Copy, so workspace queries and thresholds can use it freely; it
cannot be passed to any function that executes work.
Variants§
Seq
sequential
Team(NonZeroUsize, DispatchCosts)
a threadteam team of this many participants, with the dispatch costs of the pool it
belongs to (see ParShape::dispatch_cost)
Implementations§
Source§impl ParShape
impl ParShape
Sourcepub fn dispatch_cost(self, width: NonZeroUsize) -> Duration
pub fn dispatch_cost(self, width: NonZeroUsize) -> Duration
The cost of one parallel section of width participants on this shape, in the steady
state (sections back to back); Duration::MAX for a sequential shape or width < 2.
width is clamped to the degree of the shape.
Team is the cost of the team token the shape was taken from (threadteam’s
DispatchKind::Team, with the costs of that token’s pool). Above the largest measured
anchor of the row threadteam grows the cost linearly with the width (threadteam 0.1.1);
faer keeps no second model.
Sourcepub fn min_dispatch_cost(self) -> Duration
pub fn min_dispatch_cost(self) -> Duration
The cheapest cost of one section over all widths of this shape (a lower bound of
dispatch_cost at every width), Duration::MAX for a shape of
degree below 2.
Sourcepub fn pays(
self,
estimate: Duration,
sections: u32,
width: NonZeroUsize,
) -> bool
pub fn pays( self, estimate: Duration, sections: u32, width: NonZeroUsize, ) -> bool
Whether a region of serial time estimate that opens sections sections of width
participants pays on this shape: estimate >= PAYS * sections * dispatch_cost(width).
sections is the number of dispatches the region really performs.
Trait Implementations§
impl Copy for ParShape
impl Eq for ParShape
impl StructuralPartialEq for ParShape
Auto Trait Implementations§
impl Freeze for ParShape
impl RefUnwindSafe for ParShape
impl Send for ParShape
impl Sync for ParShape
impl Unpin for ParShape
impl UnsafeUnpin for ParShape
impl UnwindSafe for ParShape
Blanket Implementations§
impl<T> Boilerplate 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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 more