pub struct DistributedDataParallel { /* private fields */ }Expand description
Distributed Data Parallel model wrapper for multi-node training
Implementations§
Source§impl DistributedDataParallel
impl DistributedDataParallel
Sourcepub fn new(
model: Box<dyn Model<f32>>,
device: Device,
process_group: Arc<CommunicationGroup>,
comm_runtime: Arc<RwLock<CommunicationRuntime>>,
config: DDPConfig,
) -> Result<Self>
pub fn new( model: Box<dyn Model<f32>>, device: Device, process_group: Arc<CommunicationGroup>, comm_runtime: Arc<RwLock<CommunicationRuntime>>, config: DDPConfig, ) -> Result<Self>
Create new DistributedDataParallel model wrapper
Sourcepub fn sync_gradients(&mut self) -> Result<()>
pub fn sync_gradients(&mut self) -> Result<()>
Perform gradient synchronization using all-reduce
Sourcepub fn process_group(&self) -> &CommunicationGroup
pub fn process_group(&self) -> &CommunicationGroup
Get process group information
Sourcepub fn local_rank(&self) -> usize
pub fn local_rank(&self) -> usize
Get local rank within process group
Sourcepub fn world_size(&self) -> usize
pub fn world_size(&self) -> usize
Get world size (total number of processes)
Sourcepub fn set_bucket_size(&mut self, size: usize)
pub fn set_bucket_size(&mut self, size: usize)
Set bucket size for gradient communication
Trait Implementations§
Source§impl Model<f32> for DistributedDataParallel
impl Model<f32> for DistributedDataParallel
Auto Trait Implementations§
impl Freeze for DistributedDataParallel
impl !RefUnwindSafe for DistributedDataParallel
impl !Send for DistributedDataParallel
impl !Sync for DistributedDataParallel
impl Unpin for DistributedDataParallel
impl UnsafeUnpin for DistributedDataParallel
impl !UnwindSafe for DistributedDataParallel
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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