[Openmp-commits] [openmp] r343619 - [OpenMP] Shutdown library on Windows if possible for better OMPT behavior

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Tue Oct 2 12:15:04 PDT 2018


Author: jlpeyton
Date: Tue Oct  2 12:15:04 2018
New Revision: 343619

URL: http://llvm.org/viewvc/llvm-project?rev=343619&view=rev
Log:
[OpenMP] Shutdown library on Windows if possible for better OMPT behavior

On Windows, child workers are terminated by the parent during the normal
program exit process (ExitProcess()) and they are not able to finish generating
their OpenMP events. We can force manual library shut down in __kmpc_end() to
fix this at least for the cases where __kmpc_end() is properly inserted.

Patch by Hansang Bae

Differential Revision: https://reviews.llvm.org/D52628

Modified:
    openmp/trunk/runtime/src/kmp_csupport.cpp

Modified: openmp/trunk/runtime/src/kmp_csupport.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_csupport.cpp?rev=343619&r1=343618&r2=343619&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_csupport.cpp (original)
+++ openmp/trunk/runtime/src/kmp_csupport.cpp Tue Oct  2 12:15:04 2018
@@ -71,6 +71,14 @@ void __kmpc_end(ident_t *loc) {
 
     __kmp_internal_end_thread(-1);
   }
+#if KMP_OS_WINDOWS && OMPT_SUPPORT
+  // Normal exit process on Windows does not allow worker threads of the final
+  // parallel region to finish reporting their events, so shutting down the
+  // library here fixes the issue at least for the cases where __kmpc_end() is
+  // placed properly.
+  if (ompt_enabled.enabled)
+    __kmp_internal_end_library(__kmp_gtid_get_specific());
+#endif
 }
 
 /*!




More information about the Openmp-commits mailing list