Skip to main content

Parallelism

Enum Parallelism 

Source
#[non_exhaustive]
pub enum Parallelism {
#[non_exhaustive]
Dynamic { batchsize: NonZeroUsize, ntasks: NonZeroUsize, },
#[non_exhaustive]
Sequential { batchsize: NonZeroUsize, },
#[non_exhaustive]
Fixed { batchsize: Option<NonZeroUsize>, ntasks: NonZeroUsize, }, }
Expand description

Control the parallel partitioning strategy for build and build_tracked.

Many aspects of this enum are #[non_exhaustive] to allow for future extension. Users should use the associated constructors instead to create instances.

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

#[non_exhaustive]
Dynamic

Use dynamic load balancing to partition the work into batches of at most batchsize. When the batchsize is 1, the implementation guarantees sequential execution.

The batches assigned to each task can be assumed to be monotonically increasing.

See: Parallelism::dynamic.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§batchsize: NonZeroUsize
§

#[non_exhaustive]
Sequential

Run the build with just a single task. Input data is still batched.

See: Parallelism::sequential.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§batchsize: NonZeroUsize
§

#[non_exhaustive]
Fixed

Create a fixed parallelism strategy with ntasks executors. This strategy partitions the problem space into roughly ntasks balanced contiguous chunks.

If batchsize is Some, than each chunk will be further subdivided into at most batchsize sized subchunks which are then provided to Build::build.

If batchsize is None, then the entire task partition is supplied in a single call to Build::build.

See: Parallelism::fixed.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.

Implementations§

Source§

impl Parallelism

Source

pub fn dynamic(batchsize: NonZeroUsize, ntasks: NonZeroUsize) -> Self

Create a dynamic parallelism strategy with the specified batchsize and ntasks.

Returns Self::Dynamic.

Source

pub fn fixed(batchsize: Option<NonZeroUsize>, ntasks: NonZeroUsize) -> Self

Create a fixed parallelism strategy with ntasks executors and possible sub-partitioning into the specified batchsize.

Returns Self::Fixed.

Source

pub fn sequential(batchsize: NonZeroUsize) -> Self

Create a sequential parallelism strategy with the specified batchsize.

Returns Self::Sequential.

Trait Implementations§

Source§

impl Clone for Parallelism

Source§

fn clone(&self) -> Parallelism

Returns a duplicate 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 Parallelism

Source§

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

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

impl PartialEq for Parallelism

Source§

fn eq(&self, other: &Parallelism) -> 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 Parallelism

Source§

impl StructuralPartialEq for Parallelism

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, dest: *mut u8)

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

impl<T> DispatchRule<T> for T

Source§

type Error = Infallible

Errors that can occur during convert.
Source§

fn try_match(_from: &T) -> Result<MatchScore, FailureScore>

Attempt to match the value From to the type represented by Self. Read more
Source§

fn convert(from: T) -> Result<T, <T as DispatchRule<T>>::Error>

Perform the actual conversion. Read more
Source§

fn description(f: &mut Formatter<'_>, from: Option<&T>) -> Result<(), Error>

Write a description of the dispatch rule and outcome to the formatter. Read more
Source§

fn try_match_verbose<'a>( from: &'a From, ) -> Result<MatchScore, TaggedFailureScore<'a>>
where Self: 'a,

The equivalent of try_match but returns a reason for a failed score. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn generate(&mut self) -> T

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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, 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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> AsyncFriendly for T
where T: Send + Sync + 'static,