1010 * Copyright (c) 2004-2005 The Regents of the University of California.
1111 * All rights reserved.
1212 * Copyright (c) 2006 University of Houston. All rights reserved.
13- * Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
13+ * Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved
1414 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1515 * Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved.
1616 * Copyright (c) 2012 Los Alamos National Security, LLC.
@@ -149,7 +149,8 @@ void ompi_mpi_errors_return_win_handler(struct ompi_win_t **win,
149149
150150static void out (char * str , char * arg )
151151{
152- if (ompi_rte_initialized && !ompi_mpi_finalized ) {
152+ if (ompi_rte_initialized &&
153+ ompi_mpi_state < OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT ) {
153154 if (NULL != arg ) {
154155 opal_output (0 , str , arg );
155156 } else {
@@ -280,7 +281,9 @@ static void backend_fatal_no_aggregate(char *type,
280281{
281282 char * arg ;
282283
283- assert (!ompi_mpi_initialized || ompi_mpi_finalized );
284+ int32_t state = ompi_mpi_state ;
285+ assert (state < OMPI_MPI_STATE_INIT_COMPLETED ||
286+ state >= OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT );
284287
285288 fflush (stdout );
286289 fflush (stderr );
@@ -289,7 +292,7 @@ static void backend_fatal_no_aggregate(char *type,
289292
290293 /* Per #2152, print out in plain english if something was invoked
291294 before MPI_INIT* or after MPI_FINALIZE */
292- if (! ompi_mpi_init_started && ! ompi_mpi_initialized ) {
295+ if (state < OMPI_MPI_STATE_INIT_STARTED ) {
293296 if (NULL != arg ) {
294297 out ("*** The %s() function was called before MPI_INIT was invoked.\n"
295298 "*** This is disallowed by the MPI standard.\n" , arg );
@@ -300,7 +303,7 @@ static void backend_fatal_no_aggregate(char *type,
300303 "*** function was invoked, sorry. :-(\n" , NULL );
301304 }
302305 out ("*** Your MPI job will now abort.\n" , NULL );
303- } else if (ompi_mpi_finalized ) {
306+ } else if (state >= OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT ) {
304307 if (NULL != arg ) {
305308 out ("*** The %s() function was called after MPI_FINALIZE was invoked.\n"
306309 "*** This is disallowed by the MPI standard.\n" , arg );
0 commit comments