diff options
Diffstat (limited to 'openmp/runtime/src/ompt-specific.cpp')
| -rw-r--r-- | openmp/runtime/src/ompt-specific.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/openmp/runtime/src/ompt-specific.cpp b/openmp/runtime/src/ompt-specific.cpp index ad6580805f4..23d09aa85e8 100644 --- a/openmp/runtime/src/ompt-specific.cpp +++ b/openmp/runtime/src/ompt-specific.cpp @@ -341,18 +341,23 @@ int __ompt_get_task_info_internal(int ancestor_level, int *type, ompt_task_info_t *info = NULL; ompt_team_info_t *team_info = NULL; kmp_info_t *thr = ompt_get_thread(); + int level = ancestor_level; if (thr) { kmp_taskdata_t *taskdata = thr->th.th_current_task; if (taskdata == NULL) return 0; - kmp_team *team = thr->th.th_team; + kmp_team *team = thr->th.th_team, *prev_team = NULL; if (team == NULL) return 0; ompt_lw_taskteam_t *lwt = NULL, - *next_lwt = LWT_FROM_TEAM(taskdata->td_team); + *next_lwt = LWT_FROM_TEAM(taskdata->td_team), + *prev_lwt = NULL; while (ancestor_level > 0) { + // needed for thread_num + prev_team = team; + prev_lwt = lwt; // next lightweight team (if any) if (lwt) lwt = lwt->parent; @@ -410,7 +415,13 @@ int __ompt_get_task_info_internal(int ancestor_level, int *type, *parallel_data = team_info ? &(team_info->parallel_data) : NULL; } if (thread_num) { - *thread_num = __kmp_get_gtid(); + if (level == 0) + *thread_num = __kmp_get_tid(); + else if (prev_lwt) + *thread_num = 0; + else + *thread_num = prev_team->t.t_master_tid; + // *thread_num = team->t.t_master_tid; } return info ? 2 : 0; } |

