pub struct DualModuleParallel<SerialModule: DualModuleImpl + Send + Sync> {
pub units: Vec<ArcManualSafeLock<DualModuleParallelUnit<SerialModule>>>,
pub config: DualModuleParallelConfig,
pub partition_info: Arc<PartitionInfo>,
pub thread_pool: Arc<ThreadPool>,
pub empty_sync_request: Vec<SyncRequest>,
}Fields§
§units: Vec<ArcManualSafeLock<DualModuleParallelUnit<SerialModule>>>the basic wrapped serial modules at the beginning, afterwards the fused units are appended after them
config: DualModuleParallelConfiglocal configuration
partition_info: Arc<PartitionInfo>partition information generated by the config
thread_pool: Arc<ThreadPool>thread pool used to execute async functions in parallel
empty_sync_request: Vec<SyncRequest>an empty sync requests queue just to implement the trait
Implementations§
Source§impl<SerialModule: DualModuleImpl + Send + Sync> DualModuleParallel<SerialModule>
impl<SerialModule: DualModuleImpl + Send + Sync> DualModuleParallel<SerialModule>
Sourcepub fn new_config(
initializer: &SolverInitializer,
partition_info: &PartitionInfo,
config: DualModuleParallelConfig,
) -> Self
pub fn new_config( initializer: &SolverInitializer, partition_info: &PartitionInfo, config: DualModuleParallelConfig, ) -> Self
recommended way to create a new instance, given a customized configuration
Sourcepub fn find_active_ancestor(
&self,
dual_node_ptr: &DualNodePtr,
) -> DualModuleParallelUnitPtr<SerialModule>
pub fn find_active_ancestor( &self, dual_node_ptr: &DualNodePtr, ) -> DualModuleParallelUnitPtr<SerialModule>
find the active ancestor to handle this dual node (should be unique, i.e. any time only one ancestor is active)
pub fn find_active_ancestor_option( &self, dual_node_ptr: &DualNodePtr, ) -> Option<DualModuleParallelUnitPtr<SerialModule>>
Sourcepub fn static_fuse_all(&mut self)
pub fn static_fuse_all(&mut self)
statically fuse them all, may be called at any state (meaning each unit may not necessarily be solved locally)
Trait Implementations§
Source§impl<SerialModule: DualModuleImpl + Send + Sync> DualModuleImpl for DualModuleParallel<SerialModule>
impl<SerialModule: DualModuleImpl + Send + Sync> DualModuleImpl for DualModuleParallel<SerialModule>
Source§fn new_empty(initializer: &SolverInitializer) -> Self
fn new_empty(initializer: &SolverInitializer) -> Self
initialize the dual module, which is supposed to be reused for multiple decoding tasks with the same structure
Source§fn add_dual_node(&mut self, dual_node_ptr: &DualNodePtr)
fn add_dual_node(&mut self, dual_node_ptr: &DualNodePtr)
add corresponding dual node
Source§fn remove_blossom(&mut self, dual_node_ptr: DualNodePtr)
fn remove_blossom(&mut self, dual_node_ptr: DualNodePtr)
remove a blossom, note that this dual node ptr is already expanded from the root: normally you only need to remove this blossom;
when force flag is set, remove blossom even if its dual variable is not 0: this action cannot be undone
Source§fn set_grow_state(
&mut self,
dual_node_ptr: &DualNodePtr,
grow_state: DualNodeGrowState,
)
fn set_grow_state( &mut self, dual_node_ptr: &DualNodePtr, grow_state: DualNodeGrowState, )
update grow state
Source§fn compute_maximum_update_length_dual_node(
&mut self,
dual_node_ptr: &DualNodePtr,
is_grow: bool,
simultaneous_update: bool,
) -> MaxUpdateLength
fn compute_maximum_update_length_dual_node( &mut self, dual_node_ptr: &DualNodePtr, is_grow: bool, simultaneous_update: bool, ) -> MaxUpdateLength
An optional function that helps to break down the implementation of
DualModuleImpl::compute_maximum_update_length
check the maximum length to grow (shrink) specific dual node, if length is 0, give the reason of why it cannot further grow (shrink).
if is_grow is false, return length <= 0, in any case |length| is maximized so that at least one edge becomes fully grown or fully not-grown.
if simultaneous_update is true, also check for the peer node according to DualNode::grow_state.Source§fn compute_maximum_update_length(&mut self) -> GroupMaxUpdateLength
fn compute_maximum_update_length(&mut self) -> GroupMaxUpdateLength
check the maximum length to grow (shrink) for all nodes, return a list of conflicting reason and a single number indicating the maximum length to grow:
this number will be 0 if any conflicting reason presents
Source§fn grow_dual_node(&mut self, dual_node_ptr: &DualNodePtr, length: Weight)
fn grow_dual_node(&mut self, dual_node_ptr: &DualNodePtr, length: Weight)
An optional function that can manipulate individual dual node, not necessarily supported by all implementations
Source§fn grow(&mut self, length: Weight)
fn grow(&mut self, length: Weight)
grow a specific length globally, length must be positive.
note that reversing the process is possible, but not recommended: to do that, reverse the state of each dual node, Grow->Shrink, Shrink->Grow
Source§fn load_edge_modifier(&mut self, edge_modifier: &[(EdgeIndex, Weight)])
fn load_edge_modifier(&mut self, edge_modifier: &[(EdgeIndex, Weight)])
optional support for edge modifier. for example, erasure errors temporarily set some edges to 0 weight.
When it clears, those edges must be reverted back to the original weight
Source§fn prepare_nodes_shrink(
&mut self,
nodes_circle: &[DualNodePtr],
) -> &mut Vec<SyncRequest>
fn prepare_nodes_shrink( &mut self, nodes_circle: &[DualNodePtr], ) -> &mut Vec<SyncRequest>
prepare a list of nodes as shrinking state; useful in creating a blossom
Source§fn add_defect_node(&mut self, dual_node_ptr: &DualNodePtr)
fn add_defect_node(&mut self, dual_node_ptr: &DualNodePtr)
helper function to specifically add a syndrome node
Source§fn add_blossom(&mut self, dual_node_ptr: &DualNodePtr)
fn add_blossom(&mut self, dual_node_ptr: &DualNodePtr)
helper function to specifically add a blossom node
Source§fn load_erasures(&mut self, erasures: &[EdgeIndex])
fn load_erasures(&mut self, erasures: &[EdgeIndex])
an erasure error means this edge is totally uncertain: p=0.5, so new weight = ln((1-p)/p) = 0
fn load_dynamic_weights(&mut self, dynamic_weights: &[(EdgeIndex, Weight)])
Source§fn generate_profiler_report(&self) -> Value
fn generate_profiler_report(&self) -> Value
performance profiler report
Source§fn new_partitioned(
_partitioned_initializer: &PartitionedSolverInitializer,
) -> Selfwhere
Self: Sized,
fn new_partitioned(
_partitioned_initializer: &PartitionedSolverInitializer,
) -> Selfwhere
Self: Sized,
create a partitioned dual module (hosting only a subgraph and subset of dual nodes) to be used in the parallel dual module
Source§fn prepare_all(&mut self) -> &mut Vec<SyncRequest>
fn prepare_all(&mut self) -> &mut Vec<SyncRequest>
prepare the growing or shrinking state of all nodes and return a list of sync requests in case of mirrored vertices are changed
Source§fn execute_sync_event(&mut self, _sync_event: &SyncRequest)
fn execute_sync_event(&mut self, _sync_event: &SyncRequest)
execute a synchronize event by updating the state of a vertex and also update the internal dual node accordingly
Source§fn contains_dual_node(&self, _dual_node_ptr: &DualNodePtr) -> bool
fn contains_dual_node(&self, _dual_node_ptr: &DualNodePtr) -> bool
judge whether the current module hosts the dual node
Source§fn contains_dual_nodes_any(&self, dual_node_ptrs: &[DualNodePtr]) -> bool
fn contains_dual_nodes_any(&self, dual_node_ptrs: &[DualNodePtr]) -> bool
judge whether the current module hosts any of these dual node
Source§fn contains_vertex(&self, _vertex_index: VertexIndex) -> bool
fn contains_vertex(&self, _vertex_index: VertexIndex) -> bool
judge whether the current module hosts a vertex
Source§fn bias_dual_node_index(&mut self, _bias: NodeIndex)
fn bias_dual_node_index(&mut self, _bias: NodeIndex)
bias the global dual node indices
Source§impl<SerialModule: DualModuleImpl + Send + Sync> DualModuleParallelImpl for DualModuleParallel<SerialModule>
impl<SerialModule: DualModuleImpl + Send + Sync> DualModuleParallelImpl for DualModuleParallel<SerialModule>
type UnitType = DualModuleParallelUnit<SerialModule>
fn get_unit(&self, unit_index: usize) -> ArcManualSafeLock<Self::UnitType>
Source§impl<SerialModule: DualModuleImpl + FusionVisualizer + Send + Sync> FusionVisualizer for DualModuleParallel<SerialModule>
impl<SerialModule: DualModuleImpl + FusionVisualizer + Send + Sync> FusionVisualizer for DualModuleParallel<SerialModule>
Auto Trait Implementations§
impl<SerialModule> Freeze for DualModuleParallel<SerialModule>
impl<SerialModule> !RefUnwindSafe for DualModuleParallel<SerialModule>
impl<SerialModule> Send for DualModuleParallel<SerialModule>
impl<SerialModule> Sync for DualModuleParallel<SerialModule>
impl<SerialModule> Unpin for DualModuleParallel<SerialModule>
impl<SerialModule> !UnwindSafe for DualModuleParallel<SerialModule>
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