[Openmp-commits] [PATCH] D91869: [OpenMP] change shm name to include UID, call unregister_lib on SIGTERM
Todd Erdner via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Fri Nov 20 07:50:01 PST 2020
terdner updated this revision to Diff 306694.
terdner added a comment.
windows doesn't have gituid call so leave windows env variable alone.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91869/new/
https://reviews.llvm.org/D91869
Files:
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_runtime.cpp
openmp/runtime/src/z_Linux_util.cpp
Index: openmp/runtime/src/z_Linux_util.cpp
===================================================================
--- openmp/runtime/src/z_Linux_util.cpp
+++ openmp/runtime/src/z_Linux_util.cpp
@@ -1149,6 +1149,7 @@
if (__kmp_debug_buf) {
__kmp_dump_debug_buffer();
}
+ __kmp_unregister_library(); // cleanup shared memory
KMP_MB(); // Flush all pending memory write invalidates.
TCW_4(__kmp_global.g.g_abort, signo);
KMP_MB(); // Flush all pending memory write invalidates.
Index: openmp/runtime/src/kmp_runtime.cpp
===================================================================
--- openmp/runtime/src/kmp_runtime.cpp
+++ openmp/runtime/src/kmp_runtime.cpp
@@ -98,7 +98,6 @@
#if KMP_OS_WINDOWS
static int __kmp_unregister_root_other_thread(int gtid);
#endif
-static void __kmp_unregister_library(void); // called by __kmp_internal_end()
static void __kmp_reap_thread(kmp_info_t *thread, int is_root);
kmp_info_t *__kmp_thread_pool_insert_pt = NULL;
@@ -6360,7 +6359,12 @@
each thread. If registration and unregistration go in different threads
(omp_misc_other_root_exit.cpp test case), the name of registered_lib_env
env var can not be found, because the name will contain different pid. */
+#if KMP_OS_UNIX && KMP_DYNAMIC_LIB // shared memory is with dynamic library
+ return __kmp_str_format("__KMP_REGISTERED_LIB_%d_%d", (int)getpid(),
+ (int)getuid());
+#else
return __kmp_str_format("__KMP_REGISTERED_LIB_%d", (int)getpid());
+#endif
} // __kmp_reg_status_get
void __kmp_register_library_startup(void) {
Index: openmp/runtime/src/kmp.h
===================================================================
--- openmp/runtime/src/kmp.h
+++ openmp/runtime/src/kmp.h
@@ -3132,6 +3132,7 @@
extern int __kmp_register_root(int initial_thread);
extern void __kmp_unregister_root(int gtid);
+extern void __kmp_unregister_library(void); // called by __kmp_internal_end()
extern int __kmp_ignore_mppbeg(void);
extern int __kmp_ignore_mppend(void);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91869.306694.patch
Type: text/x-patch
Size: 2059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201120/8213d5be/attachment.bin>
More information about the Openmp-commits
mailing list