-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
15 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1 @@ | ||
import torch.distributed as dist | ||
from torch.distributed.device_mesh import init_device_mesh | ||
|
||
|
||
class ElasticDeviceMesh: | ||
"""A class to manage the process groups for elastic training without restarts.""" | ||
|
||
local_pg: dist.ProcessGroup | ||
|
||
def __init__(self): | ||
# Initialize local process group | ||
dist.init_process_group() | ||
self.local_pg = dist.get_default_group() | ||
self.cuda_local_mesh = init_device_mesh("cuda", mesh_shape=(self.local_pg.size(),)) | ||
|
||
self.global_pccl_communicator = ... | ||
class PcclCommunicator: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters