pub struct PrimalModuleParallel {
pub units: Vec<PrimalModuleParallelUnitPtr>,
pub config: PrimalModuleParallelConfig,
pub partition_info: Arc<PartitionInfo>,
pub thread_pool: Arc<ThreadPool>,
pub last_solve_start_time: ArcRwLock<Instant>,
}Fields§
§units: Vec<PrimalModuleParallelUnitPtr>the basic wrapped serial modules at the beginning, afterwards the fused units are appended after them
config: PrimalModuleParallelConfiglocal configuration
partition_info: Arc<PartitionInfo>partition information generated by the config
thread_pool: Arc<ThreadPool>thread pool used to execute async functions in parallel
last_solve_start_time: ArcRwLock<Instant>the time of calling PrimalModuleParallel::parallel_solve_step_callback method
Implementations§
Source§impl PrimalModuleParallel
impl PrimalModuleParallel
Sourcepub fn new_config(
initializer: &SolverInitializer,
partition_info: &PartitionInfo,
config: PrimalModuleParallelConfig,
) -> Self
pub fn new_config( initializer: &SolverInitializer, partition_info: &PartitionInfo, config: PrimalModuleParallelConfig, ) -> Self
recommended way to create a new instance, given a customized configuration
Source§impl PrimalModuleParallel
impl PrimalModuleParallel
pub fn parallel_solve<DualSerialModule: DualModuleImpl + Send + Sync>( &mut self, syndrome_pattern: &SyndromePattern, parallel_dual_module: &DualModuleParallel<DualSerialModule>, )
pub fn parallel_solve_visualizer<DualSerialModule: DualModuleImpl + Send + Sync + FusionVisualizer>( &mut self, syndrome_pattern: &SyndromePattern, parallel_dual_module: &DualModuleParallel<DualSerialModule>, visualizer: Option<&mut Visualizer>, )
pub fn parallel_solve_step_callback<DualSerialModule: DualModuleImpl + Send + Sync, F>(
&mut self,
syndrome_pattern: &SyndromePattern,
parallel_dual_module: &DualModuleParallel<DualSerialModule>,
callback: F,
)where
F: FnMut(&DualModuleInterfacePtr, &DualModuleParallelUnit<DualSerialModule>, &PrimalModuleSerialPtr, Option<&GroupMaxUpdateLength>) + Send + Sync,
Trait Implementations§
Source§impl PrimalModuleImpl for PrimalModuleParallel
impl PrimalModuleImpl for PrimalModuleParallel
Source§fn new_empty(initializer: &SolverInitializer) -> Self
fn new_empty(initializer: &SolverInitializer) -> Self
create a primal module given the dual module
Source§fn clear(&mut self)
fn clear(&mut self)
clear all states; however this method is not necessarily called when load a new decoding problem, so you need to call it yourself
fn load_defect_dual_node(&mut self, _dual_node_ptr: &DualNodePtr)
Source§fn resolve<D: DualModuleImpl>(
&mut self,
_group_max_update_length: GroupMaxUpdateLength,
_interface: &DualModuleInterfacePtr,
_dual_module: &mut D,
)
fn resolve<D: DualModuleImpl>( &mut self, _group_max_update_length: GroupMaxUpdateLength, _interface: &DualModuleInterfacePtr, _dual_module: &mut D, )
analyze the reason why dual module cannot further grow, update primal data structure (alternating tree, temporary matches, etc)
and then tell dual module what to do to resolve these conflicts;
note that this function doesn’t necessarily resolve all the conflicts, but can return early if some major change is made.
when implementing this function, it’s recommended that you resolve as many conflicts as possible.
Source§fn intermediate_matching<D: DualModuleImpl>(
&mut self,
interface: &DualModuleInterfacePtr,
dual_module: &mut D,
) -> IntermediateMatching
fn intermediate_matching<D: DualModuleImpl>( &mut self, interface: &DualModuleInterfacePtr, dual_module: &mut D, ) -> IntermediateMatching
return a matching that can possibly include blossom nodes: this does not affect dual module
Source§fn generate_profiler_report(&self) -> Value
fn generate_profiler_report(&self) -> Value
performance profiler report
Source§fn load_defect<D: DualModuleImpl>(
&mut self,
defect_vertex: VertexIndex,
interface_ptr: &DualModuleInterfacePtr,
dual_module: &mut D,
)
fn load_defect<D: DualModuleImpl>( &mut self, defect_vertex: VertexIndex, interface_ptr: &DualModuleInterfacePtr, dual_module: &mut D, )
load a single syndrome and update the dual module and the interface
Source§fn load(&mut self, interface_ptr: &DualModuleInterfacePtr)
fn load(&mut self, interface_ptr: &DualModuleInterfacePtr)
load a new decoding problem given dual interface: note that all nodes MUST be syndrome node
Source§fn perfect_matching<D: DualModuleImpl>(
&mut self,
interface: &DualModuleInterfacePtr,
dual_module: &mut D,
) -> PerfectMatching
fn perfect_matching<D: DualModuleImpl>( &mut self, interface: &DualModuleInterfacePtr, dual_module: &mut D, ) -> PerfectMatching
break down the blossoms to find the final matching; this function will take more time on the dual module
fn solve<D: DualModuleImpl>( &mut self, interface: &DualModuleInterfacePtr, syndrome_pattern: &SyndromePattern, dual_module: &mut D, )
fn solve_visualizer<D: DualModuleImpl + FusionVisualizer>(
&mut self,
interface: &DualModuleInterfacePtr,
syndrome_pattern: &SyndromePattern,
dual_module: &mut D,
visualizer: Option<&mut Visualizer>,
)where
Self: FusionVisualizer + Sized,
fn solve_step_callback<D: DualModuleImpl, F>( &mut self, interface: &DualModuleInterfacePtr, syndrome_pattern: &SyndromePattern, dual_module: &mut D, callback: F, )
fn solve_step_callback_interface_loaded<D: DualModuleImpl, F>( &mut self, interface: &DualModuleInterfacePtr, dual_module: &mut D, callback: F, )
Auto Trait Implementations§
impl Freeze for PrimalModuleParallel
impl !RefUnwindSafe for PrimalModuleParallel
impl Send for PrimalModuleParallel
impl Sync for PrimalModuleParallel
impl Unpin for PrimalModuleParallel
impl !UnwindSafe for PrimalModuleParallel
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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