pub struct SharedCoordinator {
pub global_min_cut: AtomicU16,
pub completed_cores: AtomicU16,
pub phase: AtomicU8,
pub queue_head: AtomicU16,
pub queue_tail: AtomicU16,
pub best_core: AtomicU8,
/* private fields */
}Expand description
Shared state for coordination (fits in shared memory)
Fields§
§global_min_cut: AtomicU16Global minimum cut found so far
completed_cores: AtomicU16Number of cores that have completed (u16 to support NUM_CORES=256)
phase: AtomicU8Current phase
queue_head: AtomicU16Work queue head (for work stealing)
queue_tail: AtomicU16Work queue tail
best_core: AtomicU8Best result core ID
Implementations§
pub const PHASE_INIT: u8 = 0u8
pub const PHASE_DISTRIBUTE: u8 = 1u8
pub const PHASE_COMPUTE: u8 = 2u8
pub const PHASE_COLLECT: u8 = 3u8
pub const PHASE_DONE: u8 = 4u8
pub fn new() -> Self
Sourcepub fn try_update_min(&self, new_min: u16, core_id: u8) -> bool
pub fn try_update_min(&self, new_min: u16, core_id: u8) -> bool
Try to update global minimum (atomic compare-and-swap)
Sourcepub fn mark_completed(&self) -> u16
pub fn mark_completed(&self) -> u16
Mark core as completed
Sourcepub fn all_completed(&self) -> bool
pub fn all_completed(&self) -> bool
Check if all cores completed
Auto Trait Implementations§
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