Skip to content

Commit e01d57c

Browse files
Kiuk Chungfacebook-github-bot
Kiuk Chung
authored andcommitted
(torchx/components) dist.ddp add env to component param (#399)
Summary: Pull Request resolved: #399 see title Reviewed By: aivanou Differential Revision: D34331686 fbshipit-source-id: aaf39602b1bbc3b15add781f281f3b78b6130d8e
1 parent ca1973d commit e01d57c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

torchx/components/dist.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
-----------------
123123
"""
124124
from pathlib import Path
125-
from typing import Optional
125+
from typing import Dict, Optional
126126

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

@@ -199,6 +201,7 @@ def ddp(
199201
script,
200202
*script_args,
201203
],
204+
env=env or {},
202205
)
203206
],
204207
)

0 commit comments

Comments
 (0)