Enum WorkDistribution

Source
#[non_exhaustive]
pub enum WorkDistribution { PinnedMemoryRegionPairs, PinnedSameMemoryRegion, PinnedSameProcessor, PinnedSelf, UnpinnedMemoryRegionPairs, ConstrainedSameMemoryRegion, UnpinnedSelf, UnpinnedPerMemoryRegionSelf, }
Expand description

How work is distributed among processors during a benchmark run.

The work is redistributed for each benchmark iteration, ensuring that hardware-specific performance anomalies are averaged out (e.g. if some processors have worse thermals and throttle more often).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

PinnedMemoryRegionPairs

One worker pair is spawned for each numerically neighboring memory region pair.

For example, with 3 memory regions, we would have 3 pairs of workers: (0, 1), (1, 2), (2, 0).

Each pair will work together, processing one payload per pair. In total, there will be two workers per memory region (one working with the “previous” memory region and one working with the “next” one).

Each worker is pinned to a specific processor.

Different memory regions may be a different distance apart, so this allows us to average out any differences - some pairs are faster, some are slower, we just want to average it out so every benchmark run is consistent (instead of picking two random memory regions).

This option can only be used if there are at least two memory regions. Benchmark runs with this distribution will be skipped if the system only has a single memory region.

§

PinnedSameMemoryRegion

Each worker in a pair is spawned in the same memory region.

Each pair will work together, processing one payload between the two members. Different pairs may be in different memory regions.

Each worker is pinned to a specific processor.

The number of pairs will match the number that would have been used with PinnedMemoryRegionPairs, for optimal comparability. There will be a minimum of one pair.

§

PinnedSameProcessor

Both workers in each pair are spawned on the same processor, picked arbitrarily.

Each pair will work together, processing one payload between the two members. Different pairs may be in different memory regions.

This can occasionally be insightful when it surprises you by showing that two threads on the same processor do not need twice as long to get twice as much work done. Not useful with most scenarios, though - best to skip unless probing specifically for this effect.

The number of pairs will match the number that would have been used with PinnedMemoryRegionPairs, for optimal comparability. There will be a minimum of one pair.

§

PinnedSelf

All workers are spawned without regard to memory region or processor, randomly picking processors for each iteration.

Each worker is given back its own payload - while we still spawn the same number of workers as in the paired scenarios, each member of the pair operates independently and processes its own payload.

Note that this requires the benchmark scenario logic to be capable of handling its own data set. If the benchmark logic requires two collaborating workers, you cannot use this work distribution as it would likely end in a deadlock due to lack of a partner.

This mode is also unlikely to be informative if the scenario setup does not distinguish between the two workers (they either do the same thing or pick dynamically who does what).

§

UnpinnedMemoryRegionPairs

Like PinnedMemoryRegionPairs but each worker is allowed to float among all the processors in the memory region, based on the operating system’s scheduling decisions.

We still have the same total number of workers to keep total system load equivalent.

§

ConstrainedSameMemoryRegion

Like PinnedSameMemoryRegion but each worker is allowed to float among half the processors in the memory region, based on the operating system’s scheduling decisions. Each member of the pair gets one half of the processors in the memory region.

We still have the same total number of workers to keep total system load equivalent.

§

UnpinnedSelf

All workers are spawned without regard to memory region or processor, leaving it up to the operating system to decide where to run them. Note that, typically, this will still result in them running in the same memory region, as that tends to be the default behavior.

Each worker is given back its own payload - while we still spawn the same number of workers as in the paired scenarios, each member of the pair operates independently and processes its own payload.

Note that this requires the benchmark scenario logic to be capable of handling its own data set. If the benchmark logic requires two collaborating workers, you cannot use this work distribution as it would likely end in a deadlock due to lack of a partner.

This mode is also unlikely to be informative if the scenario setup does not distinguish between the two workers (they either do the same thing or pick dynamically who does what).

§

UnpinnedPerMemoryRegionSelf

All workers are spawned without regard to processor but in specific memory regions, matching the memory regions used in PinnedMemoryRegionPairs. Each worker is allowed to float among all the processors in the memory region, based on the operating system’s scheduling decisions.

Each worker is given back its own payload - while we still spawn the same number of workers as in the paired scenarios, each member of the pair operates independently and processes its own payload.

Note that this requires the benchmark scenario logic to be capable of handling its own data set. If the benchmark logic requires two collaborating workers, you cannot use this work distribution as it would likely end in a deadlock due to lack of a partner.

Implementations§

Source§

impl WorkDistribution

Source

pub fn all() -> &'static [WorkDistribution]

All the work distribution modes.

Source

pub fn all_without_self() -> &'static [WorkDistribution]

All the work distribution modes that exchange payloads between processors before starting the benchmark.

Source

pub fn all_with_unique_processors() -> &'static [WorkDistribution]

All the work distribution modes that allow every worker to be placed on a different processor (either explicitly or by allowing them to float based on OS scheduling decisions).

Source

pub fn all_with_unique_processors_without_self() -> &'static [WorkDistribution]

All the work distribution modes that allow every worker to be placed on a different processor (either explicitly or by allowing them to float based on OS scheduling decisions) and exchange payloads between workers before starting the benchmark.

Trait Implementations§

Source§

impl Clone for WorkDistribution

Source§

fn clone(&self) -> WorkDistribution

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkDistribution

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for WorkDistribution

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for WorkDistribution

Source§

fn eq(&self, other: &WorkDistribution) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for WorkDistribution

Source§

impl Eq for WorkDistribution

Source§

impl StructuralPartialEq for WorkDistribution

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V