ParBasicMapperExecutor

Struct ParBasicMapperExecutor 

Source
pub struct ParBasicMapperExecutor<'a, DR, DW, D, E>
where DR: DataReader + Send + Sync, DW: DataWriter + Send + Sync, D: DataHolder<'a, DR, DW> + Send + Sync, E: Executor<'a, DR, DW, D> + Send + Sync, E::ErrorType: Send,
{ /* private fields */ }
Expand description

Basic parallel mapper executor.

This executor provides data transformers by DataTransforms. See more in ParMapperExecutor.

Implementations§

Source§

impl<'a, DR, DW, D, E> ParBasicMapperExecutor<'a, DR, DW, D, E>
where DR: DataReader + Send + Sync, DW: DataWriter + Send + Sync, D: DataHolder<'a, DR, DW> + Send + Sync, E: Executor<'a, DR, DW, D> + Send + Sync, E::ErrorType: Send,

Source

pub fn executor(&self) -> &E

Trait Implementations§

Source§

impl<'a, DR, DW, D, E, IDT, ODT> DataTransforms<'a, DR, DW, D, IDT, ODT> for ParBasicMapperExecutor<'a, DR, DW, D, E>
where DR: DataReader + Send + Sync, DW: DataWriter + Send + Sync, D: DataHolder<'a, DR, DW> + Send + Sync, E: Executor<'a, DR, DW, D> + DataTransforms<'a, DR, DW, D, IDT, ODT> + Send + Sync, IDT: DataTransformer<'a, DR, DW, D>, ODT: DataTransformer<'a, DR, DW, D>, <E as Executor<'a, DR, DW, D>>::ErrorType: Send, <E as DataTransforms<'a, DR, DW, D, IDT, ODT>>::ErrorType: Send,

Source§

type ErrorType = <E as DataTransforms<'a, DR, DW, D, IDT, ODT>>::ErrorType

Error type used if error encountered while execution.
Source§

fn input_transformer( &self, input_elem_len: usize, bit_mapping: &[usize], ) -> Result<IDT, Self::ErrorType>

Returns input data transfomer. This transformer transforms input data in external form to internal form. Form of external input form described by input_elem_len and bit_mapping. input_len is length of input element in external form in bits and it should be divisible by to 32. bit_mapping is list of mapping: index of list is bit of output’s element (pack element) and value is bit of input’s (in external form) element. Input data is organized as tuple of 32-bit words. Single element of input data has input_elem_len bits.
Source§

fn output_transformer( &self, output_elem_len: usize, bit_mapping: &[usize], ) -> Result<ODT, Self::ErrorType>

Returns output data transfomer. This transformer transforms output data in internal form to external form of output. Form of external output form described by output_elem_len and bit_mapping. output_len is length of output element in external form in bits and it should be divisble by 32-bit. bit_mapping is list of mapping: index of list is bit of input’s element (pack element) and value is bit of output’s (in external form) element. Output data is organized as tuple of 32-bit words. Single element of input data has output_elem_len bits.
Source§

impl<'a, DR, DW, D, E, B> ParMapperBuilder<'a, DR, DW, D, ParBasicMapperExecutor<'a, DR, DW, D, E>> for ParBasicMapperBuilder<'a, DR, DW, D, E, B>
where DR: DataReader + Send + Sync, DW: DataWriter + Send + Sync, D: DataHolder<'a, DR, DW> + Send + Sync, E: Executor<'a, DR, DW, D> + Send + Sync, B: Builder<'a, DR, DW, D, E>, E::ErrorType: Send,

Source§

type ErrorType = <B as Builder<'a, DR, DW, D, E>>::ErrorType

Error type used if error encountered while execution.
Source§

fn user_defs(&mut self, user_defs: &str)

Adds additional user definition to code of simulations.
Source§

fn transform_helpers(&mut self)

Adds transform helpers. Read more
Source§

unsafe fn add_internal<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, )
where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug,

Only for implementation. Read more
Source§

fn build( self, ) -> Result<Vec<ParBasicMapperExecutor<'a, DR, DW, D, E>>, Self::ErrorType>

Build code to simulations. If build succeeded then returns executors for simulations in addition order.
Source§

fn word_len(&self) -> u32

Returns length processor word in bits.
Source§

fn type_len(&self) -> u32

Returns type length in bits (includes only type length not word length if group_vec enabled).
Source§

fn is_data_holder_global() -> bool

Returns true if any data holder is global and it can be shared between any executors from any builder of that type.
Source§

fn is_data_holder_in_builder() -> bool

Returns true if any data holder is global and it can be shared between any executors from this builder.
Source§

fn preferred_input_count(&self) -> usize

Returns hint about preferred count of input.
Source§

fn add_with_config<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, )
where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug,

Adds circuit to builder. name is name of function, circuit is circuit to simulate, code_config is code configuration.
Source§

fn add<T>(&mut self, name: &str, circuit: Circuit<T>, arg_inputs: &[usize])
where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug,

Adds circuit to builder. name is name of function, circuit is circuit to simulate, arg_inputs are circuit inputs to be assigned to arg input.
Source§

impl<'a, DR, DW, D, E> ParMapperExecutor<'a, DR, DW, D> for ParBasicMapperExecutor<'a, DR, DW, D, E>
where DR: DataReader + Send + Sync, DW: DataWriter + Send + Sync, D: DataHolder<'a, DR, DW> + Send + Sync, E: Executor<'a, DR, DW, D> + Send + Sync, E::ErrorType: Send,

Source§

type ErrorType = <E as Executor<'a, DR, DW, D>>::ErrorType

Error type used if error encountered while execution.
Source§

fn input_len(&self) -> usize

Returns number of circuit inputs.
Source§

fn real_input_len(&self) -> usize

Returns number of pack elements for input data (for assigned circuit inputs).
Source§

fn output_len(&self) -> usize

Returns number of circuit outputs.
Source§

fn execute<Out, F, G, Stop>( &mut self, input: &D, init: Out, f: F, g: G, stop: Stop, ) -> Result<Out, Self::ErrorType>
where F: Fn(&D, &D, u64) -> Out + Send + Sync, G: Fn(Out, Out) -> Out + Send + Sync, Stop: Fn(&Out) -> bool + Send + Sync, Out: Clone + Send + Sync,

Executes many simulations. Input data passed by input. init is initial output. f is function that process output data from single execution. f function pass input data, output data and arg input value. g is function that joins result from f function. stop is function that checks whether whole execution should be stopped (then function should return true in this case). Function f read data from data holders. Arg input value is counter that will be increased for every single execution.
Source§

fn elem_count(&self, input_len: usize) -> usize

Returns element count for given input length in 32-bit words.
Source§

fn new_data(&mut self, len: usize) -> D

Creates new data. It returns data holder with zeroed data with length len 32-bit words.
Source§

fn new_data_from_vec(&mut self, data: Vec<u32>) -> D

Creates new data. It returns data holder with data supplied by vector data.
Source§

fn new_data_from_slice(&mut self, data: &[u32]) -> D

Creates new data. It returns data holder with data supplied by slice.
Source§

fn input_data_len(&self, elem_num: usize) -> usize

Returns input data (for circuit inputs) length in 32-bit words for given number of elements.
Source§

fn output_data_len(&self, elem_num: usize) -> usize

Returns output data (for circuit outputs) length in 32-bit words for given number of elements.
Source§

fn word_len(&self) -> u32

Returns processor word length.
Source§

fn output_is_aggregated(&self) -> bool

Returns true if output data will be processed by aggr_output_code.
Source§

fn aggr_output_len(&self) -> Option<usize>

Returns length of additional buffer in 32-bit words for aggr_output_code.
Source§

fn input_is_populated(&self) -> bool

Returns true if output data will be processed by pop_input_code.
Source§

fn pop_input_len(&self) -> Option<usize>

Returns length of additional buffer in 32-bit words for pop_input_code.
Source§

fn is_sequential_execution(&self) -> bool

Returns true if executor executes simulation in sequentially (not parallel way).
Source§

fn inner_loop(&self) -> Option<u32>

Returns inner loop maximal number of iterations.
Source§

fn execute_direct<'b, Out, F, G, Stop>( &mut self, input: &D, init: Out, f: F, g: G, stop: Stop, ) -> Result<Out, Self::ErrorType>
where F: Fn(&[u32], &[u32], u64) -> Out + Send + Sync, G: Fn(Out, Out) -> Out + Send + Sync, Stop: Fn(&Out) -> bool + Send + Sync, Out: Clone + Send + Sync,

Executes many simulations. Input data passed by input. init is initial output. f is function that process output data from single execution. f function pass input data, output data and arg input value. g is function that joins result from f function. stop is function that checks whether whole execution should be stopped (then function should return true in this case). Function f read data from slice. Arg input value is counter that will be increased for every single execution.
Source§

fn new_data_input_elems(&mut self, elem_num: usize) -> D

Returns input data holder (for circuit inputs) with zeroed data with length matched to given number of elements.
Source§

fn new_data_output_elems(&mut self, elem_num: usize) -> D

Returns output data holder (for circuit outputs) with zeroed data with length matched to given number of elements.

Auto Trait Implementations§

§

impl<'a, DR, DW, D, E> Freeze for ParBasicMapperExecutor<'a, DR, DW, D, E>
where E: Freeze,

§

impl<'a, DR, DW, D, E> RefUnwindSafe for ParBasicMapperExecutor<'a, DR, DW, D, E>

§

impl<'a, DR, DW, D, E> Send for ParBasicMapperExecutor<'a, DR, DW, D, E>

§

impl<'a, DR, DW, D, E> Sync for ParBasicMapperExecutor<'a, DR, DW, D, E>

§

impl<'a, DR, DW, D, E> Unpin for ParBasicMapperExecutor<'a, DR, DW, D, E>
where E: Unpin,

§

impl<'a, DR, DW, D, E> UnwindSafe for ParBasicMapperExecutor<'a, DR, DW, D, E>

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