[mpich2-commits] r5442 - in mpich2/trunk/src/pm/hydra: include pm/pmiserv ui/mpiexec ui/utils utils/launch
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Sat Oct 10 20:12:37 CDT 2009
Author: balaji
Date: 2009-10-10 20:12:37 -0500 (Sat, 10 Oct 2009)
New Revision: 5442
Modified:
mpich2/trunk/src/pm/hydra/include/hydra.h
mpich2/trunk/src/pm/hydra/include/hydra_base.h
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_proxy.h
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_proxy_utils.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_serv_launch.c
mpich2/trunk/src/pm/hydra/ui/mpiexec/mpiexec.c
mpich2/trunk/src/pm/hydra/ui/mpiexec/utils.c
mpich2/trunk/src/pm/hydra/ui/utils/uiu.c
mpich2/trunk/src/pm/hydra/ui/utils/uiu.h
mpich2/trunk/src/pm/hydra/utils/launch/allocate.c
Log:
Redid parts of the environment management code to make it more
manageable, and fixed some random corner case bugs on the way.
Modified: mpich2/trunk/src/pm/hydra/include/hydra.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra.h 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/include/hydra.h 2009-10-11 01:12:37 UTC (rev 5442)
@@ -40,11 +40,7 @@
int ranks_per_proc;
char *bootstrap_exec;
- /* Global environment */
- HYD_Env_t *system_env;
- HYD_Env_t *user_env;
- HYD_Env_t *inherited_env;
- HYD_Env_prop_t prop;
+ struct HYD_Env_global global_env;
HYD_Status(*stdin_cb) (int fd, HYD_Event_t events, void *userp);
HYD_Status(*stdout_cb) (int fd, HYD_Event_t events, void *userp);
Modified: mpich2/trunk/src/pm/hydra/include/hydra_base.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_base.h 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/include/hydra_base.h 2009-10-11 01:12:37 UTC (rev 5442)
@@ -134,6 +134,13 @@
HYD_ENV_PROP_LIST
} HYD_Env_prop_t;
+struct HYD_Env_global {
+ HYD_Env_t *system;
+ HYD_Env_t *user;
+ HYD_Env_t *inherited;
+ char *prop;
+};
+
/* List of contiguous segments of processes on a partition */
struct HYD_Partition_segment {
int start_pid;
@@ -146,8 +153,8 @@
struct HYD_Partition_exec {
char *exec[HYD_NUM_TMP_STRINGS];
int proc_count;
- HYD_Env_prop_t prop;
HYD_Env_t *user_env;
+ char *env_prop;
int pgid; /* All executables with the same PGID belong to the same
* job. */
@@ -221,7 +228,7 @@
/* Local environment */
HYD_Env_t *user_env;
- HYD_Env_prop_t prop;
+ char *env_prop;
struct HYD_Exec_info *next;
};
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_proxy.h
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_proxy.h 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_proxy.h 2009-10-11 01:12:37 UTC (rev 5442)
@@ -35,10 +35,7 @@
char *ckpoint_prefix;
int ckpoint_restart;
- HYD_Env_t *system_env;
- HYD_Env_t *user_env;
- HYD_Env_t *inherited_env;
- HYD_Env_prop_t genv_prop;
+ struct HYD_Env_global global_env;
int global_core_count;
int partition_core_count;
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_proxy_utils.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_proxy_utils.c 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_proxy_utils.c 2009-10-11 01:12:37 UTC (rev 5442)
@@ -34,9 +34,9 @@
HYD_PMCD_pmi_proxy_params.ckpoint_prefix = NULL;
HYD_PMCD_pmi_proxy_params.ckpoint_restart = 0;
- HYD_PMCD_pmi_proxy_params.system_env = NULL;
- HYD_PMCD_pmi_proxy_params.user_env = NULL;
- HYD_PMCD_pmi_proxy_params.inherited_env = NULL;
+ HYD_PMCD_pmi_proxy_params.global_env.system = NULL;
+ HYD_PMCD_pmi_proxy_params.global_env.user = NULL;
+ HYD_PMCD_pmi_proxy_params.global_env.inherited = NULL;
HYD_PMCD_pmi_proxy_params.global_core_count = 0;
HYD_PMCD_pmi_proxy_params.partition_core_count = 0;
@@ -165,11 +165,14 @@
env = HYDU_str_to_env(str);
if (!strcmp(argtype, "--global-inherited-env"))
- HYDU_append_env_to_list(*env, &HYD_PMCD_pmi_proxy_params.inherited_env);
+ HYDU_append_env_to_list(*env,
+ &HYD_PMCD_pmi_proxy_params.global_env.inherited);
else if (!strcmp(argtype, "--global-system-env"))
- HYDU_append_env_to_list(*env, &HYD_PMCD_pmi_proxy_params.system_env);
+ HYDU_append_env_to_list(*env,
+ &HYD_PMCD_pmi_proxy_params.global_env.system);
else if (!strcmp(argtype, "--global-user-env"))
- HYDU_append_env_to_list(*env, &HYD_PMCD_pmi_proxy_params.user_env);
+ HYDU_append_env_to_list(*env,
+ &HYD_PMCD_pmi_proxy_params.global_env.user);
HYDU_FREE(env);
}
@@ -179,8 +182,10 @@
/* Global environment type */
if (!strcmp(*argv, "--genv-prop")) {
argv++;
- HYD_PMCD_pmi_proxy_params.genv_prop =
- (HYD_Env_prop_t) (unsigned int) atoi(*argv);
+ if (strcmp(*argv, "HYDRA_NULL"))
+ HYD_PMCD_pmi_proxy_params.global_env.prop = HYDU_strdup(*argv);
+ else
+ HYD_PMCD_pmi_proxy_params.global_env.prop = NULL;
continue;
}
@@ -272,7 +277,10 @@
/* Global environment type */
if (!strcmp(*argv, "--exec-env-prop")) {
argv++;
- exec->prop = (HYD_Env_prop_t) (unsigned int) atoi(*argv);
+ if (strcmp(*argv, "HYDRA_NULL"))
+ exec->env_prop = HYDU_strdup(*argv);
+ else
+ exec->env_prop = NULL;
continue;
}
@@ -419,14 +427,14 @@
if (HYD_PMCD_pmi_proxy_params.ckpoint_prefix)
HYDU_FREE(HYD_PMCD_pmi_proxy_params.ckpoint_prefix);
- if (HYD_PMCD_pmi_proxy_params.system_env)
- HYDU_env_free_list(HYD_PMCD_pmi_proxy_params.system_env);
+ if (HYD_PMCD_pmi_proxy_params.global_env.system)
+ HYDU_env_free_list(HYD_PMCD_pmi_proxy_params.global_env.system);
- if (HYD_PMCD_pmi_proxy_params.user_env)
- HYDU_env_free_list(HYD_PMCD_pmi_proxy_params.user_env);
+ if (HYD_PMCD_pmi_proxy_params.global_env.user)
+ HYDU_env_free_list(HYD_PMCD_pmi_proxy_params.global_env.user);
- if (HYD_PMCD_pmi_proxy_params.inherited_env)
- HYDU_env_free_list(HYD_PMCD_pmi_proxy_params.inherited_env);
+ if (HYD_PMCD_pmi_proxy_params.global_env.inherited)
+ HYDU_env_free_list(HYD_PMCD_pmi_proxy_params.global_env.inherited);
if (HYD_PMCD_pmi_proxy_params.segment_list) {
segment = HYD_PMCD_pmi_proxy_params.segment_list;
@@ -529,7 +537,7 @@
HYD_Status HYD_PMCD_pmi_proxy_launch_procs(void)
{
int i, j, arg, stdin_fd, process_id, core, pmi_id;
- char *str;
+ char *str, *envstr, *list;
char *client_args[HYD_NUM_TMP_STRINGS];
HYD_Env_t *env, *prop_env = NULL;
struct HYD_Partition_segment *segment;
@@ -605,20 +613,37 @@
* - System env
*/
- /* Global inherited env is set when either genvall or envall
- * is specified. */
- if ((exec->prop != HYD_ENV_PROP_NONE) &&
- ((exec->prop == HYD_ENV_PROP_ALL) ||
- (exec->prop == HYD_ENV_PROP_UNSET &&
- HYD_PMCD_pmi_proxy_params.genv_prop == HYD_ENV_PROP_ALL))) {
- for (env = HYD_PMCD_pmi_proxy_params.inherited_env; env; env = env->next) {
+ /* Global inherited env */
+ if ((exec->env_prop && !strcmp(exec->env_prop, "all")) ||
+ (!exec->env_prop && !strcmp(HYD_PMCD_pmi_proxy_params.global_env.prop, "all"))) {
+ for (env = HYD_PMCD_pmi_proxy_params.global_env.inherited; env; env = env->next) {
status = HYDU_append_env_to_list(*env, &prop_env);
HYDU_ERR_POP(status, "unable to add env to list\n");
}
}
+ else if ((exec->env_prop && !strncmp(exec->env_prop, "list", strlen("list"))) ||
+ (!exec->env_prop &&
+ !strncmp(HYD_PMCD_pmi_proxy_params.global_env.prop, "list",
+ strlen("list")))) {
+ if (exec->env_prop)
+ list = HYDU_strdup(exec->env_prop + strlen("list:"));
+ else
+ list = HYDU_strdup(HYD_PMCD_pmi_proxy_params.global_env.prop + strlen("list:"));
+ envstr = strtok(list, ",");
+ while (envstr) {
+ for (env = HYD_PMCD_pmi_proxy_params.global_env.inherited;
+ env && strcmp(env->env_name, envstr); env = env->next);
+ if (env) {
+ status = HYDU_append_env_to_list(*env, &prop_env);
+ HYDU_ERR_POP(status, "unable to add env to list\n");
+ }
+ envstr = strtok(NULL, ",");
+ }
+ }
+
/* Next priority order is the global user env */
- for (env = HYD_PMCD_pmi_proxy_params.user_env; env; env = env->next) {
+ for (env = HYD_PMCD_pmi_proxy_params.global_env.user; env; env = env->next) {
status = HYDU_append_env_to_list(*env, &prop_env);
HYDU_ERR_POP(status, "unable to add env to list\n");
}
@@ -630,7 +655,7 @@
}
/* Highest priority is the system env */
- for (env = HYD_PMCD_pmi_proxy_params.system_env; env; env = env->next) {
+ for (env = HYD_PMCD_pmi_proxy_params.global_env.system; env; env = env->next) {
status = HYDU_append_env_to_list(*env, &prop_env);
HYDU_ERR_POP(status, "unable to add env to list\n");
}
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_serv_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_serv_launch.c 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_serv_launch.c 2009-10-11 01:12:37 UTC (rev 5442)
@@ -209,11 +209,11 @@
/* Create the arguments list for each proxy */
process_id = 0;
FORALL_ACTIVE_PARTITIONS(partition, HYD_handle.partition_list) {
- for (inherited_env_count = 0, env = HYD_handle.inherited_env; env;
+ for (inherited_env_count = 0, env = HYD_handle.global_env.inherited; env;
env = env->next, inherited_env_count++);
- for (user_env_count = 0, env = HYD_handle.user_env; env;
+ for (user_env_count = 0, env = HYD_handle.global_env.user; env;
env = env->next, user_env_count++);
- for (system_env_count = 0, env = HYD_handle.system_env; env;
+ for (system_env_count = 0, env = HYD_handle.global_env.system; env;
env = env->next, system_env_count++);
for (segment_count = 0, segment = partition->segment_list; segment;
@@ -280,28 +280,31 @@
partition->base->exec_args[arg++] = HYDU_strdup("--ckpoint-restart");
partition->base->exec_args[arg++] = HYDU_strdup("--global-inherited-env");
- for (i = 0, env = HYD_handle.inherited_env; env; env = env->next, i++);
+ for (i = 0, env = HYD_handle.global_env.inherited; env; env = env->next, i++);
partition->base->exec_args[arg++] = HYDU_int_to_str(i);
partition->base->exec_args[arg++] = NULL;
- HYDU_list_append_env_to_str(HYD_handle.inherited_env, partition->base->exec_args);
+ HYDU_list_append_env_to_str(HYD_handle.global_env.inherited,
+ partition->base->exec_args);
arg = HYDU_strlist_lastidx(partition->base->exec_args);
partition->base->exec_args[arg++] = HYDU_strdup("--global-user-env");
- for (i = 0, env = HYD_handle.user_env; env; env = env->next, i++);
+ for (i = 0, env = HYD_handle.global_env.user; env; env = env->next, i++);
partition->base->exec_args[arg++] = HYDU_int_to_str(i);
partition->base->exec_args[arg++] = NULL;
- HYDU_list_append_env_to_str(HYD_handle.user_env, partition->base->exec_args);
+ HYDU_list_append_env_to_str(HYD_handle.global_env.user,
+ partition->base->exec_args);
arg = HYDU_strlist_lastidx(partition->base->exec_args);
partition->base->exec_args[arg++] = HYDU_strdup("--global-system-env");
- for (i = 0, env = HYD_handle.system_env; env; env = env->next, i++);
+ for (i = 0, env = HYD_handle.global_env.system; env; env = env->next, i++);
partition->base->exec_args[arg++] = HYDU_int_to_str(i);
partition->base->exec_args[arg++] = NULL;
- HYDU_list_append_env_to_str(HYD_handle.system_env, partition->base->exec_args);
+ HYDU_list_append_env_to_str(HYD_handle.global_env.system,
+ partition->base->exec_args);
arg = HYDU_strlist_lastidx(partition->base->exec_args);
partition->base->exec_args[arg++] = HYDU_strdup("--genv-prop");
- partition->base->exec_args[arg++] = HYDU_int_to_str(HYD_handle.prop);
+ partition->base->exec_args[arg++] = HYDU_strdup(HYD_handle.global_env.prop);
partition->base->exec_args[arg++] = NULL;
/* Pass the segment information */
@@ -333,7 +336,8 @@
arg = HYDU_strlist_lastidx(partition->base->exec_args);
partition->base->exec_args[arg++] = HYDU_strdup("--exec-env-prop");
- partition->base->exec_args[arg++] = HYDU_int_to_str(exec->prop);
+ partition->base->exec_args[arg++] = exec->env_prop ? HYDU_strdup(exec->env_prop) :
+ HYDU_strdup("HYDRA_NULL");
partition->base->exec_args[arg++] = NULL;
HYDU_list_append_strlist(exec->exec, partition->base->exec_args);
Modified: mpich2/trunk/src/pm/hydra/ui/mpiexec/mpiexec.c
===================================================================
--- mpich2/trunk/src/pm/hydra/ui/mpiexec/mpiexec.c 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/ui/mpiexec/mpiexec.c 2009-10-11 01:12:37 UTC (rev 5442)
@@ -161,10 +161,6 @@
}
}
- /* Consolidate the environment list that we need to propagate */
- status = HYD_UIU_create_env_list();
- HYDU_ERR_POP(status, "unable to create env list\n");
-
status = HYD_UIU_merge_exec_info_to_partition();
HYDU_ERR_POP(status, "unable to merge exec info\n");
Modified: mpich2/trunk/src/pm/hydra/ui/mpiexec/utils.c
===================================================================
--- mpich2/trunk/src/pm/hydra/ui/mpiexec/utils.c 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/ui/mpiexec/utils.c 2009-10-11 01:12:37 UTC (rev 5442)
@@ -63,7 +63,7 @@
status = HYDU_env_create(&env, env_name, env_value);
HYDU_ERR_POP(status, "unable to create env struct\n");
- HYDU_append_env_to_list(*env, &HYD_handle.user_env);
+ HYDU_append_env_to_list(*env, &HYD_handle.global_env.user);
fn_exit:
return status;
@@ -74,9 +74,10 @@
static HYD_Status genvlist_fn(char *arg, char ***argv)
{
+ int len;
HYD_Status status = HYD_SUCCESS;
- HYDU_ERR_CHKANDJUMP(status, HYD_handle.prop != HYD_ENV_PROP_UNSET,
+ HYDU_ERR_CHKANDJUMP(status, HYD_handle.global_env.prop,
HYD_INTERNAL_ERROR, "duplicate environment setting\n");
if (**argv && IS_HELP(**argv)) {
@@ -89,8 +90,9 @@
HYDU_ERR_SETANDJUMP(status, HYD_GRACEFUL_ABORT, "");
}
- HYD_handle.prop = HYD_ENV_PROP_LIST;
- HYDU_comma_list_to_env_list(**argv, &HYD_handle.user_env);
+ len = strlen("list:") + strlen(**argv) + 1;
+ HYDU_MALLOC(HYD_handle.global_env.prop, char *, len, status);
+ HYDU_snprintf(HYD_handle.global_env.prop, len, "list:%s", **argv);
(*argv)++;
fn_exit:
@@ -104,7 +106,7 @@
{
HYD_Status status = HYD_SUCCESS;
- HYDU_ERR_CHKANDJUMP(status, HYD_handle.prop != HYD_ENV_PROP_UNSET,
+ HYDU_ERR_CHKANDJUMP(status, HYD_handle.global_env.prop,
HYD_INTERNAL_ERROR, "duplicate environment setting\n");
if (**argv && IS_HELP(**argv)) {
@@ -114,7 +116,7 @@
HYDU_ERR_SETANDJUMP(status, HYD_GRACEFUL_ABORT, "");
}
- HYD_handle.prop = HYD_ENV_PROP_NONE;
+ HYD_handle.global_env.prop = HYDU_strdup("none");
fn_exit:
return status;
@@ -127,7 +129,7 @@
{
HYD_Status status = HYD_SUCCESS;
- HYDU_ERR_CHKANDJUMP(status, HYD_handle.prop != HYD_ENV_PROP_UNSET,
+ HYDU_ERR_CHKANDJUMP(status, HYD_handle.global_env.prop,
HYD_INTERNAL_ERROR, "duplicate environment setting\n");
if (**argv && IS_HELP(**argv)) {
@@ -137,7 +139,7 @@
HYDU_ERR_SETANDJUMP(status, HYD_GRACEFUL_ABORT, "");
}
- HYD_handle.prop = HYD_ENV_PROP_ALL;
+ HYD_handle.global_env.prop = HYDU_strdup("all");
fn_exit:
return status;
@@ -243,14 +245,15 @@
static HYD_Status envlist_fn(char *arg, char ***argv)
{
+ int len;
struct HYD_Exec_info *exec_info;
HYD_Status status = HYD_SUCCESS;
status = HYD_UIU_get_current_exec_info(&exec_info);
HYDU_ERR_POP(status, "get_current_exec_info returned error\n");
- HYDU_ERR_CHKANDJUMP(status, exec_info->prop != HYD_ENV_PROP_UNSET,
- HYD_INTERNAL_ERROR, "duplicate environment setting\n");
+ HYDU_ERR_CHKANDJUMP(status, exec_info->env_prop, HYD_INTERNAL_ERROR,
+ "duplicate environment setting\n");
if (**argv && IS_HELP(**argv)) {
printf("\n");
@@ -262,8 +265,9 @@
HYDU_ERR_SETANDJUMP(status, HYD_GRACEFUL_ABORT, "");
}
- exec_info->prop = HYD_ENV_PROP_LIST;
- HYDU_comma_list_to_env_list(**argv, &exec_info->user_env);
+ len = strlen("list:") + strlen(**argv) + 1;
+ HYDU_MALLOC(exec_info->env_prop, char *, len, status);
+ HYDU_snprintf(exec_info->env_prop, len, "list:%s", **argv);
(*argv)++;
fn_exit:
@@ -281,8 +285,8 @@
status = HYD_UIU_get_current_exec_info(&exec_info);
HYDU_ERR_POP(status, "get_current_exec_info returned error\n");
- HYDU_ERR_CHKANDJUMP(status, exec_info->prop != HYD_ENV_PROP_UNSET,
- HYD_INTERNAL_ERROR, "duplicate environment setting\n");
+ HYDU_ERR_CHKANDJUMP(status, exec_info->env_prop, HYD_INTERNAL_ERROR,
+ "duplicate environment setting\n");
if (**argv && IS_HELP(**argv)) {
printf("\n");
@@ -291,7 +295,7 @@
HYDU_ERR_SETANDJUMP(status, HYD_GRACEFUL_ABORT, "");
}
- exec_info->prop = HYD_ENV_PROP_NONE;
+ exec_info->env_prop = HYDU_strdup("none");
fn_exit:
return status;
@@ -308,8 +312,8 @@
status = HYD_UIU_get_current_exec_info(&exec_info);
HYDU_ERR_POP(status, "get_current_exec_info returned error\n");
- HYDU_ERR_CHKANDJUMP(status, exec_info->prop != HYD_ENV_PROP_UNSET,
- HYD_INTERNAL_ERROR, "duplicate environment setting\n");
+ HYDU_ERR_CHKANDJUMP(status, exec_info->env_prop, HYD_INTERNAL_ERROR,
+ "duplicate environment setting\n");
if (**argv && IS_HELP(**argv)) {
printf("\n");
@@ -318,7 +322,7 @@
HYDU_ERR_SETANDJUMP(status, HYD_GRACEFUL_ABORT, "");
}
- exec_info->prop = HYD_ENV_PROP_ALL;
+ exec_info->env_prop = HYDU_strdup("all");
fn_exit:
return status;
@@ -1008,7 +1012,7 @@
(HYD_handle.launch_mode == HYD_LAUNCH_SHUTDOWN)) {
/* No environment */
- HYDU_ERR_CHKANDJUMP(status, HYD_handle.prop != HYD_ENV_PROP_UNSET, HYD_INTERNAL_ERROR,
+ HYDU_ERR_CHKANDJUMP(status, HYD_handle.global_env.prop, HYD_INTERNAL_ERROR,
"env setting not required for booting/shutting proxies\n");
/* No binding */
@@ -1148,12 +1152,13 @@
/* Check environment for setting the inherited environment */
tmp = getenv("HYDRA_ENV");
- if (HYD_handle.prop == HYD_ENV_PROP_UNSET && tmp)
- HYD_handle.prop = !strcmp(tmp, "all") ? HYD_ENV_PROP_ALL : HYD_ENV_PROP_NONE;
+ if (HYD_handle.global_env.prop == NULL && tmp)
+ HYD_handle.global_env.prop =
+ !strcmp(tmp, "all") ? HYDU_strdup("all") : HYDU_strdup("none");
/* If no global environment is set, use the default */
- if (HYD_handle.prop == HYD_ENV_PROP_UNSET)
- HYD_handle.prop = HYD_ENV_PROP_ALL;
+ if (HYD_handle.global_env.prop == NULL)
+ HYD_handle.global_env.prop = HYDU_strdup("all");
fn_exit:
return status;
@@ -1174,7 +1179,7 @@
HYD_UIU_init_params();
- status = HYDU_list_inherited_env(&HYD_handle.inherited_env);
+ status = HYDU_list_inherited_env(&HYD_handle.global_env.inherited);
HYDU_ERR_POP(status, "unable to get the inherited env list\n");
argv++;
Modified: mpich2/trunk/src/pm/hydra/ui/utils/uiu.c
===================================================================
--- mpich2/trunk/src/pm/hydra/ui/utils/uiu.c 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/ui/utils/uiu.c 2009-10-11 01:12:37 UTC (rev 5442)
@@ -37,10 +37,10 @@
HYD_handle.ranks_per_proc = -1;
HYD_handle.bootstrap_exec = NULL;
- HYD_handle.inherited_env = NULL;
- HYD_handle.system_env = NULL;
- HYD_handle.user_env = NULL;
- HYD_handle.prop = HYD_ENV_PROP_UNSET;
+ HYD_handle.global_env.inherited = NULL;
+ HYD_handle.global_env.system = NULL;
+ HYD_handle.global_env.user = NULL;
+ HYD_handle.global_env.prop = NULL;
HYD_handle.stdin_cb = NULL;
HYD_handle.stdout_cb = NULL;
@@ -96,15 +96,18 @@
if (HYD_handle.bootstrap_exec)
HYDU_FREE(HYD_handle.bootstrap_exec);
- if (HYD_handle.inherited_env)
- HYDU_env_free_list(HYD_handle.inherited_env);
+ if (HYD_handle.global_env.inherited)
+ HYDU_env_free_list(HYD_handle.global_env.inherited);
- if (HYD_handle.system_env)
- HYDU_env_free_list(HYD_handle.system_env);
+ if (HYD_handle.global_env.system)
+ HYDU_env_free_list(HYD_handle.global_env.system);
- if (HYD_handle.user_env)
- HYDU_env_free_list(HYD_handle.user_env);
+ if (HYD_handle.global_env.user)
+ HYDU_env_free_list(HYD_handle.global_env.user);
+ if (HYD_handle.global_env.prop)
+ HYDU_FREE(HYD_handle.global_env.prop);
+
if (HYD_handle.exec_info_list)
HYDU_free_exec_info_list(HYD_handle.exec_info_list);
@@ -116,49 +119,6 @@
}
-HYD_Status HYD_UIU_create_env_list(void)
-{
- struct HYD_Exec_info *exec_info;
- HYD_Env_t *env, *run;
- HYD_Status status = HYD_SUCCESS;
-
- HYDU_FUNC_ENTER();
-
- if (HYD_handle.prop == HYD_ENV_PROP_LIST) {
- for (env = HYD_handle.user_env; env; env = env->next) {
- run = HYDU_env_lookup(*env, HYD_handle.inherited_env);
- if (run) {
- /* Dump back the updated environment to the user list */
- status = HYDU_append_env_to_list(*run, &HYD_handle.user_env);
- HYDU_ERR_POP(status, "unable to add env to list\n");
- }
- }
- }
-
- exec_info = HYD_handle.exec_info_list;
- while (exec_info) {
- if (exec_info->prop == HYD_ENV_PROP_LIST) {
- for (env = exec_info->user_env; env; env = env->next) {
- run = HYDU_env_lookup(*env, HYD_handle.inherited_env);
- if (run) {
- /* Dump back the updated environment to the user list */
- status = HYDU_append_env_to_list(*run, &exec_info->user_env);
- HYDU_ERR_POP(status, "unable to add env to list\n");
- }
- }
- }
- exec_info = exec_info->next;
- }
-
- fn_exit:
- HYDU_FUNC_EXIT();
- return status;
-
- fn_fail:
- goto fn_exit;
-}
-
-
HYD_Status HYD_UIU_get_current_exec_info(struct HYD_Exec_info **info)
{
struct HYD_Exec_info *exec_info;
@@ -205,7 +165,8 @@
partition->exec_list->exec[i] = NULL;
partition->exec_list->proc_count = num_procs;
- partition->exec_list->prop = exec_info->prop;
+ partition->exec_list->env_prop = exec_info->env_prop ?
+ HYDU_strdup(exec_info->env_prop) : NULL;
partition->exec_list->user_env = HYDU_env_list_dup(exec_info->user_env);
}
else {
@@ -221,7 +182,7 @@
exec->exec[i] = NULL;
exec->proc_count = num_procs;
- exec->prop = exec_info->prop;
+ exec->env_prop = exec_info->env_prop ? HYDU_strdup(exec_info->env_prop) : NULL;
exec->user_env = HYDU_env_list_dup(exec_info->user_env);
}
@@ -315,22 +276,22 @@
HYDU_dump(stdout, "\n");
HYDU_dump(stdout, " Global environment:\n");
HYDU_dump(stdout, " -------------------\n");
- for (env = HYD_handle.inherited_env; env; env = env->next)
+ for (env = HYD_handle.global_env.inherited; env; env = env->next)
HYDU_dump(stdout, " %s=%s\n", env->env_name, env->env_value);
- if (HYD_handle.system_env) {
+ if (HYD_handle.global_env.system) {
HYDU_dump(stdout, "\n");
HYDU_dump(stdout, " Hydra internal environment:\n");
HYDU_dump(stdout, " ---------------------------\n");
- for (env = HYD_handle.system_env; env; env = env->next)
+ for (env = HYD_handle.global_env.system; env; env = env->next)
HYDU_dump(stdout, " %s=%s\n", env->env_name, env->env_value);
}
- if (HYD_handle.user_env) {
+ if (HYD_handle.global_env.user) {
HYDU_dump(stdout, "\n");
HYDU_dump(stdout, " User set environment:\n");
HYDU_dump(stdout, " ---------------------\n");
- for (env = HYD_handle.user_env; env; env = env->next)
+ for (env = HYD_handle.global_env.user; env; env = env->next)
HYDU_dump(stdout, " %s=%s\n", env->env_name, env->env_value);
}
Modified: mpich2/trunk/src/pm/hydra/ui/utils/uiu.h
===================================================================
--- mpich2/trunk/src/pm/hydra/ui/utils/uiu.h 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/ui/utils/uiu.h 2009-10-11 01:12:37 UTC (rev 5442)
@@ -12,7 +12,6 @@
void HYD_UIU_init_params(void);
void HYD_UIU_free_params(void);
HYD_Status HYD_UIU_merge_exec_info_to_partition(void);
-HYD_Status HYD_UIU_create_env_list(void);
HYD_Status HYD_UIU_get_current_exec_info(struct HYD_Exec_info **info);
void HYD_UIU_print_params(void);
Modified: mpich2/trunk/src/pm/hydra/utils/launch/allocate.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/launch/allocate.c 2009-10-09 21:02:40 UTC (rev 5441)
+++ mpich2/trunk/src/pm/hydra/utils/launch/allocate.c 2009-10-11 01:12:37 UTC (rev 5442)
@@ -83,7 +83,7 @@
(*exec_info)->exec_proc_count = 0;
(*exec_info)->exec[0] = NULL;
(*exec_info)->user_env = NULL;
- (*exec_info)->prop = HYD_ENV_PROP_UNSET;
+ (*exec_info)->env_prop = NULL;
(*exec_info)->next = NULL;
fn_exit:
@@ -106,6 +106,9 @@
run = exec_info->next;
HYDU_free_strlist(exec_info->exec);
+ if (exec_info->env_prop)
+ HYDU_FREE(exec_info->env_prop);
+
HYDU_env_free_list(exec_info->user_env);
exec_info->user_env = NULL;
@@ -154,6 +157,8 @@
HYDU_free_strlist(exec->exec);
if (exec->user_env)
HYDU_env_free(exec->user_env);
+ if (exec->env_prop)
+ HYDU_FREE(exec->env_prop);
HYDU_FREE(exec);
exec = texec;
}
@@ -369,7 +374,7 @@
HYDU_MALLOC(*exec, struct HYD_Partition_exec *, sizeof(struct HYD_Partition_exec), status);
(*exec)->exec[0] = NULL;
(*exec)->proc_count = 0;
- (*exec)->prop = HYD_ENV_PROP_UNSET;
+ (*exec)->env_prop = NULL;
(*exec)->user_env = NULL;
(*exec)->next = NULL;
More information about the mpich2-commits
mailing list