From 02efd07b6062eaaf6e0e2aae46a5805bb4c1031b Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Fri, 20 Oct 2006 15:27:29 +0000 Subject: [PATCH] Fix the MCA param passing issue, at least for rsh at the moment. I will clean this up and move it to the other environments once I shift back to a local computer. This commit was SVN r12224. --- orte/mca/odls/default/odls_default_module.c | 6 ---- orte/mca/pls/rsh/pls_rsh_module.c | 10 +++--- orte/mca/rmgr/urm/rmgr_urm.c | 35 ++++++++++++++++++++- orte/test/mpi/simple_spawn.c | 11 +++++-- orte/tools/orted/orted.c | 31 ------------------ 5 files changed, 47 insertions(+), 46 deletions(-) diff --git a/orte/mca/odls/default/odls_default_module.c b/orte/mca/odls/default/odls_default_module.c index feb3abc13b..c7495f9b2b 100644 --- a/orte/mca/odls/default/odls_default_module.c +++ b/orte/mca/odls/default/odls_default_module.c @@ -531,12 +531,6 @@ static int odls_default_fork_local_proc( } else { environ_copy = opal_argv_copy(base_environ); } - /* purge any disallowed component directives */ - if (ORTE_SUCCESS != orte_odls_base_purge_environment(&environ_copy)) { - /* Tell the parent that Badness happened */ - write(p[1], &i, sizeof(int)); - exit(-1); - } /* special case handling for --prefix: this is somewhat icky, but at least some users do this. :-\ It is possible that diff --git a/orte/mca/pls/rsh/pls_rsh_module.c b/orte/mca/pls/rsh/pls_rsh_module.c index 1d68dab1d2..35314d4159 100644 --- a/orte/mca/pls/rsh/pls_rsh_module.c +++ b/orte/mca/pls/rsh/pls_rsh_module.c @@ -922,19 +922,19 @@ int orte_pls_rsh_launch(orte_jobid_t jobid) * won't work on remote nodes */ var = mca_base_param_environ_variable("rds",NULL,NULL); - opal_unsetenv(var, &env); + opal_setenv(var, "0", true, &env); free(var); var = mca_base_param_environ_variable("ras",NULL,NULL); - opal_unsetenv(var, &env); + opal_setenv(var, "0", true, &env); free(var); var = mca_base_param_environ_variable("rmaps",NULL,NULL); - opal_unsetenv(var, &env); + opal_setenv(var, "0", true, &env); free(var); var = mca_base_param_environ_variable("pls",NULL,NULL); - opal_unsetenv(var, &env); + opal_setenv(var, "0", true, &env); free(var); var = mca_base_param_environ_variable("rmgr",NULL,NULL); - opal_unsetenv(var, &env); + opal_setenv(var, "0", true, &env); free(var); /* exec the daemon */ diff --git a/orte/mca/rmgr/urm/rmgr_urm.c b/orte/mca/rmgr/urm/rmgr_urm.c index 854f859de6..65e42d0659 100644 --- a/orte/mca/rmgr/urm/rmgr_urm.c +++ b/orte/mca/rmgr/urm/rmgr_urm.c @@ -32,6 +32,8 @@ #include "opal/class/opal_list.h" #include "opal/util/trace.h" #include "opal/util/output.h" +#include "opal/mca/base/mca_base_param.h" +#include "opal/util/opal_environ.h" #include "orte/mca/errmgr/errmgr.h" #include "orte/mca/rds/rds.h" @@ -114,7 +116,9 @@ static int orte_rmgr_urm_setup_job( orte_jobid_t* jobid) { int rc; - + char *param; + orte_std_cntr_t i; + OPAL_TRACE(1); /* allocate a jobid */ @@ -123,6 +127,35 @@ static int orte_rmgr_urm_setup_job( return rc; } + /* for each app_context, we need to purge their environment of HNP + * MCA component selection directives + */ + param = mca_base_param_environ_variable("rds",NULL,NULL); + for (i=0; i < num_context; i++) { + opal_setenv(param, "proxy", true, &app_context[i]->env); + } + free(param); + param = mca_base_param_environ_variable("ras",NULL,NULL); + for (i=0; i < num_context; i++) { + opal_setenv(param, "proxy", true, &app_context[i]->env); + } + free(param); + param = mca_base_param_environ_variable("rmaps",NULL,NULL); + for (i=0; i < num_context; i++) { + opal_setenv(param, "proxy", true, &app_context[i]->env); + } + free(param); + param = mca_base_param_environ_variable("pls",NULL,NULL); + for (i=0; i < num_context; i++) { + opal_setenv(param, "proxy", true, &app_context[i]->env); + } + free(param); + param = mca_base_param_environ_variable("rmgr",NULL,NULL); + for (i=0; i < num_context; i++) { + opal_setenv(param, "proxy", true, &app_context[i]->env); + } + free(param); + /* create and initialize job segment */ /* JJH C/N mapping before this */ if (ORTE_SUCCESS != (rc = orte_rmgr_base_put_app_context(*jobid, app_context, diff --git a/orte/test/mpi/simple_spawn.c b/orte/test/mpi/simple_spawn.c index ce060964fe..be211b098d 100644 --- a/orte/test/mpi/simple_spawn.c +++ b/orte/test/mpi/simple_spawn.c @@ -5,6 +5,8 @@ int main(int argc, char* argv[]) { int msg; MPI_Comm parent, child; + int rank, size; + char hostname[512]; MPI_Init(NULL, NULL); MPI_Comm_get_parent(&parent); @@ -22,11 +24,14 @@ int main(int argc, char* argv[]) } /* Otherwise, we're the child */ else { - printf("Hello from the child!\n"); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size); + gethostname(hostname, 512); + printf("Hello from the child %d of %d on host %s\n", rank, size, hostname); MPI_Recv(&msg, 1, MPI_INT, 0, 1, parent, MPI_STATUS_IGNORE); - printf("Child received msg: %d\n", msg); + printf("Child %d received msg: %d\n", rank, msg); MPI_Comm_disconnect(&parent); - printf("Child disconnected\n"); + printf("Child %d disconnected\n", rank); } MPI_Finalize(); diff --git a/orte/tools/orted/orted.c b/orte/tools/orted/orted.c index 335154f1c7..bcfce4eb56 100644 --- a/orte/tools/orted/orted.c +++ b/orte/tools/orted/orted.c @@ -196,42 +196,11 @@ int main(int argc, char *argv[]) char *jobidstring; orte_gpr_value_t *value; char *segment; - char *param; int i; /* initialize the globals */ memset(&orted_globals, 0, sizeof(orted_globals_t)); - /* Protect the daemon and any child processes from MCA params that select - * specific components. We want to be free to select the proxy components, - * so we have to ensure that we aren't picking up directives intended for HNPs. - */ - if(NULL == (param = mca_base_param_environ_variable("rds",NULL,NULL))) { - return ORTE_ERR_OUT_OF_RESOURCE; - } - unsetenv(param); - free(param); - if(NULL == (param = mca_base_param_environ_variable("ras",NULL,NULL))) { - return ORTE_ERR_OUT_OF_RESOURCE; - } - unsetenv(param); - free(param); - if(NULL == (param = mca_base_param_environ_variable("rmaps",NULL,NULL))) { - return ORTE_ERR_OUT_OF_RESOURCE; - } - unsetenv(param); - free(param); - if(NULL == (param = mca_base_param_environ_variable("pls",NULL,NULL))) { - return ORTE_ERR_OUT_OF_RESOURCE; - } - unsetenv(param); - free(param); - if(NULL == (param = mca_base_param_environ_variable("rmgr",NULL,NULL))) { - return ORTE_ERR_OUT_OF_RESOURCE; - } - unsetenv(param); - free(param); - /* save the environment for use when launching application processes */ orted_globals.saved_environ = opal_argv_copy(environ);