Skip to content

Commit 92dd719

Browse files
committed
oshmem: move finalization from the liboshmem destructor into oshmem_onexit()
so we can use the legacy start_pes even when Open MPI is compiled with --enable-static or --disable-visibility
1 parent 83399ad commit 92dd719

File tree

4 files changed

+10
-25
lines changed

4 files changed

+10
-25
lines changed

oshmem/include/oshmem_config.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
*
33
* Copyright (c) 2013 Mellanox Technologies, Inc.
44
* All rights reserved.
5-
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
5+
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
6+
* Copyright (c) 2016 Research Organization for Information Science
7+
* and Technology (RIST). All rights reserved.
68
* $COPYRIGHT$
79
*
810
* Additional copyrights may follow
@@ -52,19 +54,13 @@
5254
# ifndef OSHMEM_MODULE_DECLSPEC
5355
# define OSHMEM_MODULE_DECLSPEC __opal_attribute_visibility__("default")
5456
# endif
55-
# ifndef OSHMEM_DESTRUCTOR
56-
# define OSHMEM_DESTRUCTOR __opal_attribute_destructor__
57-
# endif
5857
# else
5958
# ifndef OSHMEM_DECLSPEC
6059
# define OSHMEM_DECLSPEC
6160
# endif
6261
# ifndef OSHMEM_MODULE_DECLSPEC
6362
# define OSHMEM_MODULE_DECLSPEC
6463
# endif
65-
# ifndef OSHMEM_DESTRUCTOR
66-
# define OSHMEM_DESTRUCTOR
67-
# endif
6864
# endif
6965
#endif /* defined(__WINDOWS__) */
7066

oshmem/include/pshmem.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@
3434
# endif
3535
#endif
3636

37-
#ifndef OSHMEM_DESTRUCTOR
38-
# if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1)
39-
# define OSHMEM_DESTRUCTOR __attribute__((__destructor__))
40-
# else
41-
# define OSHMEM_DESTRUCTOR
42-
# endif
43-
#endif
44-
4537
#include <pshmemx.h>
4638

4739
#if defined(c_plusplus) || defined(__cplusplus)
@@ -61,7 +53,7 @@ OSHMEM_DECLSPEC void pshmem_global_exit(int status);
6153
/*
6254
* Finalization routines
6355
*/
64-
OSHMEM_DECLSPEC void pshmem_finalize(void) OSHMEM_DESTRUCTOR;
56+
OSHMEM_DECLSPEC void pshmem_finalize(void);
6557

6658
/*
6759
* Query routines

oshmem/include/shmem.h.in

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
33
* All rights reserved.
44
* Copyright (c) 2014 Intel, Inc. All rights reserved
5+
* Copyright (c) 2016 Research Organization for Information Science
6+
* and Technology (RIST). All rights reserved.
57
* $COPYRIGHT$
68
*
79
* Additional copyrights may follow
@@ -40,14 +42,6 @@
4042
# endif
4143
#endif
4244

43-
#ifndef OSHMEM_DESTRUCTOR
44-
# if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1)
45-
# define OSHMEM_DESTRUCTOR __attribute__((__destructor__))
46-
# else
47-
# define OSHMEM_DESTRUCTOR
48-
# endif
49-
#endif
50-
5145
#include <shmem-compat.h>
5246
#include <shmemx.h>
5347

@@ -118,7 +112,7 @@ enum shmem_wait_ops {
118112
* Initialization routines
119113
*/
120114
OSHMEM_DECLSPEC void shmem_init(void);
121-
OSHMEM_DECLSPEC void shmem_finalize(void) OSHMEM_DESTRUCTOR;
115+
OSHMEM_DECLSPEC void shmem_finalize(void);
122116
OSHMEM_DECLSPEC void shmem_global_exit(int status);
123117

124118
/*

oshmem/shmem/c/shmem_init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
* Copyright (c) 2013-2015 Mellanox Technologies, Inc.
33
* All rights reserved.
4+
* Copyright (c) 2016 Research Organization for Information Science
5+
* and Technology (RIST). All rights reserved.
46
* $COPYRIGHT$
57
*
68
* Additional copyrights may follow
@@ -49,6 +51,7 @@ void start_pes(int npes)
4951
static void shmem_onexit(int exitcode, void *arg)
5052
{
5153
oshmem_shmem_globalexit_status = exitcode;
54+
shmem_finalize();
5255
}
5356

5457
static inline void _shmem_init(void)

0 commit comments

Comments
 (0)