Skip to main content

Executor

Struct Executor 

Source
pub struct Executor { /* private fields */ }

Implementations§

Source§

impl Executor

Source

pub fn new(parallel: i64) -> Result<Self>

Source

pub fn parallel(&self) -> usize

How many workers, which is also how many batches the readers split a request into.

Source

pub fn install<R: Send>(&self, f: impl FnOnce() -> R + Send) -> R

Run f on the pool. Rayon calls made inside it use these threads rather than the global pool, which is what keeps one reader’s parallel a promise about this reader.

Source

pub fn spawn(&self, f: impl FnOnce() + Send + 'static)

Hand one job to the pool and return without waiting.

What the writer’s deflate pipeline is built on: a block is submitted, the caller goes on filling the next one, and the result is collected in submission order later. Everything else here is fork-join, which does not fit a producer that has to keep producing.

Source

pub fn for_each_batch<T: Send + Sync>( &self, batches: &[T], f: impl Fn(usize, &T) -> Result<()> + Send + Sync, ) -> Result<()>

Run one job per batch, collecting the first error.

Batching is the caller’s: IndexedLocs::batches splits loci into coverage-balanced groups, and that split decides which blocks each worker touches and so how much of the cache is shared. Letting rayon work-steal its own split would change both, and with them the order f32 accumulators are summed in — which is visible in the last bits of every mean and standard deviation.

Source

pub fn map_batches<T: Send, B: Send + Sync>( &self, batches: &[B], f: impl Fn(usize, &B) -> Result<T> + Send + Sync, ) -> Result<Vec<T>>

The same, keeping each batch’s result in submission order.

What the extraction kernels use: a batch’s loci own scattered slices of the output, not a contiguous one — the loci are sorted into file order while their output slices follow the request’s order — so each worker fills a compact buffer of its own and the caller scatters afterwards. That keeps every bin accumulated by exactly one worker in one order, which is what makes the result bit-reproducible.

Trait Implementations§

Source§

impl Debug for Executor

Hand-written: rayon::ThreadPool is not Debug, and a reader that holds an executor still has to be printable.

Source§

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

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

impl Drop for Executor

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.