[Openmp-commits] [PATCH] D47717: [OMPT] Make sure that OMPT is enabled in runtime entry points that access internals of the runtime

Jonas Hahnfeld via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Jun 6 05:12:16 PDT 2018


Hahnfeld added inline comments.


================
Comment at: runtime/src/ompt-general.cpp:458
           (ompt_callback_t)ompt_callbacks.ompt_callback(event_name);           \
-      if (mycb) {                                                              \
+      if (ompt_enabled.enabled && ompt_enabled.event_name && mycb) {           \
         *callback = mycb;                                                      \
----------------
sconvent wrote:
> Hahnfeld wrote:
> > Should we put an `if (ompt_enabled.enabled) return ompt_get_callback_failure` at the very beginning of the function? That seems invariant to the switch-case...
> You meant `if (!ompt_enabled.enabled) `right?
Sure :D


================
Comment at: runtime/src/ompt-specific.cpp:235
                                       int *team_size) {
-  if (__kmp_get_gtid() >= 0) {
+  if (ompt_enabled.enabled && __kmp_get_gtid() >= 0) {
     ompt_team_info_t *info;
----------------
I think you do the same for the other functions in this file as well.


================
Comment at: runtime/src/ompt-specific.cpp:334
                                   int *thread_num) {
-  if (__kmp_get_gtid() < 0)
+  if (!ompt_enabled.enabled || __kmp_get_gtid() < 0)
     return 0;
----------------
Same here


https://reviews.llvm.org/D47717





More information about the Openmp-commits mailing list