Skip to content

Commit

Permalink
[OpenMP] Shutdown library on Windows if possible for better OMPT beha…
Browse files Browse the repository at this point in the history
…vior

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

llvm-svn: 343619
  • Loading branch information
jpeyton52 committed Oct 2, 2018
1 parent 3ca4701 commit 8bb8a92
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions openmp/runtime/src/kmp_csupport.cpp
Expand Up @@ -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
}

/*!
Expand Down

0 comments on commit 8bb8a92

Please sign in to comment.