File tree Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change 5858#include "oshmem/shmem/shmem_lock.h"
5959#include "oshmem/runtime/oshmem_shmem_preconnect.h"
6060
61+ extern int oshmem_shmem_globalexit_status ;
62+
6163static int _shmem_finalize (void );
6264
6365int oshmem_shmem_finalize (void )
6466{
6567 int ret = OSHMEM_SUCCESS ;
66- static int32_t finalize_has_already_started = 0 ;
6768
68- if (opal_atomic_cmpset_32 (& finalize_has_already_started , 0 , 1 )
69- && oshmem_shmem_initialized && !oshmem_shmem_aborted ) {
69+ if (oshmem_shmem_initialized && !oshmem_shmem_aborted ) {
7070 /* Should be called first because ompi_mpi_finalize makes orte and opal finalization */
7171 ret = _shmem_finalize ();
7272
73- if ((OSHMEM_SUCCESS == ret ) && ompi_mpi_initialized
74- && !ompi_mpi_finalized ) {
75- PMPI_Comm_free (& oshmem_comm_world );
76- ret = ompi_mpi_finalize ();
77- }
78-
7973 if (OSHMEM_SUCCESS == ret ) {
8074 oshmem_shmem_initialized = false;
8175 }
8276 }
8377
78+ if ((OSHMEM_SUCCESS == ret ) && ompi_mpi_initialized
79+ && !ompi_mpi_finalized && oshmem_shmem_globalexit_status == 0 ) {
80+ PMPI_Comm_free (& oshmem_comm_world );
81+ ret = ompi_mpi_finalize ();
82+ }
83+
8484 return ret ;
8585}
8686
Original file line number Diff line number Diff line change 2222#include "oshmem/shmem/c/profile/defines.h"
2323#endif
2424
25- extern int oshmem_shmem_globalexit_status ;
26-
2725void shmem_finalize (void )
2826{
2927 OPAL_CR_FINALIZE_LIBRARY ();
30- if (oshmem_shmem_globalexit_status != 0 )
31- {
32- return ;
33- }
3428 oshmem_shmem_finalize ();
3529}
3630
You can’t perform that action at this time.
0 commit comments