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,
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,
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,
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
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>
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>
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,
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
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)
fn user_defs(&mut self, user_defs: &str)
Adds additional user definition to code of simulations.
Source§fn transform_helpers(&mut self)
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<'_>,
)
unsafe fn add_internal<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, )
Only for implementation. Read more
Source§fn build(
self,
) -> Result<Vec<ParBasicMapperExecutor<'a, DR, DW, D, E>>, Self::ErrorType>
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 type_len(&self) -> u32
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
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
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
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<'_>,
)
fn add_with_config<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, )
Adds circuit to builder.
name is name of function, circuit is circuit to simulate,
code_config is code configuration.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,
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
type ErrorType = <E as Executor<'a, DR, DW, D>>::ErrorType
Error type used if error encountered while execution.
Source§fn real_input_len(&self) -> usize
fn real_input_len(&self) -> usize
Returns number of pack elements for input data (for assigned circuit inputs).
Source§fn output_len(&self) -> usize
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>
fn execute<Out, F, G, Stop>( &mut self, input: &D, init: Out, f: F, g: G, stop: Stop, ) -> Result<Out, Self::ErrorType>
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
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
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
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
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
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
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 output_is_aggregated(&self) -> bool
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>
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
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>
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
fn is_sequential_execution(&self) -> bool
Returns true if executor executes simulation in sequentially (not parallel way).
Source§fn inner_loop(&self) -> Option<u32>
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>
fn execute_direct<'b, Out, F, G, Stop>( &mut self, input: &D, init: Out, f: F, g: G, stop: Stop, ) -> Result<Out, Self::ErrorType>
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
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
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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