[Openmp-commits] [PATCH] D52628: Shutdown library on Windows if possible for better OMPT behavior.

Hansang Bae via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Sep 27 13:10:41 PDT 2018

hbae created this revision.
hbae added reviewers: AndreyChurbanov, tlwilmar, jlpeyton.
hbae added a project: OpenMP.

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.

  rOMP OpenMP



Index: runtime/src/kmp_csupport.cpp
--- runtime/src/kmp_csupport.cpp
+++ runtime/src/kmp_csupport.cpp
@@ -71,6 +71,14 @@
+  // 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());

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52628.167384.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180927/13f18597/attachment.bin>

More information about the Openmp-commits mailing list