Skip to content

Commit 315a622

Browse files
committed
ompi: invokes opal_cleanup() if ompi_mpi_finalize() when possible
As long as it is illegal to call MPI_T_init_thread() after MPI_Finalize(), be gentle and release as much memory as possible in MPI_Finalize(). opal_cleanup() will be invoked again by the OPAL destructor, but will do nothing since classes was set to NULL
1 parent 0d24fad commit 315a622

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ompi/runtime/ompi_mpi_finalize.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1818
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
1919
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
20+
* Copyright (c) 2016 Research Organization for Information Science
21+
* and Technology (RIST). All rights reserved.
2022
*
2123
* $COPYRIGHT$
2224
*
@@ -485,6 +487,13 @@ int ompi_mpi_finalize(void)
485487
goto done;
486488
}
487489

490+
if (0 == opal_initialized) {
491+
/* if there is no MPI_T_init_thread that has been MPI_T_finalize'd,
492+
* then be gentle to the app and release all the memory now (instead
493+
* of the opal library destructor */
494+
opal_class_finalize();
495+
}
496+
488497
/* All done */
489498

490499
done:

0 commit comments

Comments
 (0)