Index: openmp/trunk/runtime/src/include/30/ompt.h.var =================================================================== --- openmp/trunk/runtime/src/include/30/ompt.h.var +++ openmp/trunk/runtime/src/include/30/ompt.h.var @@ -121,7 +121,7 @@ macro (ompt_event_initial_task_begin, ompt_parallel_callback_t, 24) /* initial task begin */ \ macro (ompt_event_initial_task_end, ompt_parallel_callback_t, 25) /* initial task end */ \ \ - macro (ompt_event_task_switch, ompt_task_switch_callback_t, 26) /* task switch */ \ + macro (ompt_event_task_switch, ompt_task_pair_callback_t, 26) /* task switch */ \ \ macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \ macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \ @@ -313,9 +313,9 @@ ompt_task_id_t task_id /* id of task */ ); -typedef void (*ompt_task_switch_callback_t) ( - ompt_task_id_t suspended_task_id, /* tool data for suspended task */ - ompt_task_id_t resumed_task_id /* tool data for resumed task */ +typedef void (*ompt_task_pair_callback_t) ( + ompt_task_id_t first_task_id, + ompt_task_id_t second_task_id ); typedef void (*ompt_new_task_callback_t) ( Index: openmp/trunk/runtime/src/include/40/ompt.h.var =================================================================== --- openmp/trunk/runtime/src/include/40/ompt.h.var +++ openmp/trunk/runtime/src/include/40/ompt.h.var @@ -121,7 +121,7 @@ macro (ompt_event_initial_task_begin, ompt_parallel_callback_t, 24) /* initial task begin */ \ macro (ompt_event_initial_task_end, ompt_parallel_callback_t, 25) /* initial task end */ \ \ - macro (ompt_event_task_switch, ompt_task_switch_callback_t, 26) /* task switch */ \ + macro (ompt_event_task_switch, ompt_task_pair_callback_t, 26) /* task switch */ \ \ macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \ macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \ @@ -313,9 +313,9 @@ ompt_task_id_t task_id /* id of task */ ); -typedef void (*ompt_task_switch_callback_t) ( - ompt_task_id_t suspended_task_id, /* tool data for suspended task */ - ompt_task_id_t resumed_task_id /* tool data for resumed task */ +typedef void (*ompt_task_pair_callback_t) ( + ompt_task_id_t first_task_id, + ompt_task_id_t second_task_id ); typedef void (*ompt_new_task_callback_t) ( Index: openmp/trunk/runtime/src/include/41/ompt.h.var =================================================================== --- openmp/trunk/runtime/src/include/41/ompt.h.var +++ openmp/trunk/runtime/src/include/41/ompt.h.var @@ -121,7 +121,7 @@ macro (ompt_event_initial_task_begin, ompt_parallel_callback_t, 24) /* initial task begin */ \ macro (ompt_event_initial_task_end, ompt_parallel_callback_t, 25) /* initial task end */ \ \ - macro (ompt_event_task_switch, ompt_task_switch_callback_t, 26) /* task switch */ \ + macro (ompt_event_task_switch, ompt_task_pair_callback_t, 26) /* task switch */ \ \ macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \ macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \ @@ -313,9 +313,9 @@ ompt_task_id_t task_id /* id of task */ ); -typedef void (*ompt_task_switch_callback_t) ( - ompt_task_id_t suspended_task_id, /* tool data for suspended task */ - ompt_task_id_t resumed_task_id /* tool data for resumed task */ +typedef void (*ompt_task_pair_callback_t) ( + ompt_task_id_t first_task_id, + ompt_task_id_t second_task_id ); typedef void (*ompt_new_task_callback_t) ( Index: openmp/trunk/runtime/src/kmp_tasking.c =================================================================== --- openmp/trunk/runtime/src/kmp_tasking.c +++ openmp/trunk/runtime/src/kmp_tasking.c @@ -1148,6 +1148,18 @@ KMP_COUNT_BLOCK(TASK_executed); KMP_TIME_BLOCK (TASK_execution); #endif // OMP_40_ENABLED + +#if OMPT_SUPPORT && OMPT_TRACE + /* let OMPT know that we're about to run this task */ + if (ompt_enabled && + ompt_callbacks.ompt_callback(ompt_event_task_switch)) + { + ompt_callbacks.ompt_callback(ompt_event_task_switch)( + current_task->ompt_task_info.task_id, + taskdata->ompt_task_info.task_id); + } +#endif + #ifdef KMP_GOMP_COMPAT if (taskdata->td_flags.native) { ((void (*)(void *))(*(task->routine)))(task->shareds); @@ -1157,6 +1169,18 @@ { (*(task->routine))(gtid, task); } + +#if OMPT_SUPPORT && OMPT_TRACE + /* let OMPT know that we're returning to the callee task */ + if (ompt_enabled && + ompt_callbacks.ompt_callback(ompt_event_task_switch)) + { + ompt_callbacks.ompt_callback(ompt_event_task_switch)( + taskdata->ompt_task_info.task_id, + current_task->ompt_task_info.task_id); + } +#endif + #if OMP_40_ENABLED } #endif // OMP_40_ENABLED Index: openmp/trunk/runtime/src/ompt-event-specific.h =================================================================== --- openmp/trunk/runtime/src/ompt-event-specific.h +++ openmp/trunk/runtime/src/ompt-event-specific.h @@ -91,7 +91,7 @@ #define ompt_event_initial_task_begin_implemented ompt_event_UNIMPLEMENTED #define ompt_event_initial_task_end_implemented ompt_event_UNIMPLEMENTED -#define ompt_event_task_switch_implemented ompt_event_UNIMPLEMENTED +#define ompt_event_task_switch_implemented ompt_event_MAY_ALWAYS_TRACE #define ompt_event_loop_begin_implemented ompt_event_MAY_ALWAYS_TRACE #define ompt_event_loop_end_implemented ompt_event_MAY_ALWAYS_TRACE