This source file includes following definitions.
- MPI_T_finalize
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include "ompi/mpi/tool/mpit-internal.h"
16
17 #include "ompi/runtime/ompi_info_support.h"
18 #include "opal/include/opal/sys/atomic.h"
19 #include "opal/runtime/opal.h"
20
21 #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
22 #pragma weak MPI_T_finalize = PMPI_T_finalize
23 #endif
24
25 #if OMPI_PROFILING_DEFINES
26 #include "ompi/mpi/tool/profile/defines.h"
27 #endif
28
29
30 int MPI_T_finalize (void)
31 {
32 ompi_mpit_lock ();
33
34 if (!mpit_is_initialized ()) {
35 ompi_mpit_unlock ();
36 return MPI_T_ERR_NOT_INITIALIZED;
37 }
38
39 if (0 == --ompi_mpit_init_count) {
40 (void) ompi_info_close_components ();
41
42 int32_t state = ompi_mpi_state;
43 if ((state < OMPI_MPI_STATE_INIT_COMPLETED ||
44 state >= OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT) &&
45 (NULL != ompi_mpi_main_thread)) {
46
47
48 OBJ_RELEASE(ompi_mpi_main_thread);
49 ompi_mpi_main_thread = NULL;
50 }
51
52 (void) opal_finalize_util ();
53 }
54
55 ompi_mpit_unlock ();
56
57 return MPI_SUCCESS;
58 }