Skip to content

(torchx/components) dist.ddp add env to component param #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion torchx/components/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
-----------------
"""
from pathlib import Path
from typing import Optional
from typing import Dict, Optional

import torchx
import torchx.specs as specs
Expand All @@ -139,6 +139,7 @@ def ddp(
memMB: int = 1024,
h: Optional[str] = None,
j: str = "1x2",
env: Optional[Dict[str, str]] = None,
rdzv_endpoint: str = "etcd-server.default.svc.cluster.local:2379",
) -> specs.AppDef:
"""
Expand All @@ -160,6 +161,7 @@ def ddp(
memMB: cpu memory in MB per replica
h: a registered named resource (if specified takes precedence over cpu, gpu, memMB)
j: {nnodes}x{nproc_per_node}, for gpu hosts, nproc_per_node must not exceed num gpus
env: environment varibles to be passed to the run (e.g. ENV1=v1,ENV2=v2,ENV3=v3)
rdzv_endpoint: etcd server endpoint (only matters when nnodes > 1)
"""

Expand Down Expand Up @@ -199,6 +201,7 @@ def ddp(
script,
*script_args,
],
env=env or {},
)
],
)