[Openmp-commits] [openmp] d056d75 - [OpenMP][Tool] Extend reuse of OMPT testing
Joachim Protze via Openmp-commits
openmp-commits at lists.llvm.org
Sun Jun 14 06:55:55 PDT 2020
Author: Joachim Protze
Date: 2020-06-14T15:55:32+02:00
New Revision: d056d7592a48df41d0c1196f845aef440a1e082d
URL: https://github.com/llvm/llvm-project/commit/d056d7592a48df41d0c1196f845aef440a1e082d
DIFF: https://github.com/llvm/llvm-project/commit/d056d7592a48df41d0c1196f845aef440a1e082d.diff
LOG: [OpenMP][Tool] Extend reuse of OMPT testing
This patch allows to specify a prefix (default:empty) to be included into print-out
written by callback.h.
Also adding a cmake target to find the header file from other tests.
Reviewed by: jdoerfert
Differential Revision: https://reviews.llvm.org/D76008
Added:
Modified:
openmp/runtime/test/CMakeLists.txt
openmp/runtime/test/ompt/callback.h
Removed:
################################################################################
diff --git a/openmp/runtime/test/CMakeLists.txt b/openmp/runtime/test/CMakeLists.txt
index b5376d3efdfd..722023e24179 100644
--- a/openmp/runtime/test/CMakeLists.txt
+++ b/openmp/runtime/test/CMakeLists.txt
@@ -30,6 +30,10 @@ pythonize_bool(LIBOMP_OMPT_OPTIONAL)
pythonize_bool(LIBOMP_HAVE_LIBM)
pythonize_bool(LIBOMP_HAVE_LIBATOMIC)
+add_library(ompt-print-callback INTERFACE)
+target_include_directories(ompt-print-callback INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/ompt)
+
+
add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omp)
# Add target check-ompt, but make sure to not add the tests twice to check-openmp.
add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt EXCLUDE_FROM_CHECK_ALL DEPENDS omp)
diff --git a/openmp/runtime/test/ompt/callback.h b/openmp/runtime/test/ompt/callback.h
index 2bc5e39f2706..f91729456739 100644
--- a/openmp/runtime/test/ompt/callback.h
+++ b/openmp/runtime/test/ompt/callback.h
@@ -14,6 +14,12 @@
// Used to detect architecture
#include "../../src/kmp_platform.h"
+#ifndef _TOOL_PREFIX
+#define _TOOL_PREFIX ""
+// If no _TOOL_PREFIX is set, we assume that we run as part of an OMPT test
+#define _OMPT_TESTS
+#endif
+
static const char* ompt_thread_t_values[] = {
NULL,
"ompt_thread_initial",
@@ -239,19 +245,34 @@ on_ompt_callback_mutex_acquire(
switch(kind)
{
case ompt_mutex_lock:
- printf("%" PRIu64 ": ompt_event_wait_lock: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_lock: wait_id=%" PRIu64 ", hint=%" PRIu32
+ ", impl=%" PRIu32 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
break;
case ompt_mutex_nest_lock:
- printf("%" PRIu64 ": ompt_event_wait_nest_lock: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_nest_lock: wait_id=%" PRIu64 ", hint=%" PRIu32
+ ", impl=%" PRIu32 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
break;
case ompt_mutex_critical:
- printf("%" PRIu64 ": ompt_event_wait_critical: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_critical: wait_id=%" PRIu64 ", hint=%" PRIu32
+ ", impl=%" PRIu32 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
break;
case ompt_mutex_atomic:
- printf("%" PRIu64 ": ompt_event_wait_atomic: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_atomic: wait_id=%" PRIu64 ", hint=%" PRIu32
+ ", impl=%" PRIu32 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
break;
case ompt_mutex_ordered:
- printf("%" PRIu64 ": ompt_event_wait_ordered: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_ordered: wait_id=%" PRIu64 ", hint=%" PRIu32
+ ", impl=%" PRIu32 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
break;
default:
break;
@@ -267,19 +288,33 @@ on_ompt_callback_mutex_acquired(
switch(kind)
{
case ompt_mutex_lock:
- printf("%" PRIu64 ": ompt_event_acquired_lock: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_acquired_lock: wait_id=%" PRIu64 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_mutex_nest_lock:
- printf("%" PRIu64 ": ompt_event_acquired_nest_lock_first: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_acquired_nest_lock_first: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_mutex_critical:
- printf("%" PRIu64 ": ompt_event_acquired_critical: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_acquired_critical: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_mutex_atomic:
- printf("%" PRIu64 ": ompt_event_acquired_atomic: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_acquired_atomic: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_mutex_ordered:
- printf("%" PRIu64 ": ompt_event_acquired_ordered: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_acquired_ordered: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
default:
break;
@@ -295,19 +330,33 @@ on_ompt_callback_mutex_released(
switch(kind)
{
case ompt_mutex_lock:
- printf("%" PRIu64 ": ompt_event_release_lock: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_release_lock: wait_id=%" PRIu64 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_mutex_nest_lock:
- printf("%" PRIu64 ": ompt_event_release_nest_lock_last: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_release_nest_lock_last: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_mutex_critical:
- printf("%" PRIu64 ": ompt_event_release_critical: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_release_critical: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_mutex_atomic:
- printf("%" PRIu64 ": ompt_event_release_atomic: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_release_atomic: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_mutex_ordered:
- printf("%" PRIu64 ": ompt_event_release_ordered: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_release_ordered: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
default:
break;
@@ -323,10 +372,16 @@ on_ompt_callback_nest_lock(
switch(endpoint)
{
case ompt_scope_begin:
- printf("%" PRIu64 ": ompt_event_acquired_nest_lock_next: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_acquired_nest_lock_next: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_scope_end:
- printf("%" PRIu64 ": ompt_event_release_nest_lock_prev: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_release_nest_lock_prev: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
}
}
@@ -348,14 +403,26 @@ on_ompt_callback_sync_region(
case ompt_sync_region_barrier_implicit:
case ompt_sync_region_barrier_explicit:
case ompt_sync_region_barrier_implementation:
- printf("%" PRIu64 ": ompt_event_barrier_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_barrier_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra);
print_ids(0);
break;
case ompt_sync_region_taskwait:
- printf("%" PRIu64 ": ompt_event_taskwait_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_taskwait_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra);
break;
case ompt_sync_region_taskgroup:
- printf("%" PRIu64 ": ompt_event_taskgroup_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_taskgroup_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra);
break;
case ompt_sync_region_reduction:
printf("ompt_sync_region_reduction should never be passed to "
@@ -371,13 +438,28 @@ on_ompt_callback_sync_region(
case ompt_sync_region_barrier_implicit:
case ompt_sync_region_barrier_explicit:
case ompt_sync_region_barrier_implementation:
- printf("%" PRIu64 ": ompt_event_barrier_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_barrier_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value,
+ (parallel_data) ? parallel_data->value : 0, task_data->value,
+ codeptr_ra);
break;
case ompt_sync_region_taskwait:
- printf("%" PRIu64 ": ompt_event_taskwait_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_taskwait_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value,
+ (parallel_data) ? parallel_data->value : 0, task_data->value,
+ codeptr_ra);
break;
case ompt_sync_region_taskgroup:
- printf("%" PRIu64 ": ompt_event_taskgroup_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_taskgroup_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value,
+ (parallel_data) ? parallel_data->value : 0, task_data->value,
+ codeptr_ra);
break;
case ompt_sync_region_reduction:
printf("ompt_sync_region_reduction should never be passed to "
@@ -406,13 +488,25 @@ on_ompt_callback_sync_region_wait(
case ompt_sync_region_barrier_implicit:
case ompt_sync_region_barrier_explicit:
case ompt_sync_region_barrier_implementation:
- printf("%" PRIu64 ": ompt_event_wait_barrier_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_barrier_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra);
break;
case ompt_sync_region_taskwait:
- printf("%" PRIu64 ": ompt_event_wait_taskwait_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_taskwait_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra);
break;
case ompt_sync_region_taskgroup:
- printf("%" PRIu64 ": ompt_event_wait_taskgroup_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_taskgroup_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra);
break;
case ompt_sync_region_reduction:
printf("ompt_sync_region_reduction should never be passed to "
@@ -428,13 +522,28 @@ on_ompt_callback_sync_region_wait(
case ompt_sync_region_barrier_implicit:
case ompt_sync_region_barrier_explicit:
case ompt_sync_region_barrier_implementation:
- printf("%" PRIu64 ": ompt_event_wait_barrier_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_barrier_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value,
+ (parallel_data) ? parallel_data->value : 0, task_data->value,
+ codeptr_ra);
break;
case ompt_sync_region_taskwait:
- printf("%" PRIu64 ": ompt_event_wait_taskwait_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_taskwait_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value,
+ (parallel_data) ? parallel_data->value : 0, task_data->value,
+ codeptr_ra);
break;
case ompt_sync_region_taskgroup:
- printf("%" PRIu64 ": ompt_event_wait_taskgroup_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_wait_taskgroup_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value,
+ (parallel_data) ? parallel_data->value : 0, task_data->value,
+ codeptr_ra);
break;
case ompt_sync_region_reduction:
printf("ompt_sync_region_reduction should never be passed to "
@@ -453,14 +562,16 @@ static void on_ompt_callback_reduction(ompt_sync_region_t kind,
const void *codeptr_ra) {
switch (endpoint) {
case ompt_scope_begin:
- printf("%" PRIu64 ": ompt_event_reduction_begin: parallel_id=%" PRIu64
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_reduction_begin: parallel_id=%" PRIu64
", task_id=%" PRIu64 ", codeptr_ra=%p\n",
ompt_get_thread_data()->value,
(parallel_data) ? parallel_data->value : 0, task_data->value,
codeptr_ra);
break;
case ompt_scope_end:
- printf("%" PRIu64 ": ompt_event_reduction_end: parallel_id=%" PRIu64
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_reduction_end: parallel_id=%" PRIu64
", task_id=%" PRIu64 ", codeptr_ra=%p\n",
ompt_get_thread_data()->value,
(parallel_data) ? parallel_data->value : 0, task_data->value,
@@ -474,7 +585,8 @@ on_ompt_callback_flush(
ompt_data_t *thread_data,
const void *codeptr_ra)
{
- printf("%" PRIu64 ": ompt_event_flush: codeptr_ra=%p\n", thread_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX " ompt_event_flush: codeptr_ra=%p\n",
+ thread_data->value, codeptr_ra);
}
static void
@@ -501,7 +613,10 @@ on_ompt_callback_cancel(
else if(flags & ompt_cancel_discarded_task)
second_flag_value = ompt_cancel_flag_t_values[6];
- printf("%" PRIu64 ": ompt_event_cancel: task_data=%" PRIu64 ", flags=%s|%s=%" PRIu32 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, task_data->value, first_flag_value, second_flag_value, flags, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX " ompt_event_cancel: task_data=%" PRIu64
+ ", flags=%s|%s=%" PRIu32 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value, task_data->value, first_flag_value,
+ second_flag_value, flags, codeptr_ra);
}
static void
@@ -531,22 +646,39 @@ on_ompt_callback_implicit_task(
if (team_size == 1 && thread_num == 1 && parallel_data->ptr)
printf("%s\n", "0: parallel_data initially not null");
parallel_data->value = ompt_get_unique_id();
- printf("%" PRIu64 ": ompt_event_initial_task_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", actual_parallelism=%" PRIu32 ", index=%" PRIu32 ", flags=%" PRIu32 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, team_size, thread_num, flags);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_initial_task_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", actual_parallelism=%" PRIu32
+ ", index=%" PRIu32 ", flags=%" PRIu32 "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, team_size, thread_num, flags);
} else {
- printf("%" PRIu64 ": ompt_event_implicit_task_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", team_size=%" PRIu32 ", thread_num=%" PRIu32 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, team_size, thread_num);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_implicit_task_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", team_size=%" PRIu32
+ ", thread_num=%" PRIu32 "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, team_size, thread_num);
}
break;
case ompt_scope_end:
if(flags & ompt_task_initial){
- printf("%" PRIu64 ": ompt_event_initial_task_end: parallel_id=%" PRIu64
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_initial_task_end: parallel_id=%" PRIu64
", task_id=%" PRIu64 ", actual_parallelism=%" PRIu32
", index=%" PRIu32 "\n",
ompt_get_thread_data()->value,
(parallel_data) ? parallel_data->value : 0, task_data->value,
team_size, thread_num);
} else {
- printf("%" PRIu64 ": ompt_event_implicit_task_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", team_size=%" PRIu32 ", thread_num=%" PRIu32 "\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, team_size, thread_num);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_implicit_task_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", team_size=%" PRIu32
+ ", thread_num=%" PRIu32 "\n",
+ ompt_get_thread_data()->value,
+ (parallel_data) ? parallel_data->value : 0, task_data->value,
+ team_size, thread_num);
}
break;
}
@@ -563,10 +695,16 @@ on_ompt_callback_lock_init(
switch(kind)
{
case ompt_mutex_lock:
- printf("%" PRIu64 ": ompt_event_init_lock: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_init_lock: wait_id=%" PRIu64 ", hint=%" PRIu32
+ ", impl=%" PRIu32 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
break;
case ompt_mutex_nest_lock:
- printf("%" PRIu64 ": ompt_event_init_nest_lock: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_init_nest_lock: wait_id=%" PRIu64 ", hint=%" PRIu32
+ ", impl=%" PRIu32 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra);
break;
default:
break;
@@ -582,10 +720,15 @@ on_ompt_callback_lock_destroy(
switch(kind)
{
case ompt_mutex_lock:
- printf("%" PRIu64 ": ompt_event_destroy_lock: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_destroy_lock: wait_id=%" PRIu64 ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
case ompt_mutex_nest_lock:
- printf("%" PRIu64 ": ompt_event_destroy_nest_lock: wait_id=%" PRIu64 ", codeptr_ra=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_destroy_nest_lock: wait_id=%" PRIu64
+ ", codeptr_ra=%p \n",
+ ompt_get_thread_data()->value, wait_id, codeptr_ra);
break;
default:
break;
@@ -607,26 +750,55 @@ on_ompt_callback_work(
switch(wstype)
{
case ompt_work_loop:
- printf("%" PRIu64 ": ompt_event_loop_begin: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_loop_begin: parallel_id=%" PRIu64
+ ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
+ "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_sections:
- printf("%" PRIu64 ": ompt_event_sections_begin: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_sections_begin: parallel_id=%" PRIu64
+ ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
+ "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_single_executor:
- printf("%" PRIu64 ": ompt_event_single_in_block_begin: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_single_in_block_begin: parallel_id=%" PRIu64
+ ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
+ "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_single_other:
- printf("%" PRIu64 ": ompt_event_single_others_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_single_others_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_workshare:
//impl
break;
case ompt_work_distribute:
- printf("%" PRIu64 ": ompt_event_distribute_begin: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_distribute_begin: parallel_id=%" PRIu64
+ ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
+ "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_taskloop:
//impl
- printf("%" PRIu64 ": ompt_event_taskloop_begin: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_taskloop_begin: parallel_id=%" PRIu64
+ ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
+ "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
}
break;
@@ -634,26 +806,52 @@ on_ompt_callback_work(
switch(wstype)
{
case ompt_work_loop:
- printf("%" PRIu64 ": ompt_event_loop_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_loop_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_sections:
- printf("%" PRIu64 ": ompt_event_sections_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_sections_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_single_executor:
- printf("%" PRIu64 ": ompt_event_single_in_block_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_single_in_block_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_single_other:
- printf("%" PRIu64 ": ompt_event_single_others_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_single_others_end: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_workshare:
//impl
break;
case ompt_work_distribute:
- printf("%" PRIu64 ": ompt_event_distribute_end: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_distribute_end: parallel_id=%" PRIu64
+ ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
+ "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
case ompt_work_taskloop:
//impl
- printf("%" PRIu64 ": ompt_event_taskloop_end: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_taskloop_end: parallel_id=%" PRIu64
+ ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
+ "\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra, count);
break;
}
break;
@@ -670,10 +868,18 @@ on_ompt_callback_master(
switch(endpoint)
{
case ompt_scope_begin:
- printf("%" PRIu64 ": ompt_event_master_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_master_begin: parallel_id=%" PRIu64
+ ", task_id=%" PRIu64 ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra);
break;
case ompt_scope_end:
- printf("%" PRIu64 ": ompt_event_master_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_master_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64
+ ", codeptr_ra=%p\n",
+ ompt_get_thread_data()->value, parallel_data->value,
+ task_data->value, codeptr_ra);
break;
}
}
@@ -688,7 +894,8 @@ static void on_ompt_callback_parallel_begin(
int invoker = flag & 0xF;
const char *event = (flag & ompt_parallel_team) ? "parallel" : "teams";
const char *size = (flag & ompt_parallel_team) ? "team_size" : "num_teams";
- printf("%" PRIu64 ": ompt_event_%s_begin: parent_task_id=%" PRIu64
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_%s_begin: parent_task_id=%" PRIu64
", parent_task_frame.exit=%p, parent_task_frame.reenter=%p, "
"parallel_id=%" PRIu64 ", requested_%s=%" PRIu32
", codeptr_ra=%p, invoker=%d\n",
@@ -703,7 +910,7 @@ static void on_ompt_callback_parallel_end(ompt_data_t *parallel_data,
int flag, const void *codeptr_ra) {
int invoker = flag & 0xF;
const char *event = (flag & ompt_parallel_team) ? "parallel" : "teams";
- printf("%" PRIu64 ": ompt_event_%s_end: parallel_id=%" PRIu64
+ printf("%" PRIu64 ":" _TOOL_PREFIX " ompt_event_%s_end: parallel_id=%" PRIu64
", task_id=%" PRIu64 ", invoker=%d, codeptr_ra=%p\n",
ompt_get_thread_data()->value, event, parallel_data->value,
encountering_task_data->value, invoker, codeptr_ra);
@@ -725,7 +932,18 @@ on_ompt_callback_task_create(
format_task_type(type, buffer);
- printf("%" PRIu64 ": ompt_event_task_create: parent_task_id=%" PRIu64 ", parent_task_frame.exit=%p, parent_task_frame.reenter=%p, new_task_id=%" PRIu64 ", codeptr_ra=%p, task_type=%s=%d, has_dependences=%s\n", ompt_get_thread_data()->value, encountering_task_data ? encountering_task_data->value : 0, encountering_task_frame ? encountering_task_frame->exit_frame.ptr : NULL, encountering_task_frame ? encountering_task_frame->enter_frame.ptr : NULL, new_task_data->value, codeptr_ra, buffer, type, has_dependences ? "yes" : "no");
+ printf(
+ "%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_task_create: parent_task_id=%" PRIu64
+ ", parent_task_frame.exit=%p, parent_task_frame.reenter=%p, "
+ "new_task_id=%" PRIu64
+ ", codeptr_ra=%p, task_type=%s=%d, has_dependences=%s\n",
+ ompt_get_thread_data()->value,
+ encountering_task_data ? encountering_task_data->value : 0,
+ encountering_task_frame ? encountering_task_frame->exit_frame.ptr : NULL,
+ encountering_task_frame ? encountering_task_frame->enter_frame.ptr : NULL,
+ new_task_data->value, codeptr_ra, buffer, type,
+ has_dependences ? "yes" : "no");
}
static void
@@ -734,14 +952,16 @@ on_ompt_callback_task_schedule(
ompt_task_status_t prior_task_status,
ompt_data_t *second_task_data)
{
- printf("%" PRIu64 ": ompt_event_task_schedule: first_task_id=%" PRIu64
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_task_schedule: first_task_id=%" PRIu64
", second_task_id=%" PRIu64 ", prior_task_status=%s=%d\n",
ompt_get_thread_data()->value, first_task_data->value,
(second_task_data ? second_task_data->value : -1),
ompt_task_status_t_values[prior_task_status], prior_task_status);
if (prior_task_status == ompt_task_complete ||
prior_task_status == ompt_task_late_fulfill) {
- printf("%" PRIu64 ": ompt_event_task_end: task_id=%" PRIu64 "\n", ompt_get_thread_data()->value, first_task_data->value);
+ printf("%" PRIu64 ":" _TOOL_PREFIX " ompt_event_task_end: task_id=%" PRIu64
+ "\n", ompt_get_thread_data()->value, first_task_data->value);
}
}
@@ -751,7 +971,10 @@ on_ompt_callback_dependences(
const ompt_dependence_t *deps,
int ndeps)
{
- printf("%" PRIu64 ": ompt_event_task_dependences: task_id=%" PRIu64 ", deps=%p, ndeps=%d\n", ompt_get_thread_data()->value, task_data->value, (void *)deps, ndeps);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_task_dependences: task_id=%" PRIu64
+ ", deps=%p, ndeps=%d\n",
+ ompt_get_thread_data()->value, task_data->value, (void *)deps, ndeps);
}
static void
@@ -759,7 +982,11 @@ on_ompt_callback_task_dependence(
ompt_data_t *first_task_data,
ompt_data_t *second_task_data)
{
- printf("%" PRIu64 ": ompt_event_task_dependence_pair: first_task_id=%" PRIu64 ", second_task_id=%" PRIu64 "\n", ompt_get_thread_data()->value, first_task_data->value, second_task_data->value);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_task_dependence_pair: first_task_id=%" PRIu64
+ ", second_task_id=%" PRIu64 "\n",
+ ompt_get_thread_data()->value, first_task_data->value,
+ second_task_data->value);
}
static void
@@ -770,14 +997,19 @@ on_ompt_callback_thread_begin(
if(thread_data->ptr)
printf("%s\n", "0: thread_data initially not null");
thread_data->value = ompt_get_unique_id();
- printf("%" PRIu64 ": ompt_event_thread_begin: thread_type=%s=%d, thread_id=%" PRIu64 "\n", ompt_get_thread_data()->value, ompt_thread_t_values[thread_type], thread_type, thread_data->value);
+ printf("%" PRIu64 ":" _TOOL_PREFIX
+ " ompt_event_thread_begin: thread_type=%s=%d, thread_id=%" PRIu64 "\n",
+ ompt_get_thread_data()->value, ompt_thread_t_values[thread_type],
+ thread_type, thread_data->value);
}
static void
on_ompt_callback_thread_end(
ompt_data_t *thread_data)
{
- printf("%" PRIu64 ": ompt_event_thread_end: thread_id=%" PRIu64 "\n", ompt_get_thread_data()->value, thread_data->value);
+ printf("%" PRIu64 ":" _TOOL_PREFIX " ompt_event_thread_end: thread_id=%" PRIu64
+ "\n",
+ ompt_get_thread_data()->value, thread_data->value);
}
static int
@@ -789,7 +1021,36 @@ on_ompt_callback_control_tool(
{
ompt_frame_t* omptTaskFrame;
ompt_get_task_info(0, NULL, (ompt_data_t**) NULL, &omptTaskFrame, NULL, NULL);
- printf("%" PRIu64 ": ompt_event_control_tool: command=%" PRIu64 ", modifier=%" PRIu64 ", arg=%p, codeptr_ra=%p, current_task_frame.exit=%p, current_task_frame.reenter=%p \n", ompt_get_thread_data()->value, command, modifier, arg, codeptr_ra, omptTaskFrame->exit_frame.ptr, omptTaskFrame->enter_frame.ptr);
+ printf("%" PRIu64 ":" _TOOL_PREFIX " ompt_event_control_tool: command=%" PRIu64
+ ", modifier=%" PRIu64
+ ", arg=%p, codeptr_ra=%p, current_task_frame.exit=%p, "
+ "current_task_frame.reenter=%p \n",
+ ompt_get_thread_data()->value, command, modifier, arg, codeptr_ra,
+ omptTaskFrame->exit_frame.ptr, omptTaskFrame->enter_frame.ptr);
+
+ // the following would interfere with expected output for OMPT tests, so skip
+#ifndef _OMPT_TESTS
+ // print task data
+ int task_level = 0;
+ ompt_data_t *task_data;
+ while (ompt_get_task_info(task_level, NULL, (ompt_data_t **)&task_data, NULL,
+ NULL, NULL)) {
+ printf("%" PRIu64 ":" _TOOL_PREFIX " task level %d: task_id=%" PRIu64 "\n",
+ ompt_get_thread_data()->value, task_level, task_data->value);
+ task_level++;
+ }
+
+ // print parallel data
+ int parallel_level = 0;
+ ompt_data_t *parallel_data;
+ while (ompt_get_parallel_info(parallel_level, (ompt_data_t **)¶llel_data,
+ NULL)) {
+ printf("%" PRIu64 ":" _TOOL_PREFIX " parallel level %d: parallel_id=%" PRIu64
+ "\n",
+ ompt_get_thread_data()->value, parallel_level, parallel_data->value);
+ parallel_level++;
+ }
+#endif
return 0; //success
}
@@ -863,3 +1124,6 @@ ompt_start_tool_result_t* ompt_start_tool(
}
#endif
#endif // ifndef USE_PRIVATE_TOOL
+#ifdef _OMPT_TESTS
+#undef _OMPT_TESTS
+#endif
More information about the Openmp-commits
mailing list