From 995641c1e6e6be31c61c85b045f4f413327a0101 Mon Sep 17 00:00:00 2001 From: David Daniel Date: Wed, 31 Aug 2005 00:21:55 +0000 Subject: [PATCH] Don't initialize proctable more than once (since the stage gate 1 trigger seems to get fired at least twice). This commit was SVN r7101. --- ompi/runtime/ompi_mpi_init.c | 6 ++++++ orte/tools/orterun/totalview.c | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 6255ce7c27..75fb1735ad 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -87,6 +87,12 @@ bool ompi_mpi_maffinity_setup = false; int MPIR_being_debugged = 0; volatile int MPIR_debug_gate = 0; volatile int MPIR_debug_state = 0; +struct MPIR_PROCDESC { + char *host_name; /* something that can be passed to inet_addr */ + char *executable_name; /* name of binary */ + int pid; /* process pid */ +}; +struct MPIR_PROCDESC *MPIR_proctable = NULL; int ompi_mpi_init(int argc, char **argv, int requested, int *provided) diff --git a/orte/tools/orterun/totalview.c b/orte/tools/orterun/totalview.c index b0f5e51e80..8fe92ba0a2 100644 --- a/orte/tools/orterun/totalview.c +++ b/orte/tools/orterun/totalview.c @@ -55,9 +55,8 @@ struct MPIR_PROCDESC { char *executable_name; /* name of binary */ int pid; /* process pid */ }; -typedef struct MPIR_PROCDESC MPIR_PROCDESC; -MPIR_PROCDESC *MPIR_proctable = NULL; +struct MPIR_PROCDESC *MPIR_proctable = NULL; int MPIR_proctable_size = 0; int MPIR_being_debugged = 0; int MPIR_force_to_main = 0; @@ -65,7 +64,6 @@ volatile int MPIR_debug_state = 0; volatile int MPIR_i_am_starter = 0; volatile int MPIR_debug_gate = 0; volatile int MPIR_acquired_pre_main = 0; -volatile int debugger_dummy = 0; void *MPIR_Breakpoint(void); @@ -120,7 +118,7 @@ static void dump(void) */ void orte_totalview_init_before_spawn(void) { - if (MPIR_DEBUG_SPAWNED == MPIR_debug_state) { + if (MPIR_DEBUG_SPAWNED == MPIR_being_debugged) { int value; char *s; @@ -161,6 +159,11 @@ void orte_totalview_init_after_spawn(orte_jobid_t jobid) int i; int rc; + if (MPIR_proctable) { + /* already initialized */ + return; + } + if (0) { /* debugging daemons <<-- needs work */ if (orte_debug_flag) { @@ -180,6 +183,8 @@ void orte_totalview_init_after_spawn(orte_jobid_t jobid) opal_output(0, "Info: Setting up debugger process table for applications\n"); } + MPIR_debug_state = 1; + OBJ_CONSTRUCT(&list_of_resource_maps, opal_list_t); /* Get a list of the resource maps for this job */ @@ -201,8 +206,8 @@ void orte_totalview_init_after_spawn(orte_jobid_t jobid) /* allocate MPIR_proctable */ - MPIR_proctable = (MPIR_PROCDESC *) malloc(sizeof(MPIR_PROCDESC) * - MPIR_proctable_size); + MPIR_proctable = (struct MPIR_PROCDESC *) malloc(sizeof(struct MPIR_PROCDESC) * + MPIR_proctable_size); if (MPIR_proctable == NULL) { opal_output(0, "Error: Out of memory\n"); OBJ_DESTRUCT(&list_of_resource_maps);