DualModuleParallel

Struct DualModuleParallel 

Source
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: DualModuleParallelConfig

local 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>

Source

pub fn new_config( initializer: &SolverInitializer, partition_info: &PartitionInfo, config: DualModuleParallelConfig, ) -> Self

recommended way to create a new instance, given a customized configuration

Source

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)

Source

pub fn find_active_ancestor_option( &self, dual_node_ptr: &DualNodePtr, ) -> Option<DualModuleParallelUnitPtr<SerialModule>>

Source

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>

Source§

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 clear(&mut self)

clear all growth and existing dual nodes

Source§

fn add_dual_node(&mut self, dual_node_ptr: &DualNodePtr)

add corresponding dual node
Source§

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, )

update grow state
Source§

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

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)

An optional function that can manipulate individual dual node, not necessarily supported by all implementations
Source§

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)])

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>

prepare a list of nodes as shrinking state; useful in creating a blossom
Source§

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)

helper function to specifically add a blossom node
Source§

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
Source§

fn load_dynamic_weights(&mut self, dynamic_weights: &[(EdgeIndex, Weight)])

Source§

fn generate_profiler_report(&self) -> Value

performance profiler report
Source§

fn new_partitioned( _partitioned_initializer: &PartitionedSolverInitializer, ) -> Self
where 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>

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)

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

judge whether the current module hosts the dual node
Source§

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

judge whether the current module hosts a vertex
Source§

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>

Source§

type UnitType = DualModuleParallelUnit<SerialModule>

Source§

fn get_unit(&self, unit_index: usize) -> ArcManualSafeLock<Self::UnitType>

Source§

impl<SerialModule: DualModuleImpl + FusionVisualizer + Send + Sync> FusionVisualizer for DualModuleParallel<SerialModule>

Source§

fn snapshot(&self, abbrev: bool) -> Value

take a snapshot, set abbrev to true to save space

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> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

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
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V