From a9e26c33e0c9e8de3f801ab3af34d64f20d8fda0 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 19 May 2008 21:57:54 +0000 Subject: [PATCH] Ensure that we don't try to call orte_show_help() before orte_init() succeeds. This commit was SVN r18458. --- ompi/runtime/ompi_mpi_init.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index a866e129c2..e071b2221e 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -38,6 +38,7 @@ #include "opal/util/argv.h" #include "opal/util/stacktrace.h" #include "opal/util/num_procs.h" +#include "opal/util/show_help.h" #include "opal/runtime/opal.h" #include "opal/event/event.h" @@ -242,6 +243,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) /* see comment below about sched_yield */ int num_processors; #endif + bool orte_setup = false; /* Setup enough to check get/set MCA params */ @@ -298,6 +300,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) error = "ompi_mpi_init: orte_init failed"; goto error; } + orte_setup = true; /* check for timing request - get stop time and report elapsed time if so */ if (timing && 0 == ORTE_PROC_MY_NAME->vpid) { @@ -748,9 +751,16 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) error: if (ret != OMPI_SUCCESS) { const char *err_msg = opal_strerror(ret); - orte_show_help("help-mpi-runtime", - "mpi_init:startup:internal-failure", true, - "MPI_INIT", "MPI_INIT", error, err_msg, ret); + /* If ORTE was not setup yet, don't use orte_show_help */ + if (orte_setup) { + orte_show_help("help-mpi-runtime", + "mpi_init:startup:internal-failure", true, + "MPI_INIT", "MPI_INIT", error, err_msg, ret); + } else { + opal_show_help("help-mpi-runtime", + "mpi_init:startup:internal-failure", true, + "MPI_INIT", "MPI_INIT", error, err_msg, ret); + } return ret; }