pub enum ParShape {
Seq,
Rayon(NonZeroUsize),
}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§
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: the cost of the team token the shape was taken from (threadteam’sDispatchKind::Team, with the costs of that token’s pool).Rayon: the cost of the Rayon route at the place the calling thread is:InPoolwhen it is a worker of the pool (a caller insidespindle::with_lockis one),Outsideotherwise (the rows of the host table of threadteam, or the same numbers without thethreadteamfeature). The shape is read on the thread that decides, so the answer follows the caller, not the token.
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