-
Notifications
You must be signed in to change notification settings - Fork 26
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
pierre.delaunay
committed
Jul 23, 2024
1 parent
eadc264
commit 67047d6
Showing
8 changed files
with
111 additions
and
24 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import subprocess | ||
|
||
from torch.distributed.run import main as torchrun | ||
import torch.distributed.elastic.multiprocessing.api as elastic | ||
import torch.distributed.elastic.multiprocessing.subprocess_handler as sub | ||
|
||
|
||
class NewSubprocessHandler(sub.SubprocessHandler): | ||
def _popen(self, args, env) -> subprocess.Popen: | ||
kwargs = {} | ||
|
||
if fd := os.getenv("DATA_FD"): | ||
kwargs["pass_fds"] = [int(fd)] | ||
|
||
return subprocess.Popen( | ||
args=args, | ||
env=env, | ||
stdout=self._stdout, | ||
stderr=self._stderr, | ||
**kwargs, | ||
) | ||
|
||
def get_subprocess_handler( | ||
entrypoint: str, | ||
args, | ||
env, | ||
stdout: str, | ||
stderr: str, | ||
local_rank_id: int, | ||
): | ||
return NewSubprocessHandler( | ||
entrypoint=entrypoint, | ||
args=args, | ||
env=env, | ||
stdout=stdout, | ||
stderr=stderr, | ||
local_rank_id=local_rank_id, | ||
) | ||
|
||
|
||
def main(args=None): | ||
elastic.get_subprocess_handler = get_subprocess_handler | ||
elastic.SubprocessHandler = NewSubprocessHandler | ||
|
||
torchrun(args) | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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 |
---|---|---|
|
@@ -39,6 +39,7 @@ def give_push(): | |
if ov is not None: | ||
return ov.give | ||
|
||
print("No overseer found") | ||
return file_push() | ||
|
||
|
||
|
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
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