#[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]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
batchsize: NonZeroUsizentasks: 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
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
batchsize: Option<NonZeroUsize>ntasks: NonZeroUsizeImplementations§
Source§impl Parallelism
impl Parallelism
Sourcepub fn dynamic(batchsize: NonZeroUsize, ntasks: NonZeroUsize) -> Self
pub fn dynamic(batchsize: NonZeroUsize, ntasks: NonZeroUsize) -> Self
Create a dynamic parallelism strategy with the specified batchsize and ntasks.
Returns Self::Dynamic.
Sourcepub fn fixed(batchsize: Option<NonZeroUsize>, ntasks: NonZeroUsize) -> Self
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.
Sourcepub fn sequential(batchsize: NonZeroUsize) -> Self
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
impl Clone for Parallelism
Source§fn clone(&self) -> Parallelism
fn clone(&self) -> Parallelism
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Parallelism
impl Debug for Parallelism
Source§impl PartialEq for Parallelism
impl PartialEq for Parallelism
Source§fn eq(&self, other: &Parallelism) -> bool
fn eq(&self, other: &Parallelism) -> bool
self and other values to be equal, and is used by ==.