diff --git a/src/mca/gpr/base/gpr_base_open.c b/src/mca/gpr/base/gpr_base_open.c index cdca1f3269..2e96088a81 100644 --- a/src/mca/gpr/base/gpr_base_open.c +++ b/src/mca/gpr/base/gpr_base_open.c @@ -206,8 +206,13 @@ int mca_gpr_base_open(void) mca_oob_set_contact_info(replica); ompi_process_info.gpr_replica = ns_base_create_process_name(0,0,0); mca_oob_parse_contact_info(replica, ompi_process_info.gpr_replica, NULL); + } else { + if (NULL != ompi_process_info.gpr_replica) { + free(ompi_process_info.gpr_replica); + } } + /* Open up all available components */ if (OMPI_SUCCESS != diff --git a/src/mca/gpr/replica/gpr_replica.c b/src/mca/gpr/replica/gpr_replica.c index fd476b1892..83787af13c 100644 --- a/src/mca/gpr/replica/gpr_replica.c +++ b/src/mca/gpr/replica/gpr_replica.c @@ -21,6 +21,7 @@ #include "include/constants.h" #include "util/output.h" +#include "util/proc_info.h" #include "mca/gpr/base/base.h" #include "gpr_replica.h" #include "gpr_replica_internals.h" @@ -31,7 +32,8 @@ int gpr_replica_delete_segment(char *segment) mca_gpr_replica_segment_t *seg; if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: delete_segment entered"); + ompi_output(0, "[%d,%d,%d] gpr replica: delete_segment entered", ompi_process_info.name->cellid, + ompi_process_info.name->jobid, ompi_process_info.name->vpid); } seg = gpr_replica_find_seg(true, segment); @@ -65,13 +67,17 @@ int gpr_replica_put(ompi_registry_mode_t addr_mode, char *segment, if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: put entered on segment %s 1st token %s", segment, *tokens); + ompi_output(0, "[%d,%d,%d] gpr replica: put entered on segment %s 1st token %s", + ompi_process_info.name->cellid, ompi_process_info.name->jobid, + ompi_process_info.name->vpid, segment, *tokens); } /* protect ourselves against errors */ if (NULL == segment || NULL == object || 0 == size || NULL == tokens || NULL == *tokens) { if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: error in input - put rejected"); + ompi_output(0, "[%d,%d,%d] gpr replica: error in input - put rejected", + ompi_process_info.name->cellid, ompi_process_info.name->jobid, + ompi_process_info.name->vpid); } return OMPI_ERROR; } @@ -174,10 +180,6 @@ int gpr_replica_put(ompi_registry_mode_t addr_mode, char *segment, CLEANUP: - if (mca_gpr_replica_debug) { - ompi_output(0, "put: releasing list of keys"); - } - /* release list of keys */ if (NULL != keylist) { OBJ_RELEASE(keylist); @@ -199,7 +201,9 @@ int gpr_replica_delete_object(ompi_registry_mode_t addr_mode, ompi_registry_notify_message_t *notify_msg; if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: delete_object entered"); + ompi_output(0, "[%d,%d,%d] gpr replica: delete_object entered: segment 1st token", + ompi_process_info.name->cellid, ompi_process_info.name->jobid, + ompi_process_info.name->vpid, segment, *tokens); } keys = NULL; @@ -304,7 +308,8 @@ ompi_list_t* gpr_replica_index(char *segment) ompi_registry_index_value_t *ans; if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: index entered"); + ompi_output(0, "[%d,%d,%d] gpr replica: index entered segment: %s", ompi_process_info.name->cellid, + ompi_process_info.name->jobid, ompi_process_info.name->vpid, segment); } answer = OBJ_NEW(ompi_list_t); @@ -348,7 +353,9 @@ int gpr_replica_subscribe(ompi_registry_mode_t addr_mode, ompi_registry_notify_message_t *notify_msg; if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: subscribe entered"); + ompi_output(0, "[%d,%d,%d] gpr replica: subscribe entered: segment %s 1st token %s", + ompi_process_info.name->cellid, ompi_process_info.name->jobid, + ompi_process_info.name->vpid, segment, *tokens); } /* protect against errors */ @@ -397,7 +404,9 @@ int gpr_replica_unsubscribe(ompi_registry_mode_t addr_mode, mca_gpr_notify_id_t id_tag; if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: unsubscribe entered"); + ompi_output(0, "[%d,%d,%d] gpr replica: unsubscribe entered: segment %s 1st token %s", + ompi_process_info.name->cellid, ompi_process_info.name->jobid, + ompi_process_info.name->vpid, segment, *tokens); } /* protect against errors */ @@ -441,7 +450,9 @@ int gpr_replica_synchro(ompi_registry_synchro_mode_t synchro_mode, ompi_registry_notify_message_t *notify_msg; if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: synchro entered on segment %s trigger %d", segment, trigger); + ompi_output(0, "[%d,%d,%d] gpr replica: synchro entered on segment %s trigger %d", + ompi_process_info.name->cellid, ompi_process_info.name->jobid, + ompi_process_info.name->vpid, segment, trigger); } /* protect against errors */ @@ -493,7 +504,9 @@ int gpr_replica_cancel_synchro(ompi_registry_synchro_mode_t synchro_mode, mca_gpr_notify_id_t id_tag; if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: cancel_synchro entered"); + ompi_output(0, "[%d,%d,%d] gpr replica: cancel_synchro entered: segment %s 1st token %s", + ompi_process_info.name->cellid, ompi_process_info.name->jobid, + ompi_process_info.name->vpid, segment, *tokens); } /* protect against errors */ @@ -538,7 +551,8 @@ ompi_list_t* gpr_replica_get(ompi_registry_mode_t addr_mode, int num_tokens=0; if (mca_gpr_replica_debug) { - ompi_output(0, "gpr replica: get entered"); + ompi_output(0, "[%d,%d,%d] gpr replica: get entered", ompi_process_info.name->cellid, + ompi_process_info.name->jobid, ompi_process_info.name->vpid); } answer = OBJ_NEW(ompi_list_t); diff --git a/src/mca/ns/base/ns_base_open.c b/src/mca/ns/base/ns_base_open.c index 11e5b4fdad..fc36d46f43 100644 --- a/src/mca/ns/base/ns_base_open.c +++ b/src/mca/ns/base/ns_base_open.c @@ -51,6 +51,10 @@ int mca_ns_base_open(void) mca_oob_set_contact_info(replica); ompi_process_info.ns_replica = ns_base_create_process_name(0,0,0); mca_oob_parse_contact_info(replica, ompi_process_info.ns_replica, NULL); + } else { + if (NULL != ompi_process_info.ns_replica) { + free(ompi_process_info.ns_replica); + } } diff --git a/src/mpi/runtime/ompi_mpi_init.c b/src/mpi/runtime/ompi_mpi_init.c index 1b1a82686b..5d85d61f69 100644 --- a/src/mpi/runtime/ompi_mpi_init.c +++ b/src/mpi/runtime/ompi_mpi_init.c @@ -10,6 +10,7 @@ #include "runtime/runtime.h" #include "util/sys_info.h" #include "util/proc_info.h" +#include "util/session_dir.h" #include "mpi.h" #include "communicator/communicator.h" #include "group/group.h" @@ -63,15 +64,23 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) bool have_hidden_threads; ompi_proc_t** procs; size_t nprocs; - char *error; + char *error, *jobid_str, *procid_str; - /* Become a OMPI process */ + /* Become an OMPI process */ if (OMPI_SUCCESS != (ret = ompi_init(argc, argv))) { error = "ompi_init() failed"; goto error; } + /* get system info and setup defaults*/ + ompi_sys_info(); + ompi_universe_info.host = strdup(ompi_system_info.nodename); + ompi_universe_info.uid = strdup(ompi_system_info.user); + + /* parse environmental variables and fill corresponding info structures */ + ompi_rte_parse_environ(); + /* Open up the MCA */ if (OMPI_SUCCESS != (ret = mca_base_open())) { @@ -84,16 +93,73 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) have_hidden_threads = false; if (OMPI_SUCCESS != (ret = ompi_rte_init_stage1(&allow_multi_user_threads, &have_hidden_threads))) { - return ret; + goto error; } /* start the rest of the rte */ - if (OMPI_SUCCESS != (ret = ompi_rte_init_stage2(&allow_multi_user_threads, + if (OMPI_SUCCESS != (ret = ompi_rte_init_stage2(&allow_multi_user_threads, &have_hidden_threads))) { error = "mca_rte_init() failed"; goto error; } + /***** SET MY NAME *****/ + if (NULL == ompi_process_info.name) { /* don't overwrite an existing name */ + if (ompi_process_info.seed) { + ompi_process_info.name = ompi_name_server.create_process_name(0, 0, 0); + } else { + ompi_process_info.name = ompi_rte_get_self(); + } + } + + /* get my process info */ + ompi_proc_info(); + + /* setup my session directory */ + jobid_str = ompi_name_server.get_jobid_string(ompi_process_info.name); + procid_str = ompi_name_server.get_vpid_string(ompi_process_info.name); + + if (ompi_rte_debug_flag) { + ompi_output(0, "[%d,%d,%d] setting up session dir with", + ompi_process_info.name->cellid, + ompi_process_info.name->jobid, + ompi_process_info.name->vpid); + if (NULL != ompi_process_info.tmpdir_base) { + ompi_output(0, "\ttmpdir %s", ompi_process_info.tmpdir_base); + } + ompi_output(0, "\tuniverse %s", ompi_process_info.my_universe); + ompi_output(0, "\tuser %s", ompi_system_info.user); + ompi_output(0, "\thost %s", ompi_system_info.nodename); + ompi_output(0, "\tjobid %s", jobid_str); + ompi_output(0, "\tprocid %s", procid_str); + } + if (OMPI_ERROR == ompi_session_dir(true, + ompi_process_info.tmpdir_base, + ompi_system_info.user, + ompi_system_info.nodename, NULL, + ompi_process_info.my_universe, + jobid_str, procid_str)) { + if (jobid_str != NULL) free(jobid_str); + if (procid_str != NULL) free(procid_str); + error = "session dir not found or created"; + goto error; + } + + /* + * Register my process info with my replica. + */ + if (OMPI_SUCCESS != (ret = ompi_rte_register())) { + error = "ompi_rte_init: failed in ompi_rte_register()\n"; + goto error; + } + + /* finalize the rte startup */ + if (OMPI_SUCCESS != (ret = ompi_rte_init_finalstage(&allow_multi_user_threads, + &have_hidden_threads))) { + error = "mpi_init: failed in ompi_rte_init\n"; + goto error; + } + /* Once we've joined the RTE, see if any MCA parameters were passed to the MPI level */ @@ -140,13 +206,13 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) } /* Select which pml, ptl, and coll modules to use, and determine the - final thread level */ + final thread level */ if (OMPI_SUCCESS != - (ret = mca_base_init_select_components(requested, - allow_multi_user_threads, - have_hidden_threads, - provided))) { + (ret = mca_base_init_select_components(requested, + allow_multi_user_threads, + have_hidden_threads, + provided))) { error = "mca_base_init_select_components() failed"; goto error; } diff --git a/src/runtime/Makefile.am b/src/runtime/Makefile.am index dc932077b2..52173eea84 100644 --- a/src/runtime/Makefile.am +++ b/src/runtime/Makefile.am @@ -14,7 +14,6 @@ noinst_LTLIBRARIES = libruntime.la headers = \ runtime.h \ runtime_types.h \ - universe_connect.h \ ompi_progress.h libruntime_la_SOURCES = \ @@ -22,15 +21,16 @@ libruntime_la_SOURCES = \ ompi_abort.c \ ompi_finalize.c \ ompi_init.c \ - ompi_universe.c \ ompi_progress.c \ ompi_rte_finalize.c \ ompi_rte_init_stage1.c \ ompi_rte_init_stage2.c \ + ompi_rte_init_finalstage.c \ ompi_rte_llm.c \ ompi_rte_monitor.c \ ompi_rte_cmd_line_setup.c \ ompi_rte_local_universe_exists.c \ + ompi_rte_parse_environ.c \ ompi_rte_parse_cmd_line.c \ ompi_rte_parse_daemon_cmd_line.c \ ompi_rte_pcm.c diff --git a/src/runtime/ompi_rte_init_finalstage.c b/src/runtime/ompi_rte_init_finalstage.c new file mode 100644 index 0000000000..22282363a5 --- /dev/null +++ b/src/runtime/ompi_rte_init_finalstage.c @@ -0,0 +1,47 @@ +/* + * $HEADER$ + */ + +/** @file **/ + +/* #define _GNU_SOURCE */ + +#include "ompi_config.h" + +#include "include/constants.h" +#include "event/event.h" +#include "util/output.h" +#include "threads/mutex.h" +#include "mca/mca.h" +#include "mca/base/base.h" +#include "mca/base/mca_base_param.h" +#include "mca/pcm/base/base.h" +#include "mca/pcmclient/base/base.h" +#include "mca/llm/base/base.h" +#include "mca/oob/oob.h" +#include "mca/ns/base/base.h" +#include "mca/gpr/base/base.h" +#include "util/proc_info.h" +#include "util/session_dir.h" +#include "util/sys_info.h" + +#include "runtime/runtime.h" + +int ompi_rte_init_finalstage(bool *allow_multi_user_threads, bool *have_hidden_threads) +{ + int ret; + + /* + * Call back into OOB to allow do any final initialization + * (e.g. put contact info in register). + */ + if (OMPI_SUCCESS != (ret = mca_oob_base_module_init())) { + ompi_output(0, "ompi_rte_init: failed in mca_oob_base_module_init()\n"); + return ret; + } + + /* + * All done + */ + return OMPI_SUCCESS; +} diff --git a/src/runtime/ompi_rte_init_stage1.c b/src/runtime/ompi_rte_init_stage1.c index 3c0bc053a0..bebe58374a 100644 --- a/src/runtime/ompi_rte_init_stage1.c +++ b/src/runtime/ompi_rte_init_stage1.c @@ -93,11 +93,11 @@ int ompi_rte_debug_flag=0; ompi_universe_t ompi_universe_info = { /* .name = */ NULL, - /* .host = */ "localhost", + /* .host = */ NULL, /* .uid = */ NULL, /* .pid = */ 0, /* .persistence = */ false, - /* .scope = */ "local", + /* .scope = */ NULL, /* .probe = */ false, /* .silent_mode = */ true, /* .ns_replica = */ false, @@ -115,7 +115,6 @@ int ompi_rte_init_stage1(bool *allow_multi_user_threads, bool *have_hidden_threa { int ret; bool user_threads, hidden_threads; - char *enviro_val; *allow_multi_user_threads = true; *have_hidden_threads = false; @@ -123,19 +122,16 @@ int ompi_rte_init_stage1(bool *allow_multi_user_threads, bool *have_hidden_threa ret = mca_base_param_register_int("ompi", "rte", "debug", NULL, 0); mca_base_param_lookup_int(ret, &ompi_rte_debug_flag); - enviro_val = getenv("OMPI_universe_name"); - if (NULL != enviro_val) { /* universe name passed in environment */ - ompi_universe_info.name = strdup(enviro_val); - ompi_process_info.my_universe = strdup(enviro_val); - } else { + + /* check to ensure at least default values in key fields */ + if (NULL == ompi_universe_info.name) { ompi_universe_info.name = strdup("default-universe"); - ompi_process_info.my_universe = strdup("default-universe"); + if (NULL != ompi_process_info.my_universe) { /* overwrite to match */ + free(ompi_process_info.my_universe); + } + ompi_process_info.my_universe = strdup(ompi_universe_info.name); } - enviro_val = getenv("OMPI_tmpdir_base"); - if (NULL != enviro_val) { /* tmpdir base passed in environment */ - ompi_process_info.tmpdir_base = strdup(enviro_val); - } /* * Initialize the event library diff --git a/src/runtime/ompi_rte_init_stage2.c b/src/runtime/ompi_rte_init_stage2.c index da466d0c4c..0276dc2392 100644 --- a/src/runtime/ompi_rte_init_stage2.c +++ b/src/runtime/ompi_rte_init_stage2.c @@ -31,7 +31,6 @@ int ompi_rte_init_stage2(bool *allow_multi_user_threads, bool *have_hidden_threa { int ret; bool user_threads, hidden_threads; - char *jobid_str=NULL, *procid_str=NULL; /* * Name Server @@ -118,59 +117,6 @@ int ompi_rte_init_stage2(bool *allow_multi_user_threads, bool *have_hidden_threa *allow_multi_user_threads &= user_threads; *have_hidden_threads |= hidden_threads; - /* - * Fill in the various important structures - */ - /* proc structure startup */ - ompi_proc_info(); - - if (ompi_rte_debug_flag) { - ompi_output(0, "proc info for proc %s", ompi_name_server.get_proc_name_string(ompi_process_info.name)); - } - - /* session directory */ - jobid_str = ompi_name_server.get_jobid_string(ompi_process_info.name); - procid_str = ompi_name_server.get_vpid_string(ompi_process_info.name); - - if (ompi_rte_debug_flag) { - ompi_output(0, "[%d,%d,%d] setting up session dir with", ompi_process_info.name->cellid, ompi_process_info.name->jobid, ompi_process_info.name->vpid); - if (NULL != ompi_process_info.tmpdir_base) { - ompi_output(0, "\ttmpdir %s", ompi_process_info.tmpdir_base); - } - ompi_output(0, "\tuniverse %s", ompi_process_info.my_universe); - ompi_output(0, "\tuser %s", ompi_system_info.user); - ompi_output(0, "\thost %s", ompi_system_info.nodename); - ompi_output(0, "\tjobid %s", jobid_str); - ompi_output(0, "\tprocid %s", procid_str); - } - if (OMPI_ERROR == ompi_session_dir(true, - ompi_process_info.tmpdir_base, - ompi_system_info.user, - ompi_system_info.nodename, NULL, - ompi_process_info.my_universe, - jobid_str, procid_str)) { - if (jobid_str != NULL) free(jobid_str); - if (procid_str != NULL) free(procid_str); - return OMPI_ERROR; - } - - /* - * Register process info we/ seed daemon. - */ - if (OMPI_SUCCESS != (ret = ompi_rte_register())) { - ompi_output(0, "ompi_rte_init: failed in ompi_rte_register()\n"); - return ret; - } - - /* - * Call back into OOB to allow do any final initialization - * (e.g. put contact info in register). - */ - if (OMPI_SUCCESS != (ret = mca_oob_base_module_init())) { - ompi_output(0, "ompi_rte_init: failed in mca_oob_base_module_init()\n"); - return ret; - } - /* * All done */ diff --git a/src/runtime/ompi_rte_local_universe_exists.c b/src/runtime/ompi_rte_local_universe_exists.c index f176cff2c1..54f8f509a4 100644 --- a/src/runtime/ompi_rte_local_universe_exists.c +++ b/src/runtime/ompi_rte_local_universe_exists.c @@ -33,10 +33,8 @@ int ompi_rte_local_universe_exists() { char *contact_file; int ret; - ompi_process_name_t seed={0,0,0}; - /* does universe already exist on specified host? Check session directory to see */ - /* don't know how to handle remote host yet - only cover localhost */ + /* does universe already exist on local host? Check session directory to see */ if (0 != strncmp(ompi_universe_info.host, ompi_system_info.nodename, strlen(ompi_system_info.nodename))) { /* remote host specified */ ompi_output(0, "remote hosts not supported"); diff --git a/src/runtime/ompi_rte_parse_cmd_line.c b/src/runtime/ompi_rte_parse_cmd_line.c index 909ef98280..2349b519ae 100644 --- a/src/runtime/ompi_rte_parse_cmd_line.c +++ b/src/runtime/ompi_rte_parse_cmd_line.c @@ -5,10 +5,13 @@ /** * @file * - * Parse command line options for the Open MPI Run Time Environment + * Parse command line options for the Open MPI Run Time Environment. This program MUST be called before + * any call to ompi_rte_init_stage1 and/or ompi_rte_init_stage2 !!! + * */ #include "ompi_config.h" +#include #include #include "mca/oob/base/base.h" @@ -27,7 +30,10 @@ void ompi_rte_parse_cmd_line(ompi_cmd_line_t *cmd_line) /* get universe name and store it, if user specified it */ /* otherwise, stick with default name */ - universe = strdup(ompi_universe_info.name); /* save the default */ + if (NULL != ompi_universe_info.name) { + universe = strdup(ompi_universe_info.name); /* save the current value, if exists */ + } + if (ompi_cmd_line_is_taken(cmd_line, "universe") || ompi_cmd_line_is_taken(cmd_line, "u")) { if (NULL == ompi_cmd_line_get_param(cmd_line, "universe", 0, 0)) { @@ -35,7 +41,6 @@ void ompi_rte_parse_cmd_line(ompi_cmd_line_t *cmd_line) return; } universe = strdup(ompi_cmd_line_get_param(cmd_line, "universe", 0, 0)); - ompi_output(0, "got universe name %s", universe); if (NULL != (tmp = strchr(universe, ':'))) { /* name contains remote host */ @@ -56,9 +61,20 @@ void ompi_rte_parse_cmd_line(ompi_cmd_line_t *cmd_line) ompi_universe_info.name = strdup(universe); } } + /* copy the universe name into the process_info structure */ - ompi_process_info.my_universe = strdup(ompi_universe_info.name); - ompi_output(0, "my universe name is %s", ompi_process_info.my_universe); + if (NULL != ompi_universe_info.name) { + ompi_process_info.my_universe = strdup(ompi_universe_info.name); + } else { /* set it to default value */ + ompi_universe_info.name = strdup("default-universe"); + if (NULL != ompi_process_info.my_universe) { /* overwrite it */ + free(ompi_process_info.my_universe); + } + ompi_process_info.my_universe = strdup(ompi_universe_info.name); + } + + /* and set the appropriate enviro variable */ + setenv("OMPI_universe_name", ompi_universe_info.name, 1); /* get the temporary directory name for the session directory, if provided on command line */ if (ompi_cmd_line_is_taken(cmd_line, "tmpdir")) { @@ -66,10 +82,12 @@ void ompi_rte_parse_cmd_line(ompi_cmd_line_t *cmd_line) ompi_output(0, "error retrieving tmpdir name - please report error to bugs@open-mpi.org\n"); return; } + if (NULL != ompi_process_info.tmpdir_base) { /* overwrite it */ + free(ompi_process_info.tmpdir_base); + } ompi_process_info.tmpdir_base = strdup(ompi_cmd_line_get_param(cmd_line, "tmpdir", 0, 0)); - } else { - ompi_process_info.tmpdir_base = NULL; - } + setenv("OMPI_tmpdir_base", ompi_process_info.tmpdir_base, 1); + } /* otherwise, leave it alone */ /* see if name server replica provided */ if (ompi_cmd_line_is_taken(cmd_line, "nsreplica")) { @@ -78,10 +96,8 @@ void ompi_rte_parse_cmd_line(ompi_cmd_line_t *cmd_line) return; } nsreplica = strdup(ompi_cmd_line_get_param(cmd_line, "nsreplica", 0, 0)); - mca_oob_parse_contact_info(nsreplica, ompi_process_info.ns_replica, NULL); - } else { - ompi_process_info.ns_replica = NULL; - } + setenv("OMPI_MCA_ns_base_replica", nsreplica, 1); /* set the ns_replica enviro variable */ + } /* otherwise, leave it alone */ /* see if GPR replica provided */ if (ompi_cmd_line_is_taken(cmd_line, "gprreplica")) { @@ -90,12 +106,6 @@ void ompi_rte_parse_cmd_line(ompi_cmd_line_t *cmd_line) return; } gprreplica = strdup(ompi_cmd_line_get_param(cmd_line, "gprreplica", 0, 0)); - if (NULL != nsreplica && - 0 != strcmp(nsreplica, gprreplica)) { /* check to see if different */ - mca_oob_set_contact_info(gprreplica); - } - mca_oob_parse_contact_info(gprreplica, ompi_process_info.gpr_replica, NULL); - } else { - ompi_process_info.gpr_replica = NULL; - } + setenv("OMPI_MCA_gpr_base_replica", gprreplica, 1); /* set the gpr_replica enviro variable */ + } /* otherwise leave it alone */ } diff --git a/src/runtime/ompi_rte_parse_daemon_cmd_line.c b/src/runtime/ompi_rte_parse_daemon_cmd_line.c index 5c18d39e9b..90cfcddf02 100644 --- a/src/runtime/ompi_rte_parse_daemon_cmd_line.c +++ b/src/runtime/ompi_rte_parse_daemon_cmd_line.c @@ -16,8 +16,6 @@ #include "util/sys_info.h" #include "util/proc_info.h" -#include "mca/ns/base/base.h" - #include "runtime/runtime.h" void ompi_rte_parse_daemon_cmd_line(ompi_cmd_line_t *cmd_line) @@ -26,16 +24,18 @@ void ompi_rte_parse_daemon_cmd_line(ompi_cmd_line_t *cmd_line) /* see if I'm the seed */ if (ompi_cmd_line_is_taken(cmd_line, "seed")) { ompi_process_info.seed = true; - ompi_process_info.name = ns_base_create_process_name(0,0,0); + setenv("OMPI_universe_seed", "1", 1); } else { + unsetenv("OMPI_universe_seed"); ompi_process_info.seed = false; - ompi_process_info.name = NULL; } /* see if I'm a probe */ if (ompi_cmd_line_is_taken(cmd_line, "probe")) { + setenv("OMPI_universe_probe", "1", 1); ompi_universe_info.probe = true; } else { + unsetenv("OMPI_universe_probe"); ompi_universe_info.probe = false; } @@ -46,26 +46,36 @@ void ompi_rte_parse_daemon_cmd_line(ompi_cmd_line_t *cmd_line) exit(1); } ompi_universe_info.scope = strdup(ompi_cmd_line_get_param(cmd_line, "scope", 0, 0)); + setenv("OMPI_universe_scope", ompi_universe_info.scope, 1); + } else { + unsetenv("OMPI_universe_scope"); + ompi_universe_info.scope = NULL; } /* find out if persistent */ if (ompi_cmd_line_is_taken(cmd_line, "persistent")) { + setenv("OMPI_universe_persistent", "1", 1); ompi_universe_info.persistence = true; } else { + unsetenv("OMPI_universe_persistent"); ompi_universe_info.persistence = false; } /* find out if silent */ if (ompi_cmd_line_is_taken(cmd_line, "silent")) { + setenv("OMPI_universe_silent", "1", 1); ompi_universe_info.silent_mode = true; } else { + unsetenv("OMPI_universe_silent"); ompi_universe_info.silent_mode = false; } /* find out if web interface is desired */ if (ompi_cmd_line_is_taken(cmd_line, "webserver")) { + setenv("OMPI_universe_webserver", "1", 1); ompi_universe_info.web_server = true; } else { + unsetenv("OMPI_universe_webserver"); ompi_universe_info.web_server = false; } @@ -76,7 +86,9 @@ void ompi_rte_parse_daemon_cmd_line(ompi_cmd_line_t *cmd_line) exit(1); } ompi_universe_info.scriptfile = strdup(ompi_cmd_line_get_param(cmd_line, "script", 0, 0)); + setenv("OMPI_universe_script", ompi_universe_info.scriptfile, 1); } else { + unsetenv("OMPI_universe_script"); ompi_universe_info.scriptfile = NULL; } @@ -87,7 +99,9 @@ void ompi_rte_parse_daemon_cmd_line(ompi_cmd_line_t *cmd_line) exit(1); } ompi_universe_info.hostfile = strdup(ompi_cmd_line_get_param(cmd_line, "hostfile", 0, 0)); + setenv("OMPI_universe_hostfile", ompi_universe_info.hostfile, 1); } else { + unsetenv("OMPI_universe_hostfile"); ompi_universe_info.hostfile = NULL; } } diff --git a/src/runtime/ompi_rte_parse_environ.c b/src/runtime/ompi_rte_parse_environ.c new file mode 100644 index 0000000000..f75dcf80e9 --- /dev/null +++ b/src/runtime/ompi_rte_parse_environ.c @@ -0,0 +1,129 @@ +/* + * $HEADER$ + */ + +/** + * @file + * + * Parse environmental paramater options for the Open MPI Run Time Environment. This function + * MUST be called BEFORE calling any of the rte command line parsers. + * + */ +#include "ompi_config.h" + +#include + +#include "util/output.h" +#include "util/sys_info.h" +#include "util/proc_info.h" + +#include "runtime/runtime.h" + +void ompi_rte_parse_environ(void) +{ + char *enviro_val; + + enviro_val = getenv("OMPI_universe_seed"); + if (NULL != enviro_val) { /* seed flag passed */ + ompi_process_info.seed = true; + } else { + ompi_process_info.seed = false; + } + + enviro_val = getenv("OMPI_universe_probe"); + if (NULL != enviro_val) { /* probe flag passed */ + ompi_universe_info.probe = true; + } else { + ompi_universe_info.probe = false; + } + + enviro_val = getenv("OMPI_universe_scope"); + if (NULL != enviro_val) { /* scope passed */ + if (NULL != ompi_universe_info.scope) { /* overwrite */ + free(ompi_universe_info.scope); + } + ompi_universe_info.scope = strdup(enviro_val); + } else { + if (NULL != ompi_universe_info.scope) { + free(ompi_universe_info.scope); + } + } + + enviro_val = getenv("OMPI_universe_persistent"); + if (NULL != enviro_val) { /* persistence flag passed */ + ompi_universe_info.persistence = true; + } else { + ompi_universe_info.persistence = false; + } + + enviro_val = getenv("OMPI_universe_silent"); + if (NULL != enviro_val) { /* silent flag passed */ + ompi_universe_info.silent_mode = true; + } else { + ompi_universe_info.silent_mode = false; + } + + enviro_val = getenv("OMPI_universe_webserver"); + if (NULL != enviro_val) { /* webserver flag passed */ + ompi_universe_info.web_server = true; + } else { + ompi_universe_info.web_server = false; + } + + enviro_val = getenv("OMPI_universe_script"); + if (NULL != enviro_val) { /* scriptfile passed */ + if (NULL != ompi_universe_info.scriptfile) { /* overwrite */ + free(ompi_universe_info.scriptfile); + } + ompi_universe_info.scriptfile = strdup(enviro_val); + } else { + if (NULL != ompi_universe_info.scriptfile) { + free(ompi_universe_info.scriptfile); + } + } + + enviro_val = getenv("OMPI_universe_hostfile"); + if (NULL != enviro_val) { /* hostfile passed */ + if (NULL != ompi_universe_info.hostfile) { /* overwrite */ + free(ompi_universe_info.hostfile); + } + ompi_universe_info.hostfile = strdup(enviro_val); + } else { + if (NULL != ompi_universe_info.hostfile) { + free(ompi_universe_info.hostfile); + } + } + + enviro_val = getenv("OMPI_universe_name"); + if (NULL != enviro_val) { /* universe name passed in environment */ + if (NULL != ompi_universe_info.name) { /* got something in it - overwrite */ + free(ompi_universe_info.name); + } + ompi_universe_info.name = strdup(enviro_val); + if (NULL != ompi_process_info.my_universe) { + free(ompi_process_info.my_universe); + } + ompi_process_info.my_universe = strdup(enviro_val); + } else { + if (NULL != ompi_universe_info.name) { + free(ompi_universe_info.name); + } + ompi_universe_info.name = strdup("default-universe"); + if (NULL != ompi_process_info.my_universe) { + free(ompi_process_info.my_universe); + } + ompi_process_info.my_universe = strdup("default-universe"); + } + + enviro_val = getenv("OMPI_tmpdir_base"); + if (NULL != enviro_val) { /* tmpdir base passed in environment */ + if (NULL != ompi_process_info.tmpdir_base) { /* overwrite it */ + free(ompi_process_info.tmpdir_base); + } + ompi_process_info.tmpdir_base = strdup(enviro_val); + } else { + if (NULL != ompi_process_info.tmpdir_base) { + free(ompi_process_info.tmpdir_base); + } + } +} diff --git a/src/runtime/ompi_universe.c b/src/runtime/ompi_universe.c deleted file mode 100644 index dde9f1c436..0000000000 --- a/src/runtime/ompi_universe.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $HEADER$ - * - */ - -#include "ompi_config.h" -#include "include/constants.h" - -#include -#include -#include -#include -#include - -#include "util/os_path.h" -#include "runtime/universe_connect.h" - -int -ompi_universe_connect(char *tmpdir) -{ - char *uri, tmp[100], *oob_info_path; - FILE *fp; - - if (NULL == tmpdir) { /* protect against errors */ - return(OMPI_ERROR); - } - - oob_info_path = ompi_os_path(false, tmpdir, "oob", NULL); - fp = fopen(oob_info_path, "r"); - if (NULL == fp) { - return(OMPI_ERROR); - } - - fscanf(fp, "%s", tmp); - uri = strdup(tmp); - fclose(fp); - return(OMPI_SUCCESS); -} diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 0912849469..7a59dcb95e 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -99,6 +99,7 @@ extern "C" { */ int ompi_rte_init_stage1(bool *allow_multi_user_threads, bool *have_hidden_threads); int ompi_rte_init_stage2(bool *allow_multi_user_threads, bool *have_hidden_threads); + int ompi_rte_init_finalstage(bool *allow_multi_user_threads, bool *have_hidden_threads); /** * Finalize the Open MPI run time environment @@ -288,6 +289,18 @@ extern "C" { */ int ompi_rte_local_universe_exists(void); + /** + * Parse the RTE environmental variables + * + * Checks the environmental variables and passes their info (where + * set) into the respective info structures. + * + * @param None + * + * @retval None + */ + void ompi_rte_parse_environ(void); + #ifdef __cplusplus } #endif diff --git a/src/runtime/universe_connect.h b/src/runtime/universe_connect.h deleted file mode 100644 index 9a483271a1..0000000000 --- a/src/runtime/universe_connect.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * $HEADER$ - * - */ -/** @file - * - */ - -/** - * code required to start connection to universe - * - * \warning Interface may change in the near future - */ -int ompi_universe_connect(char *tmpdir); diff --git a/src/tools/mpirun/mpirun2.c b/src/tools/mpirun/mpirun2.c index 4030ea7c7c..464be62943 100644 --- a/src/tools/mpirun/mpirun2.c +++ b/src/tools/mpirun/mpirun2.c @@ -14,6 +14,9 @@ #include "util/argv.h" #include "mca/oob/base/base.h" #include "util/cmd_line.h" +#include "util/sys_info.h" +#include "runtime/runtime.h" +#include "util/session_dir.h" #include "include/constants.h" #include @@ -22,8 +25,6 @@ extern char** environ; -static long num_running_procs; - int main(int argc, char *argv[]) @@ -38,7 +39,7 @@ main(int argc, char *argv[]) int num_procs = 1; ompi_rte_node_schedule_t *sched; char cwd[MAXPATHLEN]; - char *my_contact_info, *tmp; + char *my_contact_info, *tmp, *jobid_str, *procid_str; /* * Intialize our Open MPI environment @@ -113,14 +114,63 @@ main(int argc, char *argv[]) return ret; } - /* init proc info - assigns name, among other things */ + /***** SET MY NAME *****/ + if (NULL == ompi_process_info.name) { /* don't overwrite an existing name */ + if (ompi_process_info.seed) { + ompi_process_info.name = ompi_name_server.create_process_name(0, 0, 0); + } else { + ompi_process_info.name = ompi_rte_get_self(); + } + } + + /* get my process info */ ompi_proc_info(); - /* - * Prep for starting a new job - */ +/* setup my session directory */ + jobid_str = ompi_name_server.get_jobid_string(ompi_process_info.name); + procid_str = ompi_name_server.get_vpid_string(ompi_process_info.name); + + if (ompi_rte_debug_flag) { + ompi_output(0, "[%d,%d,%d] setting up session dir with", ompi_process_info.name->cellid, ompi_process_info.name->jobid, ompi_process_info.name->vpid); + if (NULL != ompi_process_info.tmpdir_base) { + ompi_output(0, "\ttmpdir %s", ompi_process_info.tmpdir_base); + } + ompi_output(0, "\tuniverse %s", ompi_process_info.my_universe); + ompi_output(0, "\tuser %s", ompi_system_info.user); + ompi_output(0, "\thost %s", ompi_system_info.nodename); + ompi_output(0, "\tjobid %s", jobid_str); + ompi_output(0, "\tprocid %s", procid_str); + } + if (OMPI_ERROR == ompi_session_dir(true, + ompi_process_info.tmpdir_base, + ompi_system_info.user, + ompi_system_info.nodename, NULL, + ompi_process_info.my_universe, + jobid_str, procid_str)) { + if (jobid_str != NULL) free(jobid_str); + if (procid_str != NULL) free(procid_str); + exit(-1); + } - /* BWB - ompi_rte_get_new_jobid() */ + /* + * Register my process info with my replica. + */ + if (OMPI_SUCCESS != (ret = ompi_rte_register())) { + ompi_output(0, "ompi_rte_init: failed in ompi_rte_register()\n"); + return ret; + } + + /* finalize the rte startup */ + if (OMPI_SUCCESS != (ret = ompi_rte_init_finalstage(&multi_thread, + &hidden_thread))) { + /* JMS show_help */ + printf("show_help: ompid failed in ompi_rte_init\n"); + return ret; + } + + /***** PREP TO START THE APPLICATION *****/ + + /* get the jobid for the application */ new_jobid = ompi_name_server.create_jobid(); /* BWB - fix jobid, procs, and nodes */ diff --git a/src/tools/ompid/ompid.c b/src/tools/ompid/ompid.c index 8bcb402567..e72e8c630d 100644 --- a/src/tools/ompid/ompid.c +++ b/src/tools/ompid/ompid.c @@ -20,7 +20,11 @@ #include "util/session_dir.h" #include "util/printf.h" #include "util/daemon_init.h" + #include "mca/base/base.h" +#include "mca/ns/base/base.h" +#include "mca/gpr/base/base.h" + #include "tools/ompid/ompid.h" /* @@ -36,14 +40,14 @@ const char *type_base = "base"; int main(int argc, char *argv[]) { - int ret = 0, i; + int ret = 0; bool allow_multi_user_threads = false; bool have_hidden_threads = false; + char *jobid_str, *procid_str; - for (i=0; icellid, ompi_process_info.name->jobid, ompi_process_info.name->vpid); + if (NULL != ompi_process_info.tmpdir_base) { + ompi_output(0, "\ttmpdir %s", ompi_process_info.tmpdir_base); + } + ompi_output(0, "\tuniverse %s", ompi_process_info.my_universe); + ompi_output(0, "\tuser %s", ompi_system_info.user); + ompi_output(0, "\thost %s", ompi_system_info.nodename); + ompi_output(0, "\tjobid %s", jobid_str); + ompi_output(0, "\tprocid %s", procid_str); + } + if (OMPI_ERROR == ompi_session_dir(true, + ompi_process_info.tmpdir_base, + ompi_system_info.user, + ompi_system_info.nodename, NULL, + ompi_process_info.my_universe, + jobid_str, procid_str)) { + if (jobid_str != NULL) free(jobid_str); + if (procid_str != NULL) free(procid_str); + exit(-1); + } - /* if (ompi_cmd_line_is_taken(ompi_common_cmd_line, "version")) { */ - /* printf ("ompid (OpenMpi Daemon) version: 0\n"); */ - /* } */ - + /* + * Register my process info with my replica. + */ + if (OMPI_SUCCESS != (ret = ompi_rte_register())) { + ompi_output(0, "ompi_rte_init: failed in ompi_rte_register()\n"); + return ret; + } - /* /\* setup universe session directory *\/ */ - /* if (OMPI_SUCCESS != ompi_session_dir(true, tmpdir, ompi_system_info.user, ompi_system_info.nodename, NULL, */ - /* ompi_universe.name, NULL, NULL)) { /\* couldn't create session dir - error *\/ */ - /* fprintf(stderr, "could not create universe session directory tree - please report error to bugs@open-mpi.org\n"); */ - /* exit(1); */ - /* } */ + /* finalize the rte startup */ + if (OMPI_SUCCESS != (ret = ompi_rte_init_finalstage(&allow_multi_user_threads, + &have_hidden_threads))) { + /* JMS show_help */ + printf("show_help: ompid failed in ompi_rte_init\n"); + return ret; + } - /* /\* If there is a seed argument, this is the magic */ - /* * seed daemon. */ - /* *\/ */ - /* if ( ompi_cmd_line_is_taken(cmd_line, "seed")) { */ - /* ompi_process_info.seed = true; */ - /* ompi_process_info.my_universe = strdup(ompi_universe.name); */ - /* } */ + /* register this node on the virtual machine */ + /* ompi_vm_register(); */ - /* /\* convert myself to be a daemon *\/ */ - /* if (OMPI_SUCCESS != ompi_daemon_init(ompi_process_info.universe_session_dir)) { */ - /* fprintf(stderr, "could not convert to daemon - please report error to bugs@open-mpi.org\n"); */ - /* exit(1); */ - /* } */ + /* register the daemon callback function */ - - /* /\* before calling anything else we to call rte init *\/ */ - /* if (OMPI_SUCCESS != ompi_rte_init(&multi_thread, &hidden_thread)) { */ - /* printf("ompid: ompi_rte_init failed\n"); */ - - /* /\* Do a partial clean-up. This needs to be reviewed */ - /* * at a later date to make certain we are not */ - /* * missing soemthing */ - /* *\/ */ - /* ompi_rte_finalize(); */ - /* OBJ_RELEASE(cmd_line); */ - /* mca_base_close(); */ + /* setup and enter the event monitor */ - /* return 1; */ - /* } */ - - - /* /\* */ - /* * if seed, call open functions of comm frameworks (oob, socket, etc.) to */ - /* * get contact info. write contact info into universe session directory */ - - /* /\* get OOB contact info *\/ */ - /* ompi_universe.oob_contact_info = mca_oob_get_contact_info(); */ - - /* /\* get Web contact info *\/ */ - /* ompi_universe.socket_contact_info = strdup("dum.add.for.tst"); */ - - /* /\* save all pertinent info in universe file *\/ */ - /* contact_file = ompi_os_path(false, ompi_process_info.universe_session_dir, */ - /* "universe-setup.txt", NULL); */ - - /* if (OMPI_SUCCESS != ompi_write_universe_setup_file(contact_file, &ompi_universe)) { */ - /* fprintf(stderr, "couldn't write universe setup file: %s\n", contact_file); */ - /* exit(1); */ - /* } */ - - /* /\* put info on the registry *\/ */ - - /* fprintf(stderr, "openmpi: entering event loop\n"); */ - /* /\* event loop *\/ */ - - - /* /\* if hostfile, startup virtual machine *\/ */ - /* /\* check registry for nodes in hostfile - if not found, add them *\/ */ - /* /\* send command - ompi_vm_startup to seed that causes it to read registry segment, check if ompid already */ - /* * on each node, spin one up if not *\/ */ - - - - /* * as file "contact-info" so others can find us. */ - /* *\/ */ - - /* /\* Add in the calls to initialize the services *\/ */ - - /* /\* Add the section for the event loop... *\/ */ - - /* /\* All done *\/ */ - - /* /\* Close services *\/ */ - - /* OBJ_RELEASE(cmd_line); */ - /* mca_base_close(); */ + ompi_rte_finalize(); + mca_base_close(); ompi_finalize(); return 0; } + + +/* /\* convert myself to be a daemon *\/ */ +/* if (OMPI_SUCCESS != ompi_daemon_init(ompi_process_info.universe_session_dir)) { */ +/* fprintf(stderr, "could not convert to daemon - please report error to bugs@open-mpi.org\n"); */ +/* exit(1); */ +/* } */ + +/* * as file "contact-info" so others can find us. */ +/* *\/ */ + +/* /\* Add in the calls to initialize the services *\/ */ + +/* /\* Add the section for the event loop... *\/ */ + +/* /\* All done *\/ */ + +/* /\* Close services *\/ */ + +/* OBJ_RELEASE(cmd_line); */ +/* mca_base_close(); */ diff --git a/src/tools/openmpi/openmpi.c b/src/tools/openmpi/openmpi.c index ea3ce74671..0404165dbd 100644 --- a/src/tools/openmpi/openmpi.c +++ b/src/tools/openmpi/openmpi.c @@ -33,34 +33,24 @@ #include "mca/base/base.h" #include "mca/oob/base/base.h" #include "mca/ns/base/base.h" +#include "mca/gpr/base/base.h" #include "mca/pcm/base/base.h" #include "tools/ompid/ompid.h" #include "runtime/runtime.h" -extern char** environ; - int main(int argc, char **argv) { ompi_cmd_line_t *cmd_line = NULL; - char *universe = NULL, *tmp=NULL, **tmp2=NULL; - char *contact_info=NULL; - char **seed_argv; + char *universe = NULL; pid_t pid; bool multi_thread = false; bool hidden_thread = false; - int ret, i, seed_argc; - ompi_rte_node_schedule_t *sched; - char cwd[MAXPATHLEN]; - ompi_list_t *nodelist = NULL; - ompi_list_t schedlist; + int ret; - /* require tcp oob */ - setenv("OMPI_MCA_oob_base_include", "tcp", 1); - - /* + /* * Intialize the Open MPI environment */ if (OMPI_SUCCESS != ompi_init(argc, argv)) { @@ -124,21 +114,33 @@ int main(int argc, char **argv) exit(1); } - /* parse the cmd_line for rte options */ + /* parse the cmd_line for rte options - override settings from enviro, where necessary + * copy everything into enviro variables for passing later on + */ ompi_rte_parse_cmd_line(cmd_line); - /* start the initial barebones RTE (just OOB) so we can check universe existence */ if (OMPI_SUCCESS != (ret = mca_base_open())) { /* JMS show_help */ printf("show_help: mca_base_open failed\n"); exit(ret); } - ompi_rte_init_stage1(&multi_thread, &hidden_thread); + ompi_rte_init_stage1(&multi_thread, &hidden_thread); /* gets universe and tmpdir enviro variables */ + + /* parse the cmd_line for daemon options - gets all the options relating + * specifically to seed behavior, but also gets + * options about scripts and hostfiles that might be of use to me + * puts everything into enviro variables for future passing + */ + ompi_rte_parse_daemon_cmd_line(cmd_line); /* check for local universe existence */ - if ((0 == strncmp(ompi_universe_info.host, ompi_system_info.nodename, strlen(ompi_system_info.nodename))) && - (OMPI_SUCCESS != (ret = ompi_rte_local_universe_exists())) && + if (0 != strncmp(ompi_universe_info.host, ompi_system_info.nodename, strlen(ompi_system_info.nodename))) { + fprintf(stderr, "remote universe operations not supported at this time\n"); + exit(1); + } + + if (OMPI_SUCCESS != (ret = ompi_rte_local_universe_exists()) && (OMPI_ERR_NOT_IMPLEMENTED != ret)) { if (OMPI_ERR_NOT_FOUND != ret) { @@ -157,110 +159,37 @@ int main(int argc, char **argv) ompi_process_info.my_universe = strdup(ompi_universe_info.name); - /* startup rest of RTE - needed for handshake with seed */ - ompi_process_info.ns_replica = NULL; - ompi_process_info.gpr_replica = NULL; - ompi_rte_init_stage2(&multi_thread, &hidden_thread); + /* ensure the enviro variables do NOT specify any replicas so that seed + * will start them up + */ + unsetenv("OMPI_MCA_ns_base_replica"); + unsetenv("OMPI_MCA_gpr_base_replica"); - /* parse command line for rest of seed options */ - ompi_rte_parse_daemon_cmd_line(cmd_line); - - /* does not exist - need to start it locally - * using fork/exec process + /* we're set - fork/exec ompid for local start of seed */ if ((pid = fork()) < 0) { - fprintf(stderr, "unable to start universe - please report error to bugs@open-mpi.org\n"); - exit(-1); - } else if (pid == 0) { /* child process does the exec */ - - /* build the environment for the seed - * including universe name and tmpdir_base - */ - seed_argv = NULL; - seed_argc = 0; - ompi_argv_append(&seed_argc, &seed_argv, "ompid"); - ompi_argv_append(&seed_argc, &seed_argv, "-seed"); - ompi_argv_append(&seed_argc, &seed_argv, "-scope"); - ompi_argv_append(&seed_argc, &seed_argv, ompi_universe_info.scope); - if (ompi_universe_info.persistence) { - ompi_argv_append(&seed_argc, &seed_argv, "-persistent"); - } - if (ompi_universe_info.web_server) { - ompi_argv_append(&seed_argc, &seed_argv, "-webserver"); - } - if (NULL != ompi_universe_info.scriptfile) { - ompi_argv_append(&seed_argc, &seed_argv, "-script"); - ompi_argv_append(&seed_argc, &seed_argv, ompi_universe_info.scriptfile); - } - if (NULL != ompi_universe_info.hostfile) { - ompi_argv_append(&seed_argc, &seed_argv, "-hostfile"); - ompi_argv_append(&seed_argc, &seed_argv, ompi_universe_info.hostfile); - } - /* provide my contact info as the temporary registry replica*/ - contact_info = mca_oob_get_contact_info(); - ompi_argv_append(&seed_argc, &seed_argv, "-gprreplica"); - ompi_argv_append(&seed_argc, &seed_argv, contact_info); - /* add options for universe name and tmpdir_base, if provided */ - ompi_argv_append(&seed_argc, &seed_argv, "-universe"); - ompi_argv_append(&seed_argc, &seed_argv, ompi_universe_info.name); - if (NULL != ompi_process_info.tmpdir_base) { - ompi_argv_append(&seed_argc, &seed_argv, "-tmpdir"); - ompi_argv_append(&seed_argc, &seed_argv, ompi_process_info.tmpdir_base); - } - - /* - * spawn the local seed - */ - if (0 > execvp("ompid", seed_argv)) { - fprintf(stderr, "unable to exec daemon - please report error to bugs@open-mpi.org\n"); - fprintf(stderr, "errno: %s\n", strerror(errno)); - exit(1); - } + fprintf(stderr, "unable to fork - please report error to bugs@open-mpi.org\n"); + exit(1); + } else if (pid != 0) { + ompi_rte_finalize(); + mca_base_close(); + ompi_finalize(); + exit(0); /* parent goes bye-bye */ } - } else { /* check for remote universe existence */ - /* future implementation: launch probe daemon, providing my contact info, probe - * checks for session directory on remote machine and transmits back results - * then probe dies - */ + if (0 > execvp("ompid", argv)) { + fprintf(stderr, "unable to exec daemon - please report error to bugs@open-mpi.org\n"); + fprintf(stderr, "errno: %s\n", strerror(errno)); + ompi_rte_finalize(); + mca_base_close(); + ompi_finalize(); + exit(1); + + } + } else { + fprintf(stderr, "local universe check reports not implemented code\n"); } - - /* if console, kickoff console - point comm at universe */ - - /* all done, so exit! */ - exit(0); - + ompi_rte_finalize(); + mca_base_close(); + ompi_finalize(); + return -1; } - -/* /\* start the rest of the RTE *\/ */ -/* ompi_rte_init_stage2(&multi_thread, &hidden_thread); */ - -/* fprintf(stderr, "allocating procesors\n"); */ - -/* /\* allocate a processor to the job *\/ */ -/* nodelist = ompi_rte_allocate_resources(0, 0, 1); */ -/* if (NULL == nodelist) { */ -/* /\* BWB show_help *\/ */ -/* printf("show_help: ompi_rte_allocate_resources failed\n"); */ -/* exit(-1); */ -/* } */ - -/* fprintf(stderr, "scheduling\n"); */ - -/* /\* */ -/* * "schedule" seed process */ -/* *\/ */ -/* OBJ_CONSTRUCT(&schedlist, ompi_list_t); */ -/* sched = OBJ_NEW(ompi_rte_node_schedule_t); */ -/* ompi_list_append(&schedlist, (ompi_list_item_t*) sched); */ -/* ompi_argv_append(&(sched->argc), &(sched->argv), */ -/* "/Users/rcastain/Documents/OpenMPI/src/tools/ompid/ompid"); */ -/* /\* ompi_cmd_line_get_tail(cmd_line, &(sched->argc), &(sched->argv)); *\/ */ - -/* if (OMPI_SUCCESS != mca_pcm.pcm_spawn_procs(0, &schedlist)) { */ -/* printf("show_help: woops! the seed didn't spawn :( \n"); */ -/* exit(-1); */ -/* } */ -/* getcwd(cwd, MAXPATHLEN); */ -/* sched->cwd = strdup(cwd); */ -/* sched->nodelist = nodelist; */ - diff --git a/src/util/proc_info.c b/src/util/proc_info.c index d9ea8b5402..edef7cbda0 100644 --- a/src/util/proc_info.c +++ b/src/util/proc_info.c @@ -24,7 +24,7 @@ ompi_proc_info_t ompi_process_info = { /* .seed = */ false, /* .ns_replica = */ NULL, /* .gpr_replica = */ NULL, - /* .my_universe */ "default-universe", + /* .my_universe */ NULL, /* .tmpdir_base = */ NULL, /* .top_session_dir = */ NULL, /* .universe_session_dir = */ NULL, @@ -48,12 +48,6 @@ int ompi_proc_info(void) /* get the process id */ ompi_process_info.pid = getpid(); - /* set process name */ - if (ompi_process_info.seed) { - ompi_process_info.name = ompi_name_server.create_process_name(0, 0, 0); - } else { - ompi_process_info.name = ompi_rte_get_self(); - } /* set process to inited */ ompi_process_info.init = true;