pub struct MmapGradientAccumulator { /* private fields */ }Expand description
Memory-mapped gradient accumulator with fine-grained locking.
Allows multiple threads to accumulate gradients concurrently with minimal contention. Uses reader-writer locks at a configurable granularity.
Implementations§
Source§impl MmapGradientAccumulator
impl MmapGradientAccumulator
Sourcepub fn grad_offset(&self, node_id: u64) -> Option<usize>
pub fn grad_offset(&self, node_id: u64) -> Option<usize>
Sourcepub fn accumulate(&self, node_id: u64, grad: &[f32])
pub fn accumulate(&self, node_id: u64, grad: &[f32])
Sourcepub fn apply(&mut self, learning_rate: f32, embeddings: &mut MmapManager)
pub fn apply(&mut self, learning_rate: f32, embeddings: &mut MmapManager)
Apply accumulated gradients to embeddings and zero out gradients.
§Arguments
learning_rate- Learning rate for gradient descentembeddings- Embedding manager to update
Trait Implementations§
Source§impl Drop for MmapGradientAccumulator
impl Drop for MmapGradientAccumulator
impl Send for MmapGradientAccumulator
impl Sync for MmapGradientAccumulator
Auto Trait Implementations§
impl !Freeze for MmapGradientAccumulator
impl !RefUnwindSafe for MmapGradientAccumulator
impl Unpin for MmapGradientAccumulator
impl UnsafeUnpin for MmapGradientAccumulator
impl UnwindSafe for MmapGradientAccumulator
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