Skip to content

Commit 083843d

Browse files
committed
additional variables, and fixed fnmatch bug
1 parent 54b3017 commit 083843d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/torchrunx/launcher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def launch(
3232
ssh_config_file: str | os.PathLike | None = None,
3333
backend: Literal["mpi", "gloo", "nccl", "ucc"] | None = None,
3434
log_dir: str = "./logs",
35-
clone_env_vars: list[str] = ["PYTHON*", "CUDA*"],
35+
clone_env_vars: list[str] = ["PYTHON*", "CUDA*", "TORCH*", "PYTORCH*", "NCCL*"],
3636
env_file: str | os.PathLike | None = None,
3737
):
3838
if not dist.is_available():
@@ -77,14 +77,14 @@ def launch(
7777

7878
log_dir = os.path.abspath(log_dir)
7979

80+
explicit_env_vars = ["PATH", "LD_LIBRARY", "LIBRARY_PATH"]
8081
env_export_string = " ".join(
8182
f'{k}="{v}"'
8283
for k, v in os.environ.items()
83-
if any(fnmatch.fnmatch(e, k) for e in clone_env_vars)
84+
if any(fnmatch.fnmatch(k, e) for e in clone_env_vars + explicit_env_vars)
8485
)
8586
if env_export_string != "":
8687
env_export_string = f"export {env_export_string} && "
87-
8888
env_file_string = f"source {env_file} && " if env_file is not None else ""
8989

9090
# start agents on each node

0 commit comments

Comments
 (0)