[Openmp-commits] [PATCH] D13502: Reduce overhead of OMPT

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Fri Oct 9 10:44:55 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL249857: [OMPT] Reduce overhead of OMPT (authored by jlpeyton).

Changed prior to commit:
  http://reviews.llvm.org/D13502?vs=36719&id=36964#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13502

Files:
  openmp/trunk/runtime/src/kmp_csupport.c
  openmp/trunk/runtime/src/kmp_sched.cpp
  openmp/trunk/runtime/src/ompt-specific.c

Index: openmp/trunk/runtime/src/ompt-specific.c
===================================================================
--- openmp/trunk/runtime/src/ompt-specific.c
+++ openmp/trunk/runtime/src/ompt-specific.c
@@ -50,6 +50,8 @@
 
     if (thr) {
         kmp_team *team = thr->th.th_team;
+        if (team == NULL) return NULL;
+
         ompt_lw_taskteam_t *lwt = LWT_FROM_TEAM(team);
 
         while(depth > 0) {
Index: openmp/trunk/runtime/src/kmp_sched.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_sched.cpp
+++ openmp/trunk/runtime/src/kmp_sched.cpp
@@ -97,8 +97,14 @@
     register kmp_info_t *th = __kmp_threads[ gtid ];
 
 #if OMPT_SUPPORT && OMPT_TRACE
-    ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
-    ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
+    ompt_team_info_t *team_info = NULL; 
+    ompt_task_info_t *task_info = NULL; 
+
+    if (ompt_enabled) {
+        // Only fully initialize variables needed by OMPT if OMPT is enabled.
+        team_info = __ompt_get_teaminfo(0, NULL);
+        task_info = __ompt_get_taskinfo(0);
+    }
 #endif
 
     KMP_DEBUG_ASSERT( plastiter && plower && pupper && pstride );
Index: openmp/trunk/runtime/src/kmp_csupport.c
===================================================================
--- openmp/trunk/runtime/src/kmp_csupport.c
+++ openmp/trunk/runtime/src/kmp_csupport.c
@@ -1485,12 +1485,12 @@
     KE_TRACE( 10, ("__kmpc_for_static_fini called T#%d\n", global_tid));
 
 #if OMPT_SUPPORT && OMPT_TRACE
-    kmp_info_t *this_thr        = __kmp_threads[ global_tid ];
-    kmp_team_t *team            = this_thr -> th.th_team;
-    int tid = __kmp_tid_from_gtid( global_tid );
-
     if (ompt_enabled &&
         ompt_callbacks.ompt_callback(ompt_event_loop_end)) {
+        kmp_info_t *this_thr = __kmp_threads[ global_tid ];
+        kmp_team_t *team     = this_thr -> th.th_team;
+        int tid = __kmp_tid_from_gtid( global_tid );
+
         ompt_callbacks.ompt_callback(ompt_event_loop_end)(
             team->t.ompt_team_info.parallel_id,
             team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13502.36964.patch
Type: text/x-patch
Size: 2169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20151009/9bfb3651/attachment.bin>


More information about the Openmp-commits mailing list