[Openmp-commits] [openmp] r324320 - [OMPT] Fix tool initialization returning 0

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 6 00:41:28 PST 2018


Author: jprotze
Date: Tue Feb  6 00:41:27 2018
New Revision: 324320

URL: http://llvm.org/viewvc/llvm-project?rev=324320&view=rev
Log:
[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

Modified:
    openmp/trunk/runtime/src/ompt-general.cpp

Modified: openmp/trunk/runtime/src/ompt-general.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/ompt-general.cpp?rev=324320&r1=324319&r2=324320&view=diff
==============================================================================
--- openmp/trunk/runtime/src/ompt-general.cpp (original)
+++ openmp/trunk/runtime/src/ompt-general.cpp Tue Feb  6 00:41:27 2018
@@ -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);




More information about the Openmp-commits mailing list