aboutsummaryrefslogtreecommitdiff
path: root/final/runtime/test/ompt/misc
diff options
context:
space:
mode:
Diffstat (limited to 'final/runtime/test/ompt/misc')
-rw-r--r--final/runtime/test/ompt/misc/api_calls_from_other_thread.cpp92
-rw-r--r--final/runtime/test/ompt/misc/api_calls_misc.c72
-rw-r--r--final/runtime/test/ompt/misc/api_calls_places.c88
-rw-r--r--final/runtime/test/ompt/misc/control_tool.c30
-rw-r--r--final/runtime/test/ompt/misc/control_tool_no_ompt_support.c15
-rw-r--r--final/runtime/test/ompt/misc/interoperability.cpp119
-rw-r--r--final/runtime/test/ompt/misc/threads.c34
-rw-r--r--final/runtime/test/ompt/misc/threads_nested.c40
-rw-r--r--final/runtime/test/ompt/misc/unset_callback.c29
9 files changed, 519 insertions, 0 deletions
diff --git a/final/runtime/test/ompt/misc/api_calls_from_other_thread.cpp b/final/runtime/test/ompt/misc/api_calls_from_other_thread.cpp
new file mode 100644
index 0000000..e2ef1fc
--- /dev/null
+++ b/final/runtime/test/ompt/misc/api_calls_from_other_thread.cpp
@@ -0,0 +1,92 @@
+// RUN: %libomp-cxx-compile-and-run | FileCheck %s
+// REQUIRES: ompt, linux
+
+#include <thread>
+#include "callback.h"
+
+void f() {
+ ompt_data_t *tdata = ompt_get_thread_data();
+ uint64_t tvalue = tdata ? tdata->value : 0;
+
+ printf("%" PRIu64 ": ompt_get_num_places()=%d\n", tvalue,
+ ompt_get_num_places());
+
+ printf("%" PRIu64 ": ompt_get_place_proc_ids()=%d\n", tvalue,
+ ompt_get_place_proc_ids(0, 0, NULL));
+
+ printf("%" PRIu64 ": ompt_get_place_num()=%d\n", tvalue,
+ ompt_get_place_num());
+
+ printf("%" PRIu64 ": ompt_get_partition_place_nums()=%d\n", tvalue,
+ ompt_get_partition_place_nums(0, NULL));
+
+ printf("%" PRIu64 ": ompt_get_proc_id()=%d\n", tvalue, ompt_get_proc_id());
+
+ printf("%" PRIu64 ": ompt_get_num_procs()=%d\n", tvalue,
+ ompt_get_num_procs());
+
+ ompt_callback_t callback;
+ printf("%" PRIu64 ": ompt_get_callback()=%d\n", tvalue,
+ ompt_get_callback(ompt_callback_thread_begin, &callback));
+
+ printf("%" PRIu64 ": ompt_get_state()=%d\n", tvalue, ompt_get_state(NULL));
+
+ int state = ompt_state_undefined;
+ const char *state_name;
+ printf("%" PRIu64 ": ompt_enumerate_states()=%d\n", tvalue,
+ ompt_enumerate_states(state, &state, &state_name));
+
+ int impl = ompt_mutex_impl_none;
+ const char *impl_name;
+ printf("%" PRIu64 ": ompt_enumerate_mutex_impls()=%d\n", tvalue,
+ ompt_enumerate_mutex_impls(impl, &impl, &impl_name));
+
+ printf("%" PRIu64 ": ompt_get_thread_data()=%p\n", tvalue,
+ ompt_get_thread_data());
+
+ printf("%" PRIu64 ": ompt_get_parallel_info()=%d\n", tvalue,
+ ompt_get_parallel_info(0, NULL, NULL));
+
+ printf("%" PRIu64 ": ompt_get_task_info()=%d\n", tvalue,
+ ompt_get_task_info(0, NULL, NULL, NULL, NULL, NULL));
+}
+
+int main() {
+#pragma omp parallel num_threads(1)
+ {}
+
+ std::thread t1(f);
+ t1.join();
+
+ // Check if libomp supports the callbacks for this test.
+
+ // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_get_num_places()={{[0-9]+}}
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_place_proc_ids()={{[0-9]+}}
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_place_num()=-1
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_partition_place_nums()=0
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_proc_id()=-1
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_num_procs()={{[0-9]+}}
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_callback()=1
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_state()=0
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_enumerate_states()=1
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_enumerate_mutex_impls()=1
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_thread_data()=[[NULL]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_parallel_info()=0
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_task_info()=0
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/misc/api_calls_misc.c b/final/runtime/test/ompt/misc/api_calls_misc.c
new file mode 100644
index 0000000..884421e
--- /dev/null
+++ b/final/runtime/test/ompt/misc/api_calls_misc.c
@@ -0,0 +1,72 @@
+// RUN: %libomp-compile && %libomp-run | FileCheck %s
+// REQUIRES: ompt
+#include "callback.h"
+#include <omp.h>
+
+int main() {
+#pragma omp parallel num_threads(1)
+ {
+ // ompt_get_callback()
+ ompt_callback_t callback;
+ ompt_get_callback(ompt_callback_thread_begin, &callback);
+ printf("%" PRIu64 ": &on_ompt_callback_thread_begin=%p\n",
+ ompt_get_thread_data()->value, &on_ompt_callback_thread_begin);
+ printf("%" PRIu64 ": ompt_get_callback() result=%p\n",
+ ompt_get_thread_data()->value, callback);
+
+ // ompt_get_state()
+ printf("%" PRIu64 ": ompt_get_state()=%d\n", ompt_get_thread_data()->value,
+ ompt_get_state(NULL));
+
+ // ompt_enumerate_states()
+ int state = ompt_state_undefined;
+ const char *state_name;
+ int steps = 0;
+ while (ompt_enumerate_states(state, &state, &state_name) && steps < 1000) {
+ steps++;
+ if (!state_name)
+ printf("%" PRIu64 ": state_name is NULL\n",
+ ompt_get_thread_data()->value);
+ }
+ if (steps >= 1000) {
+ // enumeration did not end after 1000 steps
+ printf("%" PRIu64 ": states enumeration did not end\n",
+ ompt_get_thread_data()->value);
+ }
+
+ // ompt_enumerate_mutex_impls()
+ int impl = ompt_mutex_impl_none;
+ const char *impl_name;
+ steps = 0;
+ while (ompt_enumerate_mutex_impls(impl, &impl, &impl_name) &&
+ steps < 1000) {
+ steps++;
+ if (!impl_name)
+ printf("%" PRIu64 ": impl_name is NULL\n",
+ ompt_get_thread_data()->value);
+ }
+ if (steps >= 1000) {
+ // enumeration did not end after 1000 steps
+ printf("%" PRIu64 ": mutex_impls enumeration did not end\n",
+ ompt_get_thread_data()->value);
+ }
+ }
+
+ // Check if libomp supports the callbacks for this test.
+
+ // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: &on_ompt_callback_thread_begin
+ // CHECK-SAME: =[[FUNCTION_POINTER:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_get_callback() result=[[FUNCTION_POINTER]]
+
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_get_state()=1
+
+ // CHECK-NOT: {{^}}[[THREAD_ID]]: state_name is NULL
+ // CHECK-NOT: {{^}}[[THREAD_ID]]: states enumeration did not end
+
+ // CHECK-NOT: {{^}}[[THREAD_ID]]: impl_name is NULL
+ // CHECK-NOT: {{^}}[[THREAD_ID]]: mutex_impls enumeration did not end
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/misc/api_calls_places.c b/final/runtime/test/ompt/misc/api_calls_places.c
new file mode 100644
index 0000000..3385c9c
--- /dev/null
+++ b/final/runtime/test/ompt/misc/api_calls_places.c
@@ -0,0 +1,88 @@
+// RUN: %libomp-compile && env OMP_PLACES=cores %libomp-run | FileCheck %s
+// REQUIRES: ompt, linux
+#include "callback.h"
+#include <omp.h>
+#define __USE_GNU
+#include <sched.h>
+#undef __USE_GNU
+
+void print_list(char *function_name, int size, int list[]) {
+ printf("%" PRIu64 ": %s(0)=(%d", ompt_get_thread_data()->value, function_name,
+ list[0]);
+ int i;
+ for (i = 1; i < size; i++) {
+ printf(",%d", list[i]);
+ }
+ printf(")\n");
+}
+
+int main() {
+#pragma omp parallel num_threads(1)
+ {
+ printf("%" PRIu64 ": omp_get_num_places()=%d\n",
+ ompt_get_thread_data()->value, omp_get_num_places());
+ printf("%" PRIu64 ": ompt_get_num_places()=%d\n",
+ ompt_get_thread_data()->value, ompt_get_num_places());
+
+ int omp_ids_size = omp_get_place_num_procs(0);
+ int omp_ids[omp_ids_size];
+ omp_get_place_proc_ids(0, omp_ids);
+ print_list("omp_get_place_proc_ids", omp_ids_size, omp_ids);
+ int ompt_ids_size = ompt_get_place_proc_ids(0, 0, NULL);
+ int ompt_ids[ompt_ids_size];
+ ompt_get_place_proc_ids(0, ompt_ids_size, ompt_ids);
+ print_list("ompt_get_place_proc_ids", ompt_ids_size, ompt_ids);
+
+ printf("%" PRIu64 ": omp_get_place_num()=%d\n",
+ ompt_get_thread_data()->value, omp_get_place_num());
+ printf("%" PRIu64 ": ompt_get_place_num()=%d\n",
+ ompt_get_thread_data()->value, ompt_get_place_num());
+
+ int omp_nums_size = omp_get_partition_num_places();
+ int omp_nums[omp_nums_size];
+ omp_get_partition_place_nums(omp_nums);
+ print_list("omp_get_partition_place_nums", omp_nums_size, omp_nums);
+ int ompt_nums_size = ompt_get_partition_place_nums(0, omp_nums);
+ int ompt_nums[ompt_nums_size];
+ ompt_get_partition_place_nums(ompt_nums_size, ompt_nums);
+ print_list("ompt_get_partition_place_nums", ompt_nums_size, ompt_nums);
+
+ printf("%" PRIu64 ": sched_getcpu()=%d\n", ompt_get_thread_data()->value,
+ sched_getcpu());
+ printf("%" PRIu64 ": ompt_get_proc_id()=%d\n",
+ ompt_get_thread_data()->value, ompt_get_proc_id());
+
+ printf("%" PRIu64 ": omp_get_num_procs()=%d\n",
+ ompt_get_thread_data()->value, omp_get_num_procs());
+ printf("%" PRIu64 ": ompt_get_num_procs()=%d\n",
+ ompt_get_thread_data()->value, ompt_get_num_procs());
+ }
+
+ // Check if libomp supports the callbacks for this test.
+
+ // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: omp_get_num_places
+ // CHECK-SAME: ()=[[NUM_PLACES:[0-9]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_num_places()=[[NUM_PLACES]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: omp_get_place_proc_ids
+ // CHECK-SAME: (0)=([[PROC_IDS:[0-9\,]+]])
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_place_proc_ids(0)=([[PROC_IDS]])
+
+ // CHECK: {{^}}[[MASTER_ID]]: omp_get_place_num()=[[PLACE_NUM:[-]?[0-9]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_place_num()=[[PLACE_NUM]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: omp_get_partition_place_nums
+ // CHECK-SAME: (0)=([[PARTITION_PLACE_NUMS:[0-9\,]+]])
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_partition_place_nums
+ // CHECK-SAME: (0)=([[PARTITION_PLACE_NUMS]])
+
+ // CHECK: {{^}}[[MASTER_ID]]: sched_getcpu()=[[CPU_ID:[0-9]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_proc_id()=[[CPU_ID]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: omp_get_num_procs()=[[NUM_PROCS:[-]?[0-9]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_num_procs()=[[NUM_PROCS]]
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/misc/control_tool.c b/final/runtime/test/ompt/misc/control_tool.c
new file mode 100644
index 0000000..7995614
--- /dev/null
+++ b/final/runtime/test/ompt/misc/control_tool.c
@@ -0,0 +1,30 @@
+// RUN: %libomp-compile-and-run | FileCheck %s
+// REQUIRES: ompt
+// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
+// XFAIL: powerpc64le, ppc64le
+#define TEST_NEED_PRINT_FRAME_FROM_OUTLINED_FN
+#include "callback.h"
+#include <omp.h>
+
+int main()
+{
+ #pragma omp parallel num_threads(1)
+ {
+ print_frame_from_outlined_fn(1);
+ print_frame(0);
+ omp_control_tool(omp_control_tool_flush, 1, NULL);
+ print_current_address(0);
+ }
+
+ // Check if libomp supports the callbacks for this test.
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_control_tool'
+
+ // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: __builtin_frame_address({{.}})=[[EXIT_FRAME:0x[0-f]*]]
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[REENTER_FRAME:0x[0-f]*]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_control_tool: command=3, modifier=1, arg=[[NULL]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]*]], current_task_frame.exit=[[EXIT_FRAME]], current_task_frame.reenter={{0x[0-f]*}}
+ // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/misc/control_tool_no_ompt_support.c b/final/runtime/test/ompt/misc/control_tool_no_ompt_support.c
new file mode 100644
index 0000000..23daf8b
--- /dev/null
+++ b/final/runtime/test/ompt/misc/control_tool_no_ompt_support.c
@@ -0,0 +1,15 @@
+// RUN: %libomp-compile-and-run
+
+// REQUIRES: openmp-5.0
+
+#include <omp.h>
+
+int main()
+{
+ #pragma omp parallel num_threads(1)
+ {
+ omp_control_tool(omp_control_tool_flush, 1, NULL);
+ }
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/misc/interoperability.cpp b/final/runtime/test/ompt/misc/interoperability.cpp
new file mode 100644
index 0000000..b07814e
--- /dev/null
+++ b/final/runtime/test/ompt/misc/interoperability.cpp
@@ -0,0 +1,119 @@
+// RUN: %libomp-cxx-compile-and-run | %sort-threads | FileCheck %s
+// REQUIRES: ompt
+
+#include <iostream>
+#include <thread>
+#if !defined(__NetBSD__)
+#include <alloca.h>
+#else
+#include <cstdlib>
+#endif
+
+#include "callback.h"
+#include "omp.h"
+
+int condition = 0;
+
+void f() {
+ // Call OpenMP API function to force initialization of OMPT.
+ // (omp_get_thread_num() does not work because it just returns 0 if the
+ // runtime isn't initialized yet...)
+ omp_get_num_threads();
+
+ // Call alloca() to force availability of frame pointer
+ void *p = alloca(0);
+
+ OMPT_SIGNAL(condition);
+ // Wait for both initial threads to arrive that will eventually become the
+ // master threads in the following parallel region.
+ OMPT_WAIT(condition, 2);
+
+#pragma omp parallel num_threads(2)
+ {
+ // Wait for all threads to arrive so that no worker thread can be reused...
+ OMPT_SIGNAL(condition);
+ OMPT_WAIT(condition, 6);
+ }
+}
+
+int main() {
+ std::thread t1(f);
+ std::thread t2(f);
+ t1.join();
+ t2.join();
+}
+
+// Check if libomp supports the callbacks for this test.
+// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
+// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule'
+// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'
+// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'
+// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
+// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin'
+
+// CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+
+// first master thread
+// CHECK: {{^}}[[MASTER_ID_1:[0-9]+]]: ompt_event_thread_begin:
+// CHECK-SAME: thread_type=ompt_thread_initial=1, thread_id=[[MASTER_ID_1]]
+
+// CHECK: {{^}}[[MASTER_ID_1]]: ompt_event_task_create: parent_task_id=0
+// CHECK-SAME: parent_task_frame.exit=[[NULL]]
+// CHECK-SAME: parent_task_frame.reenter=[[NULL]]
+// CHECK-SAME: new_task_id=[[PARENT_TASK_ID_1:[0-9]+]]
+// CHECK-SAME: codeptr_ra=[[NULL]], task_type=ompt_task_initial=1
+// CHECK-SAME: has_dependences=no
+
+// CHECK: {{^}}[[MASTER_ID_1]]: ompt_event_parallel_begin:
+// CHECK-SAME: parent_task_id=[[PARENT_TASK_ID_1]]
+// CHECK-SAME: parent_task_frame.exit=[[NULL]]
+// CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}
+// CHECK-SAME: parallel_id=[[PARALLEL_ID_1:[0-9]+]], requested_team_size=2
+// CHECK-SAME: codeptr_ra=0x{{[0-f]+}}, invoker={{.*}}
+
+// CHECK: {{^}}[[MASTER_ID_1]]: ompt_event_parallel_end:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID_1]], task_id=[[PARENT_TASK_ID_1]]
+// CHECK-SAME: invoker={{[0-9]+}}
+
+// CHECK: {{^}}[[MASTER_ID_1]]: ompt_event_thread_end:
+// CHECK-SAME: thread_id=[[MASTER_ID_1]]
+
+// second master thread
+// CHECK: {{^}}[[MASTER_ID_2:[0-9]+]]: ompt_event_thread_begin:
+// CHECK-SAME: thread_type=ompt_thread_initial=1, thread_id=[[MASTER_ID_2]]
+
+// CHECK: {{^}}[[MASTER_ID_2]]: ompt_event_task_create: parent_task_id=0
+// CHECK-SAME: parent_task_frame.exit=[[NULL]]
+// CHECK-SAME: parent_task_frame.reenter=[[NULL]]
+// CHECK-SAME: new_task_id=[[PARENT_TASK_ID_2:[0-9]+]]
+// CHECK-SAME: codeptr_ra=[[NULL]], task_type=ompt_task_initial=1
+// CHECK-SAME: has_dependences=no
+
+// CHECK: {{^}}[[MASTER_ID_2]]: ompt_event_parallel_begin:
+// CHECK-SAME: parent_task_id=[[PARENT_TASK_ID_2]]
+// CHECK-SAME: parent_task_frame.exit=[[NULL]]
+// CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}
+// CHECK-SAME: parallel_id=[[PARALLEL_ID_2:[0-9]+]]
+// CHECK-SAME: requested_team_size=2, codeptr_ra=0x{{[0-f]+}}
+// CHECK-SAME: invoker={{.*}}
+
+// CHECK: {{^}}[[MASTER_ID_2]]: ompt_event_parallel_end:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID_2]], task_id=[[PARENT_TASK_ID_2]]
+// CHECK-SAME: invoker={{[0-9]+}}
+
+// CHECK: {{^}}[[MASTER_ID_2]]: ompt_event_thread_end:
+// CHECK-SAME: thread_id=[[MASTER_ID_2]]
+
+// first worker thread
+// CHECK: {{^}}[[THREAD_ID_1:[0-9]+]]: ompt_event_thread_begin:
+// CHECK-SAME: thread_type=ompt_thread_worker=2, thread_id=[[THREAD_ID_1]]
+
+// CHECK: {{^}}[[THREAD_ID_1]]: ompt_event_thread_end:
+// CHECK-SAME: thread_id=[[THREAD_ID_1]]
+
+// second worker thread
+// CHECK: {{^}}[[THREAD_ID_2:[0-9]+]]: ompt_event_thread_begin:
+// CHECK-SAME: thread_type=ompt_thread_worker=2, thread_id=[[THREAD_ID_2]]
+
+// CHECK: {{^}}[[THREAD_ID_2]]: ompt_event_thread_end:
+// CHECK-SAME: thread_id=[[THREAD_ID_2]]
diff --git a/final/runtime/test/ompt/misc/threads.c b/final/runtime/test/ompt/misc/threads.c
new file mode 100644
index 0000000..4a0fc6f
--- /dev/null
+++ b/final/runtime/test/ompt/misc/threads.c
@@ -0,0 +1,34 @@
+// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
+// REQUIRES: ompt
+#include "callback.h"
+#include <omp.h>
+
+int main() {
+ int x = 0;
+#pragma omp parallel num_threads(4)
+ {
+#pragma omp atomic
+ x++;
+ }
+
+ // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_thread_begin:
+ // CHECK-SAME: thread_type=ompt_thread_initial=1, thread_id=[[MASTER_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_thread_end:
+ // CHECK-SAME: thread_id=[[MASTER_ID]]
+ // CHECK: {{^}}[[WORKER_ID1:[0-9]+]]: ompt_event_thread_begin:
+ // CHECK-SAME: thread_type=ompt_thread_worker=2, thread_id=[[WORKER_ID1]]
+ // CHECK: {{^}}[[WORKER_ID1]]: ompt_event_thread_end:
+ // CHECK-SAME: thread_id=[[WORKER_ID1]]
+ // CHECK: {{^}}[[WORKER_ID2:[0-9]+]]: ompt_event_thread_begin:
+ // CHECK-SAME: thread_type=ompt_thread_worker=2, thread_id=[[WORKER_ID2]]
+ // CHECK: {{^}}[[WORKER_ID2]]: ompt_event_thread_end:
+ // CHECK-SAME: thread_id=[[WORKER_ID2]]
+ // CHECK: {{^}}[[WORKER_ID3:[0-9]+]]: ompt_event_thread_begin:
+ // CHECK-SAME: thread_type=ompt_thread_worker=2, thread_id=[[WORKER_ID3]]
+ // CHECK: {{^}}[[WORKER_ID3]]: ompt_event_thread_end:
+ // CHECK-SAME: thread_id=[[WORKER_ID3]]
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/misc/threads_nested.c b/final/runtime/test/ompt/misc/threads_nested.c
new file mode 100644
index 0000000..0d38dcf
--- /dev/null
+++ b/final/runtime/test/ompt/misc/threads_nested.c
@@ -0,0 +1,40 @@
+// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
+// REQUIRES: ompt
+#include "callback.h"
+#include <omp.h>
+
+int main() {
+
+ int condition = 0;
+ int x = 0;
+ omp_set_nested(1);
+#pragma omp parallel num_threads(2)
+ {
+#pragma omp parallel num_threads(2)
+ {
+ OMPT_SIGNAL(condition);
+ OMPT_WAIT(condition, 4);
+ }
+ }
+
+ // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_thread_begin:
+ // CHECK-SAME: thread_type=ompt_thread_initial=1, thread_id=[[MASTER_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_thread_end:
+ // CHECK-SAME: thread_id=[[MASTER_ID]]
+ // CHECK: {{^}}[[WORKER_ID1:[0-9]+]]: ompt_event_thread_begin:
+ // CHECK-SAME: thread_type=ompt_thread_worker=2, thread_id=[[WORKER_ID1]]
+ // CHECK: {{^}}[[WORKER_ID1]]: ompt_event_thread_end:
+ // CHECK-SAME: thread_id=[[WORKER_ID1]]
+ // CHECK: {{^}}[[WORKER_ID2:[0-9]+]]: ompt_event_thread_begin:
+ // CHECK-SAME: thread_type=ompt_thread_worker=2, thread_id=[[WORKER_ID2]]
+ // CHECK: {{^}}[[WORKER_ID2]]: ompt_event_thread_end:
+ // CHECK-SAME: thread_id=[[WORKER_ID2]]
+ // CHECK: {{^}}[[WORKER_ID3:[0-9]+]]: ompt_event_thread_begin:
+ // CHECK-SAME: thread_type=ompt_thread_worker=2, thread_id=[[WORKER_ID3]]
+ // CHECK: {{^}}[[WORKER_ID3]]: ompt_event_thread_end:
+ // CHECK-SAME: thread_id=[[WORKER_ID3]]
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/misc/unset_callback.c b/final/runtime/test/ompt/misc/unset_callback.c
new file mode 100644
index 0000000..9074ad3
--- /dev/null
+++ b/final/runtime/test/ompt/misc/unset_callback.c
@@ -0,0 +1,29 @@
+// RUN: %libomp-compile-and-run | FileCheck %s
+// REQUIRES: ompt
+#include "callback.h"
+#include <omp.h>
+
+int main()
+{
+ #pragma omp parallel num_threads(1)
+ {
+
+ }
+ ompt_set_callback(ompt_callback_parallel_begin, NULL);
+ #pragma omp parallel num_threads(1)
+ {
+
+ }
+
+ // Check if libomp supports the callbacks for this test.
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_idle'
+
+ // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_parallel_begin:
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_parallel_end:
+ // CHECK-NOT: {{^}}[[THREAD_ID]]: ompt_event_parallel_begin:
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_parallel_end:
+
+ return 0;
+}