Skip to content

v2.1.x: oshmem: move finalisation to oshmem_onexit #2121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions oshmem/include/oshmem_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
*
* Copyright (c) 2013 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -52,19 +54,13 @@
# ifndef OSHMEM_MODULE_DECLSPEC
# define OSHMEM_MODULE_DECLSPEC __opal_attribute_visibility__("default")
# endif
# ifndef OSHMEM_DESTRUCTOR
# define OSHMEM_DESTRUCTOR __opal_attribute_destructor__
# endif
# else
# ifndef OSHMEM_DECLSPEC
# define OSHMEM_DECLSPEC
# endif
# ifndef OSHMEM_MODULE_DECLSPEC
# define OSHMEM_MODULE_DECLSPEC
# endif
# ifndef OSHMEM_DESTRUCTOR
# define OSHMEM_DESTRUCTOR
# endif
# endif
#endif /* defined(__WINDOWS__) */

Expand Down
12 changes: 3 additions & 9 deletions oshmem/include/pshmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -32,14 +34,6 @@
# endif
#endif

#ifndef OSHMEM_DESTRUCTOR
# if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1)
# define OSHMEM_DESTRUCTOR __attribute__((__destructor__))
# else
# define OSHMEM_DESTRUCTOR
# endif
#endif

#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define OSHMEMP_HAVE_C11 1
#else
Expand All @@ -65,7 +59,7 @@ OSHMEM_DECLSPEC void pshmem_global_exit(int status);
/*
* Finalization routines
*/
OSHMEM_DECLSPEC void pshmem_finalize(void) OSHMEM_DESTRUCTOR;
OSHMEM_DECLSPEC void pshmem_finalize(void);

/*
* Query routines
Expand Down
12 changes: 3 additions & 9 deletions oshmem/include/shmem.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -39,14 +41,6 @@
# endif
#endif

#ifndef OSHMEM_DESTRUCTOR
# if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1)
# define OSHMEM_DESTRUCTOR __attribute__((__destructor__))
# else
# define OSHMEM_DESTRUCTOR
# endif
#endif

#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define OSHMEM_HAVE_C11 1
#else
Expand Down Expand Up @@ -123,7 +117,7 @@ enum shmem_wait_ops {
* Initialization routines
*/
OSHMEM_DECLSPEC void shmem_init(void);
OSHMEM_DECLSPEC void shmem_finalize(void) OSHMEM_DESTRUCTOR;
OSHMEM_DECLSPEC void shmem_finalize(void);
OSHMEM_DECLSPEC void shmem_global_exit(int status);

/*
Expand Down
3 changes: 3 additions & 0 deletions oshmem/shmem/c/shmem_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -50,6 +52,7 @@ void start_pes(int npes)
static void shmem_onexit(int exitcode, void *arg)
{
oshmem_shmem_globalexit_status = exitcode;
shmem_finalize();
}

static inline void _shmem_init(void)
Expand Down