[mpich2-commits] r4022 - in mpich2/trunk/src/pm/hydra: bootstrap/ssh include launcher/mpiexec pm/central utils/args

balaji at mcs.anl.gov balaji at mcs.anl.gov
Thu Mar 12 02:38:31 CDT 2009


Author: balaji
Date: 2009-03-12 02:38:31 -0500 (Thu, 12 Mar 2009)
New Revision: 4022

Modified:
   mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c
   mpich2/trunk/src/pm/hydra/include/hydra_utils.h
   mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c
   mpich2/trunk/src/pm/hydra/pm/central/central_launch.c
   mpich2/trunk/src/pm/hydra/pm/central/proxy.c
   mpich2/trunk/src/pm/hydra/pm/central/proxy.h
   mpich2/trunk/src/pm/hydra/pm/central/proxy_utils.c
   mpich2/trunk/src/pm/hydra/utils/args/args.c
Log:
Pass the working directory to the proxy instead of explicitly cd'ing to
that directory in the executed command. Right now, either version should
work, but the newer model is better when we do hierarchical proxies. As
a side-effect, we do not have to use sh within ssh anymore, since we
have a single command executed now.


Modified: mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c	2009-03-12 07:00:51 UTC (rev 4021)
+++ mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c	2009-03-12 07:38:31 UTC (rev 4022)
@@ -52,14 +52,9 @@
             /* ssh does not support any partition names other than host names */
             client_arg[arg++] = MPIU_Strdup(partition->name);
 
-            client_arg[arg++] = MPIU_Strdup("sh");
-            client_arg[arg++] = MPIU_Strdup("-c");
-            client_arg[arg++] = MPIU_Strdup("\"");
-
             for (i = 0; partition->args[i]; i++)
                 client_arg[arg++] = MPIU_Strdup(partition->args[i]);
 
-            client_arg[arg++] = MPIU_Strdup("\"");
             client_arg[arg++] = NULL;
 
             /* The stdin pointer will be some value for process_id 0;

Modified: mpich2/trunk/src/pm/hydra/include/hydra_utils.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_utils.h	2009-03-12 07:00:51 UTC (rev 4021)
+++ mpich2/trunk/src/pm/hydra/include/hydra_utils.h	2009-03-12 07:38:31 UTC (rev 4022)
@@ -67,6 +67,7 @@
 HYD_Status HYDU_Create_process(char **client_arg, int *in, int *out, int *err, int *pid);
 HYD_Status HYDU_Dump_args(char **args);
 HYD_Status HYDU_Get_base_path(char *execname, char **path);
+HYD_Status HYDU_Chdir(const char *dir);
 
 
 /* Memory utilities */

Modified: mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c	2009-03-12 07:00:51 UTC (rev 4021)
+++ mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c	2009-03-12 07:38:31 UTC (rev 4022)
@@ -20,12 +20,13 @@
     printf("Global Options (passed to all executables):\n");
     printf("\t-v/-vv/-vvv                      [Verbose level]\n");
     printf("\t--enable-x/--disable-x           [Enable or disable X forwarding]\n");
+    printf("\t--proxy-port                     [Port on which proxies can listen]\n");
     printf("\t-genv {name} {value}             [Environment variable name and value]\n");
     printf("\t-genvlist {env1,env2,...}        [Environment variable list to pass]\n");
     printf("\t-genvnone                        [Do not pass any environment variables]\n");
     printf("\t-genvall                         [Pass all environment variables (default)]\n");
     printf("\t-f {name}                        [File containing the host names]\n");
-    printf("\t--proxy-port                     [Port on which proxies can listen]\n");
+    printf("\t-wdir {dirname}                  [Working directory to use]\n");
 
     printf("\n");
 

Modified: mpich2/trunk/src/pm/hydra/pm/central/central_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/central/central_launch.c	2009-03-12 07:00:51 UTC (rev 4021)
+++ mpich2/trunk/src/pm/hydra/pm/central/central_launch.c	2009-03-12 07:38:31 UTC (rev 4022)
@@ -126,10 +126,6 @@
             partition->group_id = group_id++;
             partition->group_rank = 0;
 
-            /* Pass the entire environment here; the proxy will cherry
-             * pick from this. */
-            HYDU_Append_wdir(partition->args, handle.wdir);
-
             for (arg = 0; partition->args[arg]; arg++);
             i = 0;
             path_str[i++] = MPIU_Strdup(handle.base_path);
@@ -176,6 +172,9 @@
             partition->args[arg++] = MPIU_Strdup(str);
             HYDU_FREE(str);
 
+            partition->args[arg++] = MPIU_Strdup("--wdir");
+            partition->args[arg++] = MPIU_Strdup(handle.wdir);
+
             partition->args[arg++] = MPIU_Strdup("--environment");
             i = 0;
             for (env = handle.system_env; env; env = env->next)

Modified: mpich2/trunk/src/pm/hydra/pm/central/proxy.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/central/proxy.c	2009-03-12 07:00:51 UTC (rev 4021)
+++ mpich2/trunk/src/pm/hydra/pm/central/proxy.c	2009-03-12 07:38:31 UTC (rev 4022)
@@ -86,7 +86,16 @@
             goto fn_fail;
         }
         HYDU_Env_putenv(str);
+        HYDU_FREE(str);
+        for (j = 0; tmp[j]; j++)
+            HYDU_FREE(tmp[j]);
 
+        status = HYDU_Chdir(HYD_Proxy_params.wdir);
+        if (status != HYD_SUCCESS) {
+            HYDU_Error_printf("unable to change to wdir %s\n", HYD_Proxy_params.wdir);
+            goto fn_fail;
+        }
+
         for (j = 0, arg = 0; HYD_Proxy_params.args[j]; j++)
             client_args[arg++] = MPIU_Strdup(HYD_Proxy_params.args[j]);
         client_args[arg++] = NULL;

Modified: mpich2/trunk/src/pm/hydra/pm/central/proxy.h
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/central/proxy.h	2009-03-12 07:00:51 UTC (rev 4021)
+++ mpich2/trunk/src/pm/hydra/pm/central/proxy.h	2009-03-12 07:38:31 UTC (rev 4022)
@@ -17,6 +17,7 @@
     int proxy_port;
     int pmi_id;
     char *args[HYD_EXEC_ARGS];
+    char *wdir;
     struct HYD_Partition_list *partition;
 
     int *pid;

Modified: mpich2/trunk/src/pm/hydra/pm/central/proxy_utils.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/central/proxy_utils.c	2009-03-12 07:00:51 UTC (rev 4021)
+++ mpich2/trunk/src/pm/hydra/pm/central/proxy_utils.c	2009-03-12 07:38:31 UTC (rev 4022)
@@ -73,6 +73,13 @@
             continue;
         }
 
+        /* Working directory */
+        if (!strcmp(*argv, "--wdir")) {
+            argv++;
+            HYD_Proxy_params.wdir = MPIU_Strdup(*argv);
+            continue;
+        }
+
         /* Environment information is passed as a list of names; we
          * need to find the values from our environment. */
         if (!strcmp(*argv, "--environment")) {

Modified: mpich2/trunk/src/pm/hydra/utils/args/args.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/args/args.c	2009-03-12 07:00:51 UTC (rev 4021)
+++ mpich2/trunk/src/pm/hydra/utils/args/args.c	2009-03-12 07:38:31 UTC (rev 4022)
@@ -125,3 +125,25 @@
   fn_fail:
     goto fn_exit;
 }
+
+
+HYD_Status HYDU_Chdir(const char *dir)
+{
+    char *home;
+    HYD_Status status = HYD_SUCCESS;
+
+    HYDU_FUNC_ENTER();
+
+    if (chdir(dir) < 0) {
+        status = HYD_INTERNAL_ERROR;
+        HYDU_Error_printf("chdir failed\n");
+        goto fn_fail;
+    }
+
+  fn_exit:
+    HYDU_FUNC_EXIT();
+    return status;
+
+  fn_fail:
+    goto fn_exit;
+}



More information about the mpich2-commits mailing list