[Openmp-commits] [PATCH] D16714: [OMPT] Fix wrong parent_task_id in serialized parallel_begin with GCC

Jonas Hahnfeld via Openmp-commits openmp-commits at lists.llvm.org
Fri Jan 29 00:58:26 PST 2016


Hahnfeld created this revision.
Hahnfeld added reviewers: jlpeyton, jmellorcrummey.
Hahnfeld added subscribers: openmp-commits, tcramer.

Without this patch a simple `#pragma omp parallel num_threads(1)` leads to
```
ompt_event_parallel_begin: parent_task_id=3, [...], parallel_id=2, [...]
ompt_event_parallel_end: parallel_id=2, task_id=4, [...]
```

http://reviews.llvm.org/D16714

Files:
  runtime/src/kmp_gsupport.c

Index: runtime/src/kmp_gsupport.c
===================================================================
--- runtime/src/kmp_gsupport.c
+++ runtime/src/kmp_gsupport.c
@@ -384,12 +384,19 @@
 static void
 __kmp_GOMP_serialized_parallel(ident_t *loc, kmp_int32 gtid, void (*task)(void *))
 {
+#if OMPT_SUPPORT
+    // save task info prior to calling __kmp_serialized_parallel
+    ompt_task_info_t *task_info;
+    if (ompt_enabled) {
+        task_info = __ompt_get_taskinfo(0);
+    }
+#endif
+
     __kmp_serialized_parallel(loc, gtid);
 
 #if OMPT_SUPPORT
     if (ompt_enabled) {
-        ompt_task_id_t ompt_task_id = __ompt_get_task_id_internal(0);
-        ompt_frame_t  *ompt_frame = __ompt_get_task_frame_internal(0);
+        ompt_frame_t *ompt_frame = &task_info->frame;
         kmp_info_t *thr = __kmp_threads[gtid];
 
         ompt_parallel_id_t ompt_parallel_id = __ompt_parallel_id_new(gtid);
@@ -401,7 +408,7 @@
         if (ompt_callbacks.ompt_callback(ompt_event_parallel_begin)) {
             int team_size = 1;
             ompt_callbacks.ompt_callback(ompt_event_parallel_begin)(
-                ompt_task_id, ompt_frame, ompt_parallel_id,
+                task_info->task_id, ompt_frame, ompt_parallel_id,
                 team_size, (void *) task,
                 OMPT_INVOKER(fork_context_gnu));
         }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16714.46362.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160129/bd4fc469/attachment.bin>


More information about the Openmp-commits mailing list