You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by cj...@apache.org on 2018/01/31 19:34:21 UTC

[incubator-mxnet] branch master updated: Allow user to pass specific environment variables for server/worker/both through launch.py (#9049)

This is an automated email from the ASF dual-hosted git repository.

cjolivier01 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 134c584  Allow user to pass specific environment variables for server/worker/both through launch.py (#9049)
134c584 is described below

commit 134c584b22298dc714d7868629ea020f8538c365
Author: Rahul Huilgol <ra...@gmail.com>
AuthorDate: Wed Jan 31 11:34:12 2018 -0800

    Allow user to pass specific environment variables for server/worker/both through launch.py (#9049)
    
    * add support for env-server env-worker and env in launch.py
    
    * bring back unintended revert
---
 tools/launch.py | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/tools/launch.py b/tools/launch.py
index de42ea2..0908950 100755
--- a/tools/launch.py
+++ b/tools/launch.py
@@ -36,7 +36,14 @@ def dmlc_opts(opts):
             '--cluster', opts.launcher,
             '--host-file', opts.hostfile,
             '--sync-dst-dir', opts.sync_dst_dir]
-    args += opts.command;
+
+    # convert to dictionary
+    dopts = vars(opts)
+    for key in ['env_server', 'env_worker', 'env']:
+        for v in dopts[key]:
+            args.append('--' + key.replace("_","-"))
+            args.append(v)
+    args += opts.command
     try:
         from dmlc_tracker import opts
     except ImportError:
@@ -64,6 +71,21 @@ def main():
     parser.add_argument('--launcher', type=str, default='ssh',
                         choices = ['local', 'ssh', 'mpi', 'sge', 'yarn'],
                         help = 'the launcher to use')
+    parser.add_argument('--env-server', action='append', default=[],
+                        help = 'Given a pair of environment_variable:value, sets this value of \
+                        environment variable for the server processes. This overrides values of \
+                        those environment variable on the machine where this script is run from. \
+                        Example OMP_NUM_THREADS:3')
+    parser.add_argument('--env-worker', action='append', default=[],
+                        help = 'Given a pair of environment_variable:value, sets this value of \
+                        environment variable for the worker processes. This overrides values of \
+                        those environment variable on the machine where this script is run from. \
+                        Example OMP_NUM_THREADS:3')
+    parser.add_argument('--env', action='append', default=[],
+                        help = 'given a environment variable, passes their \
+                        values from current system to all workers and servers. \
+                        Not necessary when launcher is local as in that case \
+                        all environment variables which are set are copied.')
     parser.add_argument('command', nargs='+',
                         help = 'command for launching the program')
     args, unknown = parser.parse_known_args()

-- 
To stop receiving notification emails like this one, please contact
cjolivier01@apache.org.