pub trait ParMapperExecutor<'a, DR, DW, D>where
DR: DataReader + Send + Sync,
DW: DataWriter + Send + Sync,
D: DataHolder<'a, DR, DW> + Send + Sync,{
type ErrorType;
Show 20 methods
// Required methods
fn input_len(&self) -> usize;
fn real_input_len(&self) -> usize;
fn output_len(&self) -> usize;
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;
fn new_data(&mut self, len: usize) -> D;
fn new_data_from_vec(&mut self, data: Vec<u32>) -> D;
fn new_data_from_slice(&mut self, data: &[u32]) -> D;
fn word_len(&self) -> u32;
fn elem_count(&self, input_len: usize) -> usize;
fn input_data_len(&self, elem_num: usize) -> usize;
fn output_data_len(&self, elem_num: usize) -> usize;
fn output_is_aggregated(&self) -> bool;
fn input_is_populated(&self) -> bool;
fn aggr_output_len(&self) -> Option<usize>;
fn pop_input_len(&self) -> Option<usize>;
fn is_sequential_execution(&self) -> bool;
fn inner_loop(&self) -> Option<u32>;
// Provided methods
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 { ... }
fn new_data_input_elems(&mut self, elem_num: usize) -> D { ... }
fn new_data_output_elems(&mut self, elem_num: usize) -> D { ... }
}Expand description
Executor of parallel mapper executes simulation multiple times.
This executor comes from ParMapperBuilder. Arg input is counter of execution of simulations
and will be passed to circuit input assigned to arg input.
Simulations are independents and they will be executed parrallel way. Output data for each
simulation will be processed by supplied function. Next function joins outputs from
first function an join them. stop functions determines whether stop execution
of simulations.
Read more about Executor figure out about single execution and about data.
Required Associated Types§
Required Methods§
Sourcefn real_input_len(&self) -> usize
fn real_input_len(&self) -> usize
Returns number of pack elements for input data (for assigned circuit inputs).
Sourcefn output_len(&self) -> usize
fn output_len(&self) -> usize
Returns number of circuit outputs.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn output_is_aggregated(&self) -> bool
fn output_is_aggregated(&self) -> bool
Returns true if output data will be processed by aggr_output_code.
Sourcefn input_is_populated(&self) -> bool
fn input_is_populated(&self) -> bool
Returns true if output data will be processed by pop_input_code.
Sourcefn 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.
Sourcefn 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.
Sourcefn is_sequential_execution(&self) -> bool
fn is_sequential_execution(&self) -> bool
Returns true if executor executes simulation in sequentially (not parallel way).
Sourcefn inner_loop(&self) -> Option<u32>
fn inner_loop(&self) -> Option<u32>
Returns inner loop maximal number of iterations.
Provided Methods§
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.