[mpich2-commits] r4161 - in mpich2/trunk/src/pm/hydra/launcher: mpiexec utils

balaji at mcs.anl.gov balaji at mcs.anl.gov
Sun Mar 22 15:25:45 CDT 2009


Author: balaji
Date: 2009-03-22 15:25:45 -0500 (Sun, 22 Mar 2009)
New Revision: 4161

Modified:
   mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c
   mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c
Log:
Some more fixes to the environment passing. This time for environment
variables that are local for each executable.


Modified: mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c	2009-03-22 18:09:06 UTC (rev 4160)
+++ mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c	2009-03-22 20:25:45 UTC (rev 4161)
@@ -32,7 +32,7 @@
 
 HYD_Status HYD_LCHI_get_parameters(char **t_argv)
 {
-    int i, env_pref;
+    int i;
     char **argv = t_argv;
     char *env_name, *env_value, *str1, *str2, *progname = *argv;
     HYD_Env_t *env;
@@ -279,8 +279,10 @@
     status = HYDU_get_base_path(progname, handle.wdir, &handle.base_path);
     HYDU_ERR_POP(status, "unable to get base path\n");
 
+    if (handle.prop == HYD_ENV_PROP_UNSET)
+        handle.prop = HYD_ENV_PROP_ALL;
+
     /* Check if any individual app has an environment preference */
-    env_pref = 0;
     for (exec_info = handle.exec_info_list; exec_info; exec_info = exec_info->next) {
         if (exec_info->exec[0] == NULL)
             HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "no executable specified\n");
@@ -288,21 +290,11 @@
         if (exec_info->exec_proc_count == 0)
             exec_info->exec_proc_count = 1;
 
-        if (handle.prop == HYD_ENV_PROP_UNSET && exec_info->prop != HYD_ENV_PROP_UNSET)
-            env_pref = 1;
+        /* If no local env property is set, use the global one */
+        if (exec_info->prop == HYD_ENV_PROP_UNSET)
+            exec_info->prop = handle.prop;
     }
 
-    /* Only if someone has an individual preference, assign executable
-     * specific environment. Otherwise, just optimize by setting one
-     * global environment (common case). */
-    if (env_pref) {
-        for (exec_info = handle.exec_info_list; exec_info; exec_info = exec_info->next)
-            if (exec_info->prop == HYD_ENV_PROP_UNSET)
-                exec_info->prop = HYD_ENV_PROP_ALL;
-    }
-    else if (handle.prop == HYD_ENV_PROP_UNSET)
-        handle.prop = HYD_ENV_PROP_ALL;
-
     if (handle.proxy_port == -1)
         handle.proxy_port = HYD_DEFAULT_PROXY_PORT;
 

Modified: mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c	2009-03-22 18:09:06 UTC (rev 4160)
+++ mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c	2009-03-22 20:25:45 UTC (rev 4161)
@@ -113,6 +113,12 @@
             HYDU_ERR_POP(status, "unable to add env to list\n");
         }
     }
+    else if (handle.prop == HYD_ENV_PROP_NONE) {
+        for (env = handle.user_env; env; env = env->next) {
+            status = HYDU_append_env_to_list(*env, &handle.prop_env);
+            HYDU_ERR_POP(status, "unable to add env to list\n");
+        }
+    }
     else if (handle.prop == HYD_ENV_PROP_LIST) {
         for (env = handle.user_env; env; env = env->next) {
             run = HYDU_env_lookup(*env, handle.global_env);
@@ -132,6 +138,12 @@
                 HYDU_ERR_POP(status, "unable to add env to list\n");
             }
         }
+        else if (exec_info->prop == HYD_ENV_PROP_NONE) {
+            for (env = exec_info->user_env; env; env = env->next) {
+                status = HYDU_append_env_to_list(*env, &exec_info->prop_env);
+                HYDU_ERR_POP(status, "unable to add env to list\n");
+            }
+        }
         else if (exec_info->prop == HYD_ENV_PROP_LIST) {
             for (env = exec_info->user_env; env; env = env->next) {
                 run = HYDU_env_lookup(*env, handle.global_env);



More information about the mpich2-commits mailing list