Skip to content

Commit ceb9259

Browse files
committed
shmem: fix oshmem_shmem_finalize() when main() returns not zero value.
Example: int main(void) { int rc = 0; shmem_init(); if (0 == shmem_my_pe()) rc = 1; shmem_finalize(); return rc; } If the user wants to return not-zero status, this leads to `ompi_mpi_finalize()` won't be called and the program terminates abnormally. Signed-off-by: Boris Karasev <karasev.b@gmail.com>
1 parent 38c47fa commit ceb9259

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

oshmem/runtime/oshmem_shmem_finalize.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#include "oshmem/shmem/shmem_lock.h"
5454
#include "oshmem/runtime/oshmem_shmem_preconnect.h"
5555

56-
extern int oshmem_shmem_globalexit_status;
56+
extern int oshmem_shmem_inglobalexit;
5757

5858
static int _shmem_finalize(void);
5959

@@ -79,7 +79,7 @@ int oshmem_shmem_finalize(void)
7979
if ((OSHMEM_SUCCESS == ret) &&
8080
(state >= OMPI_MPI_STATE_INIT_COMPLETED &&
8181
state < OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT) &&
82-
oshmem_shmem_globalexit_status == 0) {
82+
(oshmem_shmem_inglobalexit == 0)) {
8383
PMPI_Comm_free(&oshmem_comm_world);
8484
ret = ompi_mpi_finalize();
8585
}

0 commit comments

Comments
 (0)