Index: runtime/src/exports_so.txt =================================================================== --- runtime/src/exports_so.txt +++ runtime/src/exports_so.txt @@ -23,6 +23,16 @@ omp_*; # Standard OpenMP functions. ompt_initialize; # OMPT initialization interface ompt_control; # OMPT control interface + + # + # OMPT state placeholders + # + omp_idle; + omp_overhead; + omp_barrier_wait; + omp_task_wait; + omp_mutex_wait; + ompc_*; # omp.h renames some standard functions to ompc_*. kmp_*; # Intel extensions. kmpc_*; # Intel extensions. Index: runtime/src/kmp_csupport.c =================================================================== --- runtime/src/kmp_csupport.c +++ runtime/src/kmp_csupport.c @@ -701,10 +701,11 @@ #if OMPT_SUPPORT && OMPT_TRACE if (status) { - kmp_info_t *this_thr = __kmp_threads[ global_tid ]; - kmp_team_t *team = this_thr -> th.th_team; if ((ompt_status == ompt_status_track_callback) && ompt_callbacks.ompt_callback(ompt_event_master_begin)) { + 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_master_begin)( team->t.ompt_team_info.parallel_id, Index: runtime/src/kmp_gsupport.c =================================================================== --- runtime/src/kmp_gsupport.c +++ runtime/src/kmp_gsupport.c @@ -349,11 +349,6 @@ va_list ap; va_start(ap, argc); -#if OMPT_SUPPORT - team->t.t_implicit_task_taskdata[tid]. - ompt_task_info.frame.reenter_runtime_frame = NULL; -#endif - rc = __kmp_fork_call(loc, gtid, fork_context_gnu, argc, #if OMPT_SUPPORT VOLATILE_CAST(void *) unwrapped_task, @@ -372,8 +367,9 @@ __kmp_run_before_invoked_task(gtid, tid, thr, team); } -#if OMPT_SUPPORT && OMPT_TRACE +#if OMPT_SUPPORT if (ompt_status & ompt_status_track) { +#if OMPT_TRACE ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL); ompt_task_info_t *task_info = __ompt_get_taskinfo(0); @@ -383,6 +379,7 @@ ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)( team_info->parallel_id, task_info->task_id); } +#endif thr->th.ompt_thread_info.state = ompt_state_work_parallel; } #endif Index: runtime/src/ompt-general.c =================================================================== --- runtime/src/ompt-general.c +++ runtime/src/ompt-general.c @@ -299,49 +299,62 @@ * placeholders ****************************************************************************/ +// Don't define this as static. The loader may choose to eliminate the symbol +// even though it is needed by tools. +#define OMPT_API_PLACEHOLDER -OMPT_API_ROUTINE void omp_idle(void) +// Ensure that placeholders don't have mangled names in the symbol table. +#ifdef __cplusplus +extern "C" { +#endif + + +OMPT_API_PLACEHOLDER void omp_idle(void) { - // this function is a placeholder used to represent the calling context of + // This function is a placeholder used to represent the calling context of // idle OpenMP worker threads. It is not meant to be invoked. assert(0); } -OMPT_API_ROUTINE void omp_overhead(void) +OMPT_API_PLACEHOLDER void omp_overhead(void) { - // this function is a placeholder used to represent the OpenMP context of + // This function is a placeholder used to represent the OpenMP context of // threads working in the OpenMP runtime. It is not meant to be invoked. assert(0); } -OMPT_API_ROUTINE void omp_barrier_wait(void) +OMPT_API_PLACEHOLDER void omp_barrier_wait(void) { - // this function is a placeholder used to represent the OpenMP context of + // This function is a placeholder used to represent the OpenMP context of // threads waiting for a barrier in the OpenMP runtime. It is not meant // to be invoked. assert(0); } -OMPT_API_ROUTINE void omp_task_wait(void) +OMPT_API_PLACEHOLDER void omp_task_wait(void) { - // this function is a placeholder used to represent the OpenMP context of + // This function is a placeholder used to represent the OpenMP context of // threads waiting for a task in the OpenMP runtime. It is not meant // to be invoked. assert(0); } -OMPT_API_ROUTINE void omp_mutex_wait(void) +OMPT_API_PLACEHOLDER void omp_mutex_wait(void) { - // this function is a placeholder used to represent the OpenMP context of + // This function is a placeholder used to represent the OpenMP context of // threads waiting for a mutex in the OpenMP runtime. It is not meant // to be invoked. assert(0); } +#ifdef __cplusplus +}; +#endif + /***************************************************************************** * compatability Index: runtime/src/z_Linux_util.c =================================================================== --- runtime/src/z_Linux_util.c +++ runtime/src/z_Linux_util.c @@ -2619,7 +2619,11 @@ #if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64) int __kmp_invoke_microtask( microtask_t pkfn, int gtid, int tid, int argc, - void *p_argv[] ) + void *p_argv[] +#if OMPT_SUPPORT + , void **exit_frame_ptr +#endif +) { int argc_full = argc + 2; int i; @@ -2628,6 +2632,9 @@ void *args[argc_full]; void *idp[2]; +#if OMPT_SUPPORT + *exit_frame_ptr = __builtin_frame_address(0); +#endif /* We're only passing pointers to the target. */ for (i = 0; i < argc_full; i++) types[i] = &ffi_type_pointer; @@ -2647,6 +2654,10 @@ ffi_call(&cif, (void (*)(void))pkfn, NULL, args); +#if OMPT_SUPPORT + *exit_frame_ptr = 0; +#endif + return 1; } @@ -2659,7 +2670,16 @@ int __kmp_invoke_microtask( microtask_t pkfn, int gtid, int tid, - int argc, void *p_argv[] ) { + int argc, void *p_argv[] +#if OMPT_SUPPORT + , void **exit_frame_ptr +#endif +) +{ +#if OMPT_SUPPORT + *exit_frame_ptr = __builtin_frame_address(0); +#endif + switch (argc) { default: fprintf(stderr, "Too many args to microtask: %d!\n", argc); @@ -2729,6 +2749,10 @@ break; } +#if OMPT_SUPPORT + *exit_frame_ptr = 0; +#endif + return 1; }