DDPContextManager#
- class DDPContextManager[source]#
Bases:
AbstractContextManagerContext manager for initializing and destroying DDP process groups.
Note that this context manager does not start processes itself, but merely calls
torch.distributed.init_process_group()andtorch.distributed.destroy_process_group()and sets DDP-related fields in theLearnerto appropriate values.If a process group is already initialized, this context manager does nothing on either entry or exit.
- __init__(learner: Learner, rank: int | None = None, world_size: int | None = None) None[source]#
Constructor.
- Parameters
- Raises
ValueError – If
rankorworld_sizenot provided and aren’t set on theLearner.- Return type
None
Methods
__init__(learner[, rank, world_size])Constructor.