[OMPT] Fix tool initialization returning 0

If tool initialization returns 0, OMPT should not be active. The current
implementation provided some callback invocations in this case.

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

llvm-svn: 324320
This commit is contained in:
Joachim Protze 2018-02-06 08:41:27 +00:00
parent 333be329c4
commit 2a20299f91
1 changed files with 6 additions and 0 deletions

View File

@ -332,6 +332,12 @@ void ompt_post_init() {
ompt_enabled.enabled = !!ompt_start_tool_result->initialize(
ompt_fn_lookup, &(ompt_start_tool_result->tool_data));
if (!ompt_enabled.enabled) {
// tool not enabled, zero out the bitmap, and done
memset(&ompt_enabled, 0, sizeof(ompt_enabled));
return;
}
ompt_thread_t *root_thread = ompt_get_thread();
ompt_set_thread_state(root_thread, omp_state_overhead);