[mpich2-commits] r7942 - in mpich2/trunk/src/pm/hydra: include tools/bind tools/bootstrap/src tools/ckpoint ui/mpich
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Fri Feb 11 17:34:27 CST 2011
Author: balaji
Date: 2011-02-11 17:34:27 -0600 (Fri, 11 Feb 2011)
New Revision: 7942
Modified:
mpich2/trunk/src/pm/hydra/include/hydra.h
mpich2/trunk/src/pm/hydra/tools/bind/bind.c
mpich2/trunk/src/pm/hydra/tools/bootstrap/src/bsci_finalize.c
mpich2/trunk/src/pm/hydra/tools/bootstrap/src/bsci_init.c.in
mpich2/trunk/src/pm/hydra/tools/ckpoint/ckpoint.c
mpich2/trunk/src/pm/hydra/ui/mpich/utils.c
Log:
We were dup'ing variables read from the environment in some cases, but
were not in others causing crashes on some platforms when we were
trying to free the memory. Thanks to Steve Sutphen for reporting the
issue and providing details about the error which lead to the fix.
No reviewer.
Modified: mpich2/trunk/src/pm/hydra/include/hydra.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra.h 2011-02-11 23:34:21 UTC (rev 7941)
+++ mpich2/trunk/src/pm/hydra/include/hydra.h 2011-02-11 23:34:27 UTC (rev 7942)
@@ -579,16 +579,6 @@
} \
}
-#define HYD_GET_ENV_STR_VAL(lvalue_, env_var_name_, default_val_) \
- do { \
- if (lvalue_ == NULL) { \
- const char *tmp_ = (default_val_); \
- MPL_env2str(env_var_name_, (const char **) &tmp_); \
- if (tmp_) \
- lvalue_ = HYDU_strdup(tmp_); \
- } \
- } while (0)
-
HYD_status HYDU_list_append_strlist(char **exec, char **client_arg);
HYD_status HYDU_print_strlist(char **args);
void HYDU_free_strlist(char **args);
Modified: mpich2/trunk/src/pm/hydra/tools/bind/bind.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/bind.c 2011-02-11 23:34:21 UTC (rev 7941)
+++ mpich2/trunk/src/pm/hydra/tools/bind/bind.c 2011-02-11 23:34:27 UTC (rev 7942)
@@ -20,7 +20,7 @@
HYD_status HYDT_bind_init(char *user_binding, char *user_bindlib)
{
char *bindstr, *bindentry, *elem;
- char *binding = NULL, *bindlib = NULL;
+ const char *binding = NULL, *bindlib = NULL;
int i, j, k, use_topo_obj[HYDT_BIND_OBJ_END] = { 0 }, child_id;
int use_cache_level = 0, break_out;
HYDT_bind_obj_type_t topo_end = HYDT_BIND_OBJ_END;
@@ -31,19 +31,17 @@
if (user_binding)
binding = user_binding;
- else
- HYD_GET_ENV_STR_VAL(binding, "HYDRA_BINDING", NULL);
+ else if (MPL_env2str("HYDRA_BINDING", &binding) == 0)
+ binding = NULL;
if (user_bindlib)
bindlib = HYDU_strdup(user_bindlib);
- else
- HYD_GET_ENV_STR_VAL(bindlib, "HYDRA_BINDLIB", HYDRA_DEFAULT_BINDLIB);
+ else if (MPL_env2str("HYDRA_BINDLIB", &bindlib) == 0)
+ bindlib = HYDRA_DEFAULT_BINDLIB;
HYDT_bind_info.support_level = HYDT_BIND_SUPPORT_NONE;
- if (bindlib) {
+ if (bindlib)
HYDT_bind_info.bindlib = HYDU_strdup(bindlib);
- HYDU_FREE(bindlib);
- }
else
HYDT_bind_info.bindlib = NULL;
HYDT_bind_info.bindmap = NULL;
Modified: mpich2/trunk/src/pm/hydra/tools/bootstrap/src/bsci_finalize.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bootstrap/src/bsci_finalize.c 2011-02-11 23:34:21 UTC (rev 7941)
+++ mpich2/trunk/src/pm/hydra/tools/bootstrap/src/bsci_finalize.c 2011-02-11 23:34:27 UTC (rev 7942)
@@ -24,15 +24,6 @@
HYDU_ERR_POP(status, "RMK returned error while finalizing\n");
}
- if (HYDT_bsci_info.rmk)
- HYDU_FREE(HYDT_bsci_info.rmk);
-
- if (HYDT_bsci_info.launcher)
- HYDU_FREE(HYDT_bsci_info.launcher);
-
- if (HYDT_bsci_info.launcher_exec)
- HYDU_FREE(HYDT_bsci_info.launcher_exec);
-
fn_exit:
HYDU_FUNC_EXIT();
return status;
Modified: mpich2/trunk/src/pm/hydra/tools/bootstrap/src/bsci_init.c.in
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bootstrap/src/bsci_init.c.in 2011-02-11 23:34:21 UTC (rev 7941)
+++ mpich2/trunk/src/pm/hydra/tools/bootstrap/src/bsci_init.c.in 2011-02-11 23:34:27 UTC (rev 7942)
@@ -52,7 +52,7 @@
for (i = 0; rmk_array[i]; i++) {
init_rmk_fns();
- HYDT_bsci_info.rmk = HYDU_strdup(rmk_array[i]);
+ HYDT_bsci_info.rmk = rmk_array[i];
HYDT_bsci_info.debug = debug;
status = (*rmk_init_array[i]) ();
@@ -66,7 +66,6 @@
HYDU_ERR_POP(status, "unable to finalize bootstrap server\n");
}
- HYDU_FREE(HYDT_bsci_info.rmk);
init_rmk_fns();
if (ret)
@@ -75,7 +74,7 @@
fn_exit:
if (ret)
- return ((const char *) HYDU_strdup(rmk_array[i]));
+ return ((const char *) rmk_array[i]);
else
return NULL;
@@ -99,7 +98,7 @@
/* See if the user specified an RMK */
if (user_rmk)
- HYDT_bsci_info.rmk = HYDU_strdup(user_rmk);
+ HYDT_bsci_info.rmk = user_rmk;
if (HYDT_bsci_info.rmk == NULL)
MPL_env2str("HYDRA_RMK", (const char **) &HYDT_bsci_info.rmk);
@@ -114,7 +113,7 @@
/* See if the user specified a launcher */
if (user_launcher)
- HYDT_bsci_info.launcher = HYDU_strdup(user_launcher);
+ HYDT_bsci_info.launcher = user_launcher;
if (HYDT_bsci_info.launcher == NULL)
MPL_env2str("HYDRA_LAUNCHER", (const char **) &HYDT_bsci_info.launcher);
if (HYDT_bsci_info.launcher == NULL)
@@ -127,30 +126,12 @@
if (!strcmp(HYDT_bsci_info.rmk, launcher_array[i]))
break;
if (launcher_array[i])
- HYDT_bsci_info.launcher = HYDU_strdup(launcher_array[i]);
+ HYDT_bsci_info.launcher = launcher_array[i];
}
-
- /* If no RMK is provided or detected, use the default RMK */
- if (HYDT_bsci_info.rmk == NULL)
- HYDT_bsci_info.rmk = HYDU_strdup(HYDRA_DEFAULT_RMK);
-
- /* Initialize the RMK */
- for (i = 0; rmk_array[i]; i++) {
- if (!strcmp(HYDT_bsci_info.rmk, rmk_array[i])) {
- status = (*rmk_init_array[i]) ();
- HYDU_ERR_POP(status, "RMK init returned error\n");
- break;
- }
- }
- if (rmk_array[i] == NULL)
- HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
- "unrecognized RMK: %s\n", HYDT_bsci_info.rmk);
-
-
/* If no launcher is provided or detected, use the default launcher */
if (HYDT_bsci_info.launcher == NULL)
- HYDT_bsci_info.launcher = HYDU_strdup(HYDRA_DEFAULT_LAUNCHER);
+ HYDT_bsci_info.launcher = HYDRA_DEFAULT_LAUNCHER;
if (HYDT_bsci_info.launcher == NULL)
HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "no appropriate launcher found\n");
@@ -159,11 +140,15 @@
HYDT_bsci_info.enablex = enablex;
if (user_launcher_exec)
- HYDT_bsci_info.launcher_exec = HYDU_strdup(user_launcher_exec);
- if (HYDT_bsci_info.launcher_exec == NULL)
- HYD_GET_ENV_STR_VAL(HYDT_bsci_info.launcher_exec, "HYDRA_LAUNCHER_EXEC", NULL);
- if (HYDT_bsci_info.launcher_exec == NULL)
- HYD_GET_ENV_STR_VAL(HYDT_bsci_info.launcher_exec, "HYDRA_BOOTSTRAP_EXEC", NULL);
+ HYDT_bsci_info.launcher_exec = user_launcher_exec;
+ if (HYDT_bsci_info.launcher_exec == NULL) {
+ if (MPL_env2str("HYDRA_LAUNCHER_EXEC", &HYDT_bsci_info.launcher_exec) == 0)
+ HYDT_bsci_info.launcher_exec = NULL;
+ }
+ if (HYDT_bsci_info.launcher_exec == NULL) {
+ if (MPL_env2str("HYDRA_BOOTSTRAP_EXEC", &HYDT_bsci_info.launcher_exec) == 0)
+ HYDT_bsci_info.launcher_exec = NULL;
+ }
/* Make sure the launcher we found is valid */
for (i = 0; launcher_array[i]; i++) {
@@ -178,6 +163,23 @@
"unrecognized launcher: %s\n", HYDT_bsci_info.launcher);
+ /* If no RMK is provided or detected, use the default RMK */
+ if (HYDT_bsci_info.rmk == NULL)
+ HYDT_bsci_info.rmk = HYDRA_DEFAULT_RMK;
+
+ /* Initialize the RMK */
+ for (i = 0; rmk_array[i]; i++) {
+ if (!strcmp(HYDT_bsci_info.rmk, rmk_array[i])) {
+ status = (*rmk_init_array[i]) ();
+ HYDU_ERR_POP(status, "RMK init returned error\n");
+ break;
+ }
+ }
+ if (rmk_array[i] == NULL)
+ HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
+ "unrecognized RMK: %s\n", HYDT_bsci_info.rmk);
+
+
/* This function is mandatory */
if (HYDT_bsci_fns.launch_procs == NULL)
HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
Modified: mpich2/trunk/src/pm/hydra/tools/ckpoint/ckpoint.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/ckpoint/ckpoint.c 2011-02-11 23:34:21 UTC (rev 7941)
+++ mpich2/trunk/src/pm/hydra/tools/ckpoint/ckpoint.c 2011-02-11 23:34:27 UTC (rev 7942)
@@ -24,14 +24,15 @@
if (user_ckpointlib)
HYDT_ckpoint_info.ckpointlib = user_ckpointlib;
- else
- HYD_GET_ENV_STR_VAL(HYDT_ckpoint_info.ckpointlib, "HYDRA_CKPOINTLIB",
- HYDRA_DEFAULT_CKPOINTLIB);
+ else if (MPL_env2str("HYDRA_CKPOINTLIB", (const char **) &HYDT_ckpoint_info.ckpointlib) ==
+ 0)
+ HYDT_ckpoint_info.ckpointlib = HYDRA_DEFAULT_CKPOINTLIB;
if (user_ckpoint_prefix)
HYDT_ckpoint_info.ckpoint_prefix = user_ckpoint_prefix;
- else
- HYD_GET_ENV_STR_VAL(HYDT_ckpoint_info.ckpoint_prefix, "HYDRA_CKPOINT_PREFIX", NULL);
+ else if (MPL_env2str("HYDRA_CKPOINT_PREFIX",
+ (const char **) &HYDT_ckpoint_info.ckpoint_prefix) == 0)
+ HYDT_ckpoint_info.ckpoint_prefix = NULL;
if (HYDT_ckpoint_info.ckpoint_prefix == NULL)
goto fn_exit;
Modified: mpich2/trunk/src/pm/hydra/ui/mpich/utils.c
===================================================================
--- mpich2/trunk/src/pm/hydra/ui/mpich/utils.c 2011-02-11 23:34:21 UTC (rev 7941)
+++ mpich2/trunk/src/pm/hydra/ui/mpich/utils.c 2011-02-11 23:34:27 UTC (rev 7942)
@@ -1078,7 +1078,8 @@
MPL_env2bool("HYDRA_DEBUG", &HYD_server_info.user_global.debug) == 0)
HYD_server_info.user_global.debug = 0;
- HYD_GET_ENV_STR_VAL(HYD_server_info.user_global.iface, "HYDRA_IFACE", NULL);
+ if (MPL_env2str("HYDRA_IFACE", (const char **) &HYD_server_info.user_global.iface) == 0)
+ HYD_server_info.user_global.iface = NULL;
if (HYD_server_info.node_list == NULL &&
MPL_env2str("HYDRA_HOST_FILE", (const char **) &tmp)) {
More information about the mpich2-commits
mailing list