Index: runtime/src/kmp_atomic.h =================================================================== --- runtime/src/kmp_atomic.h +++ runtime/src/kmp_atomic.h @@ -371,7 +371,7 @@ __kmp_acquire_atomic_lock( kmp_atomic_lock_t *lck, kmp_int32 gtid ) { #if OMPT_SUPPORT && OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_wait_atomic)) { ompt_callbacks.ompt_callback(ompt_event_wait_atomic)( (ompt_wait_id_t) lck); @@ -381,7 +381,7 @@ __kmp_acquire_queuing_lock( lck, gtid ); #if OMPT_SUPPORT && OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_acquired_atomic)) { ompt_callbacks.ompt_callback(ompt_event_acquired_atomic)( (ompt_wait_id_t) lck); @@ -400,7 +400,7 @@ { __kmp_release_queuing_lock( lck, gtid ); #if OMPT_SUPPORT && OMPT_BLAME - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_release_atomic)) { ompt_callbacks.ompt_callback(ompt_event_release_atomic)( (ompt_wait_id_t) lck); Index: runtime/src/kmp_barrier.cpp =================================================================== --- runtime/src/kmp_barrier.cpp +++ runtime/src/kmp_barrier.cpp @@ -1053,25 +1053,23 @@ gtid, __kmp_team_from_gtid(gtid)->t.t_id, __kmp_tid_from_gtid(gtid))); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { #if OMPT_BLAME - if (ompt_status == ompt_status_track_callback) { - my_task_id = team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id; - my_parallel_id = team->t.ompt_team_info.parallel_id; + my_task_id = team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id; + my_parallel_id = team->t.ompt_team_info.parallel_id; #if OMPT_TRACE - if (this_thr->th.ompt_thread_info.state == ompt_state_wait_single) { - if (ompt_callbacks.ompt_callback(ompt_event_single_others_end)) { - ompt_callbacks.ompt_callback(ompt_event_single_others_end)( - my_parallel_id, my_task_id); - } - } -#endif - if (ompt_callbacks.ompt_callback(ompt_event_barrier_begin)) { - ompt_callbacks.ompt_callback(ompt_event_barrier_begin)( + if (this_thr->th.ompt_thread_info.state == ompt_state_wait_single) { + if (ompt_callbacks.ompt_callback(ompt_event_single_others_end)) { + ompt_callbacks.ompt_callback(ompt_event_single_others_end)( my_parallel_id, my_task_id); } - } + } +#endif + if (ompt_callbacks.ompt_callback(ompt_event_barrier_begin)) { + ompt_callbacks.ompt_callback(ompt_event_barrier_begin)( + my_parallel_id, my_task_id); + } #endif // It is OK to report the barrier state after the barrier begin callback. // According to the OMPT specification, a compliant implementation may @@ -1276,10 +1274,9 @@ gtid, __kmp_team_from_gtid(gtid)->t.t_id, __kmp_tid_from_gtid(gtid), status)); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { #if OMPT_BLAME - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_barrier_end)) { + if (ompt_callbacks.ompt_callback(ompt_event_barrier_end)) { ompt_callbacks.ompt_callback(ompt_event_barrier_end)( my_parallel_id, my_task_id); } @@ -1381,7 +1378,7 @@ #if OMPT_SUPPORT #if OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_barrier_begin)) { ompt_callbacks.ompt_callback(ompt_event_barrier_begin)( team->t.ompt_team_info.parallel_id, @@ -1513,14 +1510,13 @@ KA_TRACE(10, ("__kmp_join_barrier: T#%d(%d:%d) leaving\n", gtid, team_id, tid)); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { #if OMPT_BLAME - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_barrier_end)) { + if (ompt_callbacks.ompt_callback(ompt_event_barrier_end)) { ompt_callbacks.ompt_callback(ompt_event_barrier_end)( team->t.ompt_team_info.parallel_id, team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id); - } + } #endif // return to default state Index: runtime/src/kmp_csupport.c =================================================================== --- runtime/src/kmp_csupport.c +++ runtime/src/kmp_csupport.c @@ -304,7 +304,7 @@ int tid = __kmp_tid_from_gtid( gtid ); kmp_info_t *master_th = __kmp_threads[ gtid ]; kmp_team_t *parent_team = master_th->th.th_team; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { parent_team->t.t_implicit_task_taskdata[tid]. ompt_task_info.frame.reenter_runtime_frame = __builtin_frame_address(0); } @@ -339,7 +339,7 @@ va_end( ap ); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { parent_team->t.t_implicit_task_taskdata[tid]. ompt_task_info.frame.reenter_runtime_frame = 0; } @@ -398,7 +398,7 @@ #if OMPT_SUPPORT kmp_team_t *parent_team = this_thr->th.th_team; int tid = __kmp_tid_from_gtid( gtid ); - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { parent_team->t.t_implicit_task_taskdata[tid]. ompt_task_info.frame.reenter_runtime_frame = __builtin_frame_address(0); } @@ -432,7 +432,7 @@ ); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { parent_team->t.t_implicit_task_taskdata[tid]. ompt_task_info.frame.reenter_runtime_frame = NULL; } @@ -747,7 +747,7 @@ #if OMPT_SUPPORT && OMPT_TRACE if (status) { - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && 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; @@ -796,7 +796,7 @@ #if OMPT_SUPPORT && OMPT_TRACE 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) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_master_end)) { int tid = __kmp_tid_from_gtid( global_tid ); ompt_callbacks.ompt_callback(ompt_event_master_end)( @@ -841,14 +841,13 @@ th = __kmp_threads[ gtid ]; #if OMPT_SUPPORT && OMPT_TRACE - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { /* OMPT state update */ th->th.ompt_thread_info.wait_id = (uint64_t) loc; th->th.ompt_thread_info.state = ompt_state_wait_ordered; /* OMPT event callback */ - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_wait_ordered)) { + if (ompt_callbacks.ompt_callback(ompt_event_wait_ordered)) { ompt_callbacks.ompt_callback(ompt_event_wait_ordered)( th->th.ompt_thread_info.wait_id); } @@ -861,14 +860,13 @@ __kmp_parallel_deo( & gtid, & cid, loc ); #if OMPT_SUPPORT && OMPT_TRACE - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { /* OMPT state update */ th->th.ompt_thread_info.state = ompt_state_work_parallel; th->th.ompt_thread_info.wait_id = 0; /* OMPT event callback */ - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_acquired_ordered)) { + if (ompt_callbacks.ompt_callback(ompt_event_acquired_ordered)) { ompt_callbacks.ompt_callback(ompt_event_acquired_ordered)( th->th.ompt_thread_info.wait_id); } @@ -908,7 +906,7 @@ __kmp_parallel_dxo( & gtid, & cid, loc ); #if OMPT_SUPPORT && OMPT_BLAME - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_release_ordered)) { ompt_callbacks.ompt_callback(ompt_event_release_ordered)( th->th.ompt_thread_info.wait_id); @@ -1287,7 +1285,7 @@ __kmp_release_user_lock_with_checks( lck, global_tid ); #if OMPT_SUPPORT && OMPT_BLAME - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_release_critical)) { ompt_callbacks.ompt_callback(ompt_event_release_critical)( (uint64_t) lck); @@ -1423,7 +1421,7 @@ kmp_team_t *team = this_thr -> th.th_team; int tid = __kmp_tid_from_gtid( global_tid ); - if ((ompt_status == ompt_status_track_callback)) { + if (ompt_enabled) { if (rc) { if (ompt_callbacks.ompt_callback(ompt_event_single_in_block_begin)) { ompt_callbacks.ompt_callback(ompt_event_single_in_block_begin)( @@ -1465,7 +1463,7 @@ kmp_team_t *team = this_thr -> th.th_team; int tid = __kmp_tid_from_gtid( global_tid ); - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_single_in_block_end)) { ompt_callbacks.ompt_callback(ompt_event_single_in_block_end)( team->t.ompt_team_info.parallel_id, @@ -1491,7 +1489,7 @@ kmp_team_t *team = this_thr -> th.th_team; int tid = __kmp_tid_from_gtid( global_tid ); - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_loop_end)) { ompt_callbacks.ompt_callback(ompt_event_loop_end)( team->t.ompt_team_info.parallel_id, @@ -2141,7 +2139,7 @@ RELEASE_LOCK( lck, gtid ); #if OMPT_SUPPORT && OMPT_BLAME - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_release_lock)) { ompt_callbacks.ompt_callback(ompt_event_release_lock)((uint64_t) lck); } @@ -2202,7 +2200,7 @@ int release_status; release_status = RELEASE_NESTED_LOCK( lck, gtid ); #if OMPT_SUPPORT && OMPT_BLAME - if (ompt_status == ompt_status_track_callback) { + if (ompt_enabled) { if (release_status == KMP_LOCK_RELEASED) { if (ompt_callbacks.ompt_callback(ompt_event_release_nest_lock_last)) { ompt_callbacks.ompt_callback(ompt_event_release_nest_lock_last)( Index: runtime/src/kmp_dispatch.cpp =================================================================== --- runtime/src/kmp_dispatch.cpp +++ runtime/src/kmp_dispatch.cpp @@ -1209,7 +1209,7 @@ #endif // ( KMP_STATIC_STEAL_ENABLED && USE_STEALING ) #if OMPT_SUPPORT && OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_loop_begin)) { ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL); ompt_task_info_t *task_info = __ompt_get_taskinfo(0); @@ -1373,7 +1373,7 @@ #if OMPT_SUPPORT && OMPT_TRACE #define OMPT_LOOP_END \ if (status == 0) { \ - if ((ompt_status == ompt_status_track_callback) && \ + if (ompt_enabled && \ ompt_callbacks.ompt_callback(ompt_event_loop_end)) { \ ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL); \ ompt_task_info_t *task_info = __ompt_get_taskinfo(0); \ Index: runtime/src/kmp_gsupport.c =================================================================== --- runtime/src/kmp_gsupport.c +++ runtime/src/kmp_gsupport.c @@ -259,7 +259,7 @@ ompt_frame_t *ompt_frame; ompt_state_t enclosing_state; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { // get pointer to thread data structure thr = __kmp_threads[*gtid]; @@ -276,7 +276,7 @@ task(data); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { // clear task frame ompt_frame->exit_runtime_frame = NULL; @@ -306,7 +306,7 @@ ompt_frame_t *ompt_frame; ompt_state_t enclosing_state; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { thr = __kmp_threads[*gtid]; // save enclosing task state; set current state for task enclosing_state = thr->th.ompt_thread_info.state; @@ -324,7 +324,7 @@ task(data); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { // clear task frame ompt_frame->exit_runtime_frame = NULL; @@ -368,14 +368,13 @@ } #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { #if OMPT_TRACE ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL); ompt_task_info_t *task_info = __ompt_get_taskinfo(0); // implicit task callback - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { + if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)( team_info->parallel_id, task_info->task_id); } @@ -391,7 +390,7 @@ __kmp_serialized_parallel(loc, gtid); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + 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); kmp_info_t *thr = __kmp_threads[gtid]; @@ -402,8 +401,7 @@ ompt_frame->exit_runtime_frame = NULL; // parallel region callback - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_parallel_begin)) { + 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, @@ -421,8 +419,7 @@ #if OMPT_TRACE // implicit task callback - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { + if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)( ompt_parallel_id, my_ompt_task_id); } @@ -441,7 +438,7 @@ #if OMPT_SUPPORT ompt_frame_t *parent_frame; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { parent_frame = __ompt_get_task_frame_internal(0); parent_frame->reenter_runtime_frame = __builtin_frame_address(0); } @@ -462,7 +459,7 @@ } #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { parent_frame->reenter_runtime_frame = NULL; } #endif @@ -485,7 +482,7 @@ ompt_parallel_id_t parallel_id; ompt_frame_t *ompt_frame = NULL; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL); parallel_id = team_info->parallel_id; @@ -495,7 +492,7 @@ ompt_frame->reenter_runtime_frame = __builtin_frame_address(0); #if OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) { ompt_task_info_t *task_info = __ompt_get_taskinfo(0); ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)( @@ -510,7 +507,7 @@ __kmp_free(lwt); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { // Since a lightweight task was destroyed, make sure that the // remaining deepest task knows the stack frame where the runtime // was reentered. @@ -527,7 +524,7 @@ thr->th.th_team); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { // Set reenter frame in parent task, which will become current task // in the midst of join. This is needed before the end_parallel callback. ompt_frame = __ompt_get_task_frame_internal(1); @@ -541,7 +538,7 @@ #endif ); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { ompt_frame->reenter_runtime_frame = NULL; } #endif @@ -550,13 +547,12 @@ __kmpc_end_serialized_parallel(&loc, gtid); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { // Record that we re-entered the runtime system in the frame that // created the parallel region. ompt_frame->reenter_runtime_frame = __builtin_frame_address(0); - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_parallel_end)) { + if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) { ompt_task_info_t *task_info = __ompt_get_taskinfo(0); ompt_callbacks.ompt_callback(ompt_event_parallel_end)( parallel_id, task_info->task_id, @@ -895,14 +891,14 @@ #define OMPT_LOOP_PRE() \ ompt_frame_t *parent_frame; \ - if (ompt_status & ompt_status_track) { \ + if (ompt_enabled) { \ parent_frame = __ompt_get_task_frame_internal(0); \ parent_frame->reenter_runtime_frame = __builtin_frame_address(0); \ } #define OMPT_LOOP_POST() \ - if (ompt_status & ompt_status_track) { \ + if (ompt_enabled) { \ parent_frame->reenter_runtime_frame = NULL; \ } @@ -978,7 +974,7 @@ ompt_thread_info_t oldInfo; kmp_info_t *thread; kmp_taskdata_t *taskdata; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { // Store the threads states and restore them after the task thread = __kmp_threads[ gtid ]; taskdata = KMP_TASK_TO_TASKDATA(task); @@ -995,7 +991,7 @@ __kmpc_omp_task_complete_if0(&loc, gtid, task); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { thread->th.ompt_thread_info = oldInfo; taskdata->ompt_task_info.frame.exit_runtime_frame = 0; } @@ -1094,7 +1090,7 @@ #if OMPT_SUPPORT ompt_frame_t *parent_frame; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { parent_frame = __ompt_get_task_frame_internal(0); parent_frame->reenter_runtime_frame = __builtin_frame_address(0); } @@ -1117,7 +1113,7 @@ } #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { parent_frame->reenter_runtime_frame = NULL; } #endif Index: runtime/src/kmp_lock.cpp =================================================================== --- runtime/src/kmp_lock.cpp +++ runtime/src/kmp_lock.cpp @@ -1315,8 +1315,7 @@ #endif #if OMPT_SUPPORT - if ((ompt_status & ompt_status_track) && - prev_state != ompt_state_undefined) { + if (ompt_enabled && prev_state != ompt_state_undefined) { /* change the state before clearing wait_id */ this_thr->th.ompt_thread_info.state = prev_state; this_thr->th.ompt_thread_info.wait_id = 0; @@ -1332,8 +1331,7 @@ } #if OMPT_SUPPORT - if ((ompt_status & ompt_status_track) && - prev_state == ompt_state_undefined) { + if (ompt_enabled && prev_state == ompt_state_undefined) { /* this thread will spin; set wait_id before entering wait state */ prev_state = this_thr->th.ompt_thread_info.state; this_thr->th.ompt_thread_info.wait_id = (uint64_t) lck; Index: runtime/src/kmp_runtime.c =================================================================== --- runtime/src/kmp_runtime.c +++ runtime/src/kmp_runtime.c @@ -765,7 +765,7 @@ team->t.t_ordered.dt.t_value = ((tid + 1) % team->t.t_nproc ); #if OMPT_SUPPORT && OMPT_BLAME - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_release_ordered)) { /* accept blame for "ordered" waiting */ kmp_info_t *this_thread = __kmp_threads[gtid]; @@ -1511,7 +1511,7 @@ ompt_task_id_t my_task_id; ompt_parallel_id_t my_parallel_id; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { ompt_parallel_id = __ompt_parallel_id_new(gtid); ompt_task_id = __ompt_get_task_id_internal(0); ompt_frame = __ompt_get_task_frame_internal(0); @@ -1535,7 +1535,7 @@ #endif #if OMPT_SUPPORT - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_parallel_begin)) { int team_size = master_set_numthreads; @@ -1577,7 +1577,7 @@ ompt_lw_taskteam_t lw_taskteam; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { __ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid, unwrapped_task, ompt_parallel_id); lw_taskteam.ompt_task_info.task_id = __ompt_task_id_new(gtid); @@ -1589,8 +1589,7 @@ /* OMPT implicit task begin */ my_task_id = lw_taskteam.ompt_task_info.task_id; my_parallel_id = parent_team->t.ompt_team_info.parallel_id; - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { + if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)( my_parallel_id, my_task_id); } @@ -1613,12 +1612,11 @@ } #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { #if OMPT_TRACE lw_taskteam.ompt_task_info.frame.exit_runtime_frame = 0; - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) { + if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)( ompt_parallel_id, ompt_task_id); } @@ -1628,8 +1626,7 @@ lw_taskteam.ompt_task_info.task_id = ompt_task_id_none; #endif - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_parallel_end)) { + if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) { ompt_callbacks.ompt_callback(ompt_event_parallel_end)( ompt_parallel_id, ompt_task_id, OMPT_INVOKER(call_context)); @@ -1778,7 +1775,7 @@ ompt_lw_taskteam_t lw_taskteam; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { __ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid, unwrapped_task, ompt_parallel_id); lw_taskteam.ompt_task_info.task_id = __ompt_task_id_new(gtid); @@ -1788,8 +1785,7 @@ #if OMPT_TRACE my_task_id = lw_taskteam.ompt_task_info.task_id; - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { + if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)( ompt_parallel_id, my_task_id); } @@ -1812,12 +1808,11 @@ } #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { lw_taskteam.ompt_task_info.frame.exit_runtime_frame = 0; #if OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) { + if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)( ompt_parallel_id, ompt_task_id); } @@ -1827,8 +1822,7 @@ // reset clear the task id only after unlinking the task lw_taskteam.ompt_task_info.task_id = ompt_task_id_none; - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_parallel_end)) { + if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) { ompt_callbacks.ompt_callback(ompt_event_parallel_end)( ompt_parallel_id, ompt_task_id, OMPT_INVOKER(call_context)); @@ -1883,7 +1877,7 @@ ompt_lw_taskteam_t lw_taskteam; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { __ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid, unwrapped_task, ompt_parallel_id); lw_taskteam.ompt_task_info.task_id = __ompt_task_id_new(gtid); @@ -1895,8 +1889,7 @@ /* OMPT implicit task begin */ my_task_id = lw_taskteam.ompt_task_info.task_id; my_parallel_id = ompt_parallel_id; - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { + if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)( my_parallel_id, my_task_id); } @@ -1919,12 +1912,11 @@ } #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { #if OMPT_TRACE lw_taskteam.ompt_task_info.frame.exit_runtime_frame = 0; - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) { + if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)( my_parallel_id, my_task_id); } @@ -1934,8 +1926,7 @@ // reset clear the task id only after unlinking the task lw_taskteam.ompt_task_info.task_id = ompt_task_id_none; - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_parallel_end)) { + if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) { ompt_callbacks.ompt_callback(ompt_event_parallel_end)( ompt_parallel_id, ompt_task_id, OMPT_INVOKER(call_context)); @@ -2245,7 +2236,7 @@ KA_TRACE( 20, ("__kmp_fork_call: parallel exit T#%d\n", gtid )); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { master_th->th.ompt_thread_info.state = ompt_state_overhead; } #endif @@ -2310,7 +2301,7 @@ master_th->th.th_ident = loc; #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { master_th->th.ompt_thread_info.state = ompt_state_overhead; } #endif @@ -2344,7 +2335,7 @@ __kmpc_end_serialized_parallel( loc, gtid ); #if OMPT_SUPPORT - if (ompt_status == ompt_status_track_callback) { + if (ompt_enabled) { __kmp_join_restore_state(master_th, parent_team); } #endif @@ -2442,7 +2433,7 @@ } #if OMPT_SUPPORT - if (ompt_status == ompt_status_track_callback) { + if (ompt_enabled) { __kmp_join_ompt(master_th, parent_team, parallel_id, fork_context); } #endif @@ -2533,7 +2524,7 @@ __kmp_release_bootstrap_lock( &__kmp_forkjoin_lock ); #if OMPT_SUPPORT - if (ompt_status == ompt_status_track_callback) { + if (ompt_enabled) { __kmp_join_ompt(master_th, parent_team, parallel_id, fork_context); } #endif @@ -3938,7 +3929,7 @@ #endif /* KMP_OS_WINDOWS */ #if OMPT_SUPPORT - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_thread_end)) { int gtid = __kmp_get_gtid(); __ompt_thread_end(ompt_thread_initial, gtid); @@ -5538,12 +5529,11 @@ } #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { this_thr->th.ompt_thread_info.state = ompt_state_overhead; this_thr->th.ompt_thread_info.wait_id = 0; this_thr->th.ompt_thread_info.idle_frame = __builtin_frame_address(0); - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_thread_begin)) { + if (ompt_callbacks.ompt_callback(ompt_event_thread_begin)) { __ompt_thread_begin(ompt_thread_worker, gtid); } } @@ -5558,7 +5548,7 @@ KA_TRACE( 20, ("__kmp_launch_thread: T#%d waiting for work\n", gtid )); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { this_thr->th.ompt_thread_info.state = ompt_state_idle; } #endif @@ -5567,7 +5557,7 @@ __kmp_fork_barrier( gtid, KMP_GTID_DNE ); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { this_thr->th.ompt_thread_info.state = ompt_state_overhead; } #endif @@ -5585,7 +5575,7 @@ updateHWFPControl (*pteam); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { this_thr->th.ompt_thread_info.state = ompt_state_work_parallel; // Initialize OMPT task id for implicit task. int tid = __kmp_tid_from_gtid(gtid); @@ -5603,7 +5593,7 @@ KMP_ASSERT( rc ); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { /* no frame set while outside task */ int tid = __kmp_tid_from_gtid(gtid); (*pteam)->t.t_implicit_task_taskdata[tid].ompt_task_info.frame.exit_runtime_frame = 0; @@ -5622,7 +5612,7 @@ TCR_SYNC_PTR((intptr_t)__kmp_global.g.g_done); #if OMPT_SUPPORT - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_thread_end)) { __ompt_thread_end(ompt_thread_worker, gtid); } @@ -6921,7 +6911,7 @@ ompt_task_id_t my_task_id; ompt_parallel_id_t my_parallel_id; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { exit_runtime_p = &(team->t.t_implicit_task_taskdata[tid]. ompt_task_info.frame.exit_runtime_frame); } else { @@ -6931,7 +6921,7 @@ #if OMPT_TRACE my_task_id = team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id; my_parallel_id = team->t.ompt_team_info.parallel_id; - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)( my_parallel_id, my_task_id); @@ -6950,9 +6940,8 @@ } #if OMPT_SUPPORT && OMPT_TRACE - if (ompt_status & ompt_status_track) { - if ((ompt_status == ompt_status_track_callback) && - ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) { + if (ompt_enabled) { + if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) { ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)( my_parallel_id, my_task_id); } Index: runtime/src/kmp_sched.cpp =================================================================== --- runtime/src/kmp_sched.cpp +++ runtime/src/kmp_sched.cpp @@ -146,7 +146,7 @@ KE_TRACE( 10, ("__kmpc_for_static_init: T#%d return\n", global_tid ) ); #if OMPT_SUPPORT && OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_loop_begin)) { ompt_callbacks.ompt_callback(ompt_event_loop_begin)( team_info->parallel_id, task_info->task_id, @@ -192,7 +192,7 @@ KE_TRACE( 10, ("__kmpc_for_static_init: T#%d return\n", global_tid ) ); #if OMPT_SUPPORT && OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_loop_begin)) { ompt_callbacks.ompt_callback(ompt_event_loop_begin)( team_info->parallel_id, task_info->task_id, @@ -220,7 +220,7 @@ KE_TRACE( 10, ("__kmpc_for_static_init: T#%d return\n", global_tid ) ); #if OMPT_SUPPORT && OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_loop_begin)) { ompt_callbacks.ompt_callback(ompt_event_loop_begin)( team_info->parallel_id, task_info->task_id, @@ -352,7 +352,7 @@ KE_TRACE( 10, ("__kmpc_for_static_init: T#%d return\n", global_tid ) ); #if OMPT_SUPPORT && OMPT_TRACE - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_loop_begin)) { ompt_callbacks.ompt_callback(ompt_event_loop_begin)( team_info->parallel_id, task_info->task_id, team_info->microtask); Index: runtime/src/kmp_tasking.c =================================================================== --- runtime/src/kmp_tasking.c +++ runtime/src/kmp_tasking.c @@ -451,7 +451,7 @@ gtid, taskdata ) ); #if OMPT_SUPPORT - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_task_begin)) { kmp_taskdata_t *parent = taskdata->td_parent; ompt_callbacks.ompt_callback(ompt_event_task_begin)( @@ -608,7 +608,7 @@ kmp_int32 children = 0; #if OMPT_SUPPORT - if ((ompt_status == ompt_status_track_callback) && + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_task_end)) { kmp_taskdata_t *parent = taskdata->td_parent; ompt_callbacks.ompt_callback(ompt_event_task_end)( @@ -1031,7 +1031,7 @@ gtid, taskdata, taskdata->td_parent) ); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { taskdata->ompt_task_info.task_id = __ompt_task_id_new(gtid); taskdata->ompt_task_info.function = (void*) task_entry; taskdata->ompt_task_info.frame.exit_runtime_frame = NULL; @@ -1118,7 +1118,7 @@ #if OMPT_SUPPORT ompt_thread_info_t oldInfo; kmp_info_t * thread; - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { // Store the threads states and restore them after the task thread = __kmp_threads[ gtid ]; oldInfo = thread->th.ompt_thread_info; @@ -1166,7 +1166,7 @@ #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { thread->th.ompt_thread_info = oldInfo; taskdata->ompt_task_info.frame.exit_runtime_frame = 0; } @@ -1233,7 +1233,7 @@ kmp_taskdata_t * new_taskdata = KMP_TASK_TO_TASKDATA(new_task); #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { new_taskdata->ompt_task_info.frame.reenter_runtime_frame = __builtin_frame_address(0); } @@ -1254,7 +1254,7 @@ } #if OMPT_SUPPORT - if (ompt_status & ompt_status_track) { + if (ompt_enabled) { new_taskdata->ompt_task_info.frame.reenter_runtime_frame = 0; } #endif Index: runtime/src/kmp_wait_release.h =================================================================== --- runtime/src/kmp_wait_release.h +++ runtime/src/kmp_wait_release.h @@ -97,7 +97,7 @@ #if OMPT_SUPPORT && OMPT_BLAME ompt_state_t ompt_state = this_thr->th.ompt_thread_info.state; - if (ompt_status == ompt_status_track_callback && + if (ompt_enabled && ompt_state != ompt_state_undefined) { if (ompt_state == ompt_state_idle) { if (ompt_callbacks.ompt_callback(ompt_event_idle_begin)) { @@ -237,7 +237,7 @@ } #if OMPT_SUPPORT && OMPT_BLAME - if (ompt_status == ompt_status_track_callback && + if (ompt_enabled && ompt_state != ompt_state_undefined) { if (ompt_state == ompt_state_idle) { if (ompt_callbacks.ompt_callback(ompt_event_idle_end)) { Index: runtime/src/ompt-general.c =================================================================== --- runtime/src/ompt-general.c +++ runtime/src/ompt-general.c @@ -64,8 +64,7 @@ * global variables ****************************************************************************/ -ompt_status_t ompt_status = ompt_status_ready; - +int ompt_enabled = 0; ompt_state_info_t ompt_state_info[] = { #define ompt_state_macro(state, code) { # state, state }, @@ -126,14 +125,13 @@ switch(tool_setting) { case omp_tool_disabled: - ompt_status = ompt_status_disabled; break; case omp_tool_unset: case omp_tool_enabled: ompt_initialize_fn = ompt_tool(); if (ompt_initialize_fn) { - ompt_status = ompt_status_track_callback; + ompt_enabled = 1; } break; @@ -162,7 +160,7 @@ //-------------------------------------------------- // Initialize the tool if so indicated. //-------------------------------------------------- - if (ompt_status == ompt_status_track_callback) { + if (ompt_enabled) { ompt_initialize_fn(ompt_fn_lookup, ompt_get_runtime_version(), OMPT_VERSION); @@ -182,13 +180,13 @@ void ompt_fini() { - if (ompt_status == ompt_status_track_callback) { + if (ompt_enabled) { if (ompt_callbacks.ompt_callback(ompt_event_runtime_shutdown)) { ompt_callbacks.ompt_callback(ompt_event_runtime_shutdown)(); } } - ompt_status = ompt_status_disabled; + ompt_enabled = 0; } @@ -426,8 +424,7 @@ _OMP_EXTERN void ompt_control(uint64_t command, uint64_t modifier) { - if (ompt_status == ompt_status_track_callback && - ompt_callbacks.ompt_callback(ompt_event_control)) { + if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_control)) { ompt_callbacks.ompt_callback(ompt_event_control)(command, modifier); } } Index: runtime/src/ompt-internal.h =================================================================== --- runtime/src/ompt-internal.h +++ runtime/src/ompt-internal.h @@ -14,16 +14,6 @@ #define ompt_callback(e) e ## _callback -/* track and track_callback share a bit so that one can test whether either is - * set by anding a bit. - */ -typedef enum { - ompt_status_disabled = 0x0, - ompt_status_ready = 0x1, - ompt_status_track = 0x2, - ompt_status_track_callback = 0x6, -} ompt_status_t; - typedef struct ompt_callbacks_s { #define ompt_event_macro(event, callback, eventid) callback ompt_callback(event); @@ -70,7 +60,6 @@ } ompt_thread_info_t; -extern ompt_status_t ompt_status; extern ompt_callbacks_t ompt_callbacks; #ifdef __cplusplus @@ -81,6 +70,8 @@ void ompt_post_init(void); void ompt_fini(void); +extern int ompt_enabled; + #ifdef __cplusplus }; #endif