diff --git a/oshmem/include/pshmem.h b/oshmem/include/pshmem.h index 5ef917ec84..53c18ba852 100644 --- a/oshmem/include/pshmem.h +++ b/oshmem/include/pshmem.h @@ -54,6 +54,10 @@ extern "C" { */ OSHMEM_DECLSPEC void pstart_pes(int npes); +/* + * Finalization routines + */ +OSHMEM_DECLSPEC void pshmem_finalize(void) OSHMEM_DESTRUCTOR; /* * Query routines diff --git a/oshmem/shmem/c/Makefile.am b/oshmem/shmem/c/Makefile.am index b90a74ab98..95533bd92c 100644 --- a/oshmem/shmem/c/Makefile.am +++ b/oshmem/shmem/c/Makefile.am @@ -15,12 +15,12 @@ if OSHMEM_PROFILING endif OSHMEM_AUX_SOURCES = \ - shmem_finalize.c \ shmem_lock.c \ globalexit.c OSHMEM_API_SOURCES = \ shmem_init.c \ + shmem_finalize.c \ shmem_free.c \ shmem_alloc.c \ shmem_realloc.c \ diff --git a/oshmem/shmem/c/profile/Makefile.am b/oshmem/shmem/c/profile/Makefile.am index b8f5308e28..35255d3284 100644 --- a/oshmem/shmem/c/profile/Makefile.am +++ b/oshmem/shmem/c/profile/Makefile.am @@ -31,6 +31,7 @@ headers = defines.h OSHMEM_API_SOURCES = \ pshmem_init.c \ + pshmem_finalize.c \ pshmem_free.c \ pshmem_alloc.c \ pshmem_realloc.c \ diff --git a/oshmem/shmem/c/profile/defines.h b/oshmem/shmem/c/profile/defines.h index 4617fa4bc3..98b06c459a 100644 --- a/oshmem/shmem/c/profile/defines.h +++ b/oshmem/shmem/c/profile/defines.h @@ -17,8 +17,16 @@ * pshmem_* symbols */ +/* + * Initialization routines + */ #define start_pes pstart_pes +/* + * Finalization routines + */ +#define shmem_finalize pshmem_finalize + /* * Query routines diff --git a/oshmem/shmem/c/shmem_finalize.c b/oshmem/shmem/c/shmem_finalize.c index f2dcf7b389..fb41131643 100644 --- a/oshmem/shmem/c/shmem_finalize.c +++ b/oshmem/shmem/c/shmem_finalize.c @@ -16,6 +16,12 @@ #include "oshmem/include/shmem.h" #include "oshmem/runtime/runtime.h" +#if OSHMEM_PROFILING +#include "oshmem/include/pshmem.h" +#pragma weak shmem_finalize = pshmem_finalize +#include "oshmem/shmem/c/profile/defines.h" +#endif + void shmem_finalize(void) { OPAL_CR_FINALIZE_LIBRARY();