aboutsummaryrefslogtreecommitdiff
path: root/final/runtime/test/ompt/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'final/runtime/test/ompt/tasks')
-rw-r--r--final/runtime/test/ompt/tasks/dependences.c61
-rw-r--r--final/runtime/test/ompt/tasks/explicit_task.c102
-rw-r--r--final/runtime/test/ompt/tasks/serialized.c154
-rw-r--r--final/runtime/test/ompt/tasks/task_in_joinbarrier.c91
-rw-r--r--final/runtime/test/ompt/tasks/task_types.c222
-rw-r--r--final/runtime/test/ompt/tasks/task_types_serialized.c113
-rw-r--r--final/runtime/test/ompt/tasks/taskloop.c81
-rw-r--r--final/runtime/test/ompt/tasks/taskyield.c62
-rw-r--r--final/runtime/test/ompt/tasks/untied_task.c108
9 files changed, 994 insertions, 0 deletions
diff --git a/final/runtime/test/ompt/tasks/dependences.c b/final/runtime/test/ompt/tasks/dependences.c
new file mode 100644
index 0000000..57b61f9
--- /dev/null
+++ b/final/runtime/test/ompt/tasks/dependences.c
@@ -0,0 +1,61 @@
+// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
+// REQUIRES: ompt
+// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
+
+#include "callback.h"
+#include <omp.h>
+#include <math.h>
+#include <unistd.h>
+
+int main()
+{
+ int x = 0;
+ #pragma omp parallel num_threads(2)
+ {
+ #pragma omp master
+ {
+ print_ids(0);
+ #pragma omp task depend(out:x)
+ {
+ x++;
+ delay(100);
+ }
+ print_fuzzy_address(1);
+ print_ids(0);
+
+ #pragma omp task depend(in:x)
+ {
+ x = -1;
+ }
+ print_ids(0);
+ }
+ }
+
+ x++;
+
+
+ // 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_dependences'
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_dependence'
+
+ // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
+
+ // make sure initial data pointers are null
+ // CHECK-NOT: 0: new_task_data initially not null
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT:0x[0-f]+]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]], parent_task_frame.reenter={{0x[0-f]+}}, new_task_id=[[FIRST_TASK:[0-f]+]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, task_type=ompt_task_explicit=4, has_dependences=yes
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_dependences: task_id=[[FIRST_TASK]], deps={{0x[0-f]+}}, ndeps=1
+ // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]], parent_task_frame.reenter={{0x[0-f]+}}, new_task_id=[[SECOND_TASK:[0-f]+]], codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit=4, has_dependences=yes
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_dependences: task_id=[[SECOND_TASK]], deps={{0x[0-f]+}}, ndeps=1
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_dependence_pair: first_task_id=[[FIRST_TASK]], second_task_id=[[SECOND_TASK]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/tasks/explicit_task.c b/final/runtime/test/ompt/tasks/explicit_task.c
new file mode 100644
index 0000000..65bc1b2
--- /dev/null
+++ b/final/runtime/test/ompt/tasks/explicit_task.c
@@ -0,0 +1,102 @@
+// RUN: %libomp-compile-and-run | %sort-threads | tee %s.out | FileCheck %s
+// REQUIRES: ompt
+// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
+#define TEST_NEED_PRINT_FRAME_FROM_OUTLINED_FN
+#include "callback.h"
+#include <omp.h>
+
+int main()
+{
+ int condition=0;
+ omp_set_nested(0);
+ print_frame(0);
+ #pragma omp parallel num_threads(2)
+ {
+ print_frame_from_outlined_fn(1);
+ print_ids(0);
+ print_ids(1);
+ print_frame(0);
+ #pragma omp master
+ {
+ print_ids(0);
+ #pragma omp task shared(condition)
+ {
+ OMPT_SIGNAL(condition);
+ print_frame(1);
+ print_ids(0);
+ print_ids(1);
+ print_ids(2);
+ }
+ print_fuzzy_address(1);
+ OMPT_WAIT(condition,1);
+ print_ids(0);
+ }
+ #pragma omp barrier
+ print_ids(0);
+ }
+
+
+ // 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_mutex_acquire'
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
+
+
+ // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
+
+ // make sure initial data pointers are null
+ // CHECK-NOT: 0: new_task_data initially not null
+
+ // CHECK--doesnotwork: {{^}}[[MASTER_ID:[0-9]+]]: __builtin_frame_address(0)=[[MAIN_REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=0x{{[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=2, codeptr_ra=0x{{[0-f]+}}, invoker=[[PARALLEL_INVOKER:[0-9]+]]
+ // nested parallel masters
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address({{.}})=[[EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID:[0-9]+]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // <- ompt_event_task_create would be expected here
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[IMPLICIT_TASK_ID]], parent_task_frame.exit=[[EXIT]], parent_task_frame.reenter=0x{{[0-f]+}}, new_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
+ // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // explicit barrier after master
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // implicit barrier parallel
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+
+ // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address({{.}})=[[EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address(0)=[[REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=0x{{[0-f]+}}
+ // this is expected to come earlier and at MASTER:
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[IMPLICIT_TASK_ID]], second_task_id=[[TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address(1)=[[TASK_EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], exit_frame=[[TASK_EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 1: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[THREAD_ID]]: task level 2: parallel_id=[[IMPLICIT_PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[TASK_ID]], second_task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_end: task_id=[[TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+
+
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/tasks/serialized.c b/final/runtime/test/ompt/tasks/serialized.c
new file mode 100644
index 0000000..b1ef45d
--- /dev/null
+++ b/final/runtime/test/ompt/tasks/serialized.c
@@ -0,0 +1,154 @@
+// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
+// REQUIRES: ompt
+// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
+#define TEST_NEED_PRINT_FRAME_FROM_OUTLINED_FN
+#include "callback.h"
+#include <omp.h>
+#include <math.h>
+
+int main() {
+ omp_set_nested(0);
+ print_frame(0);
+#pragma omp parallel num_threads(2)
+ {
+ print_frame_from_outlined_fn(1);
+ print_ids(0);
+ print_ids(1);
+ print_frame(0);
+#pragma omp master
+ {
+ print_ids(0);
+ void *creator_frame = get_frame_address(0);
+ int t = (int)sin(0.1);
+#pragma omp task if (t)
+ {
+ void *task_frame = get_frame_address(0);
+ if (creator_frame == task_frame) {
+ // Assume this code was inlined which the compiler is allowed to do.
+ print_frame(0);
+ } else {
+ // The exit frame must be our parent!
+ print_frame_from_outlined_fn(1);
+ }
+ print_ids(0);
+ print_ids(1);
+ print_ids(2);
+ }
+ print_fuzzy_address(1);
+ print_ids(0);
+ }
+ print_ids(0);
+ }
+
+ // Check if libomp supports the callbacks for this test.
+ // CHECK-NOT: {{^}}0: Could not register callback
+
+ // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
+
+ // make sure initial data pointers are null
+ // CHECK-NOT: 0: new_task_data initially not null
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_create
+ // CHECK-SAME: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[NULL]]
+ // CHECK-SAME: parent_task_frame.reenter=[[NULL]]
+ // CHECK-SAME: new_task_id={{[0-9]+}}, codeptr_ra=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_initial=1, has_dependences=no
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)
+ // CHECK-SAME: =[[MAIN_REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin
+ // CHECK-SAME: parent_task_id=[[PARENT_TASK_ID:[0-9]+]]
+ // CHECK-SAME: parent_task_frame.exit=[[NULL]]
+ // CHECK-SAME: parent_task_frame.reenter=0x{{[0-f]+}}
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=2
+ // CHECK-SAME: codeptr_ra=0x{{[0-f]+}}, invoker={{[0-9]+}}
+
+ // nested parallel masters
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address
+ // CHECK-SAME: =[[EXIT:0x[0-f]+]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK-SAME: exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: task level 1
+ // CHECK-SAME: parallel_id=[[IMPLICIT_PARALLEL_ID:[0-9]+]]
+ // CHECK-SAME: task_id=[[PARENT_TASK_ID]],
+ // CHECK-SAME: exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create
+ // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK-SAME: parent_task_frame.exit=[[EXIT]]
+ // CHECK-SAME: parent_task_frame.reenter=0x{{[0-f]+}}
+ // CHECK-SAME: new_task_id=[[TASK_ID:[0-9]+]]
+ // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_schedule:
+ // CHECK-SAME: first_task_id=[[IMPLICIT_TASK_ID]], second_task_id=[[TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address
+ // CHECK-SAME: =[[TASK_EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]]
+ // CHECK-SAME: exit_frame=[[TASK_EXIT]], reenter_frame=[[NULL]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: task level 1
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK-SAME: exit_frame=[[EXIT]], reenter_frame=0x{{[0-f]+}}
+
+ // CHECK: {{^}}[[MASTER_ID]]: task level 2
+ // CHECK-SAME: parallel_id=[[IMPLICIT_PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[PARENT_TASK_ID]]
+ // CHECK-SAME: exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_schedule
+ // CHECK-SAME: first_task_id=[[TASK_ID]], second_task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_end: task_id=[[TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK-SAME: exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+
+ // implicit barrier parallel
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK-SAME: exit_frame=[[NULL]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end
+ // parallel_id is 0 because the region ended in the barrier!
+ // CHECK-SAME: parallel_id=0, task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end
+ // CHECK-SAME: parallel_id=0, task_id=[[IMPLICIT_TASK_ID]]
+
+ // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address
+ // CHECK-SAME: =[[EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK-SAME: exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 1
+ // CHECK-SAME: parallel_id=[[IMPLICIT_PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[PARENT_TASK_ID]]
+ // CHECK-SAME: exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address(0)={{0x[0-f]+}}
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK-SAME: exit_frame=[[NULL]], reenter_frame=[[NULL]]
+ // parallel_id is 0 because the region ended in the barrier!
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end
+ // CHECK-SAME: parallel_id=0, task_id=[[IMPLICIT_TASK_ID]]
+
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end
+ // CHECK-SAME: parallel_id=0, task_id=[[IMPLICIT_TASK_ID]]
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/tasks/task_in_joinbarrier.c b/final/runtime/test/ompt/tasks/task_in_joinbarrier.c
new file mode 100644
index 0000000..8228add
--- /dev/null
+++ b/final/runtime/test/ompt/tasks/task_in_joinbarrier.c
@@ -0,0 +1,91 @@
+// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
+// REQUIRES: ompt
+#define TEST_NEED_PRINT_FRAME_FROM_OUTLINED_FN
+#include "callback.h"
+#include <omp.h>
+
+int main()
+{
+ int condition=0;
+ omp_set_nested(0);
+ print_frame(0);
+ #pragma omp parallel num_threads(2)
+ {
+ print_frame_from_outlined_fn(1);
+ print_ids(0);
+ print_ids(1);
+ print_frame(0);
+ #pragma omp master
+ {
+ print_ids(0);
+ #pragma omp task shared(condition)
+ {
+ OMPT_SIGNAL(condition);
+ print_frame(1);
+ print_ids(0);
+ print_ids(1);
+ print_ids(2);
+ }
+ OMPT_WAIT(condition,1);
+ print_ids(0);
+ }
+ print_ids(0);
+ }
+
+
+ // 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_mutex_acquire'
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
+
+
+ // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
+
+ // make sure initial data pointers are null
+ // CHECK-NOT: 0: new_task_data initially not null
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: __builtin_frame_address(0)=[[MAIN_REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=0x{{[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=2, codeptr_ra=0x{{[0-f]+}}, invoker=[[PARALLEL_INVOKER:[0-9]+]]
+ // nested parallel masters
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address({{.}})=[[EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID:[0-9]+]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // <- ompt_event_task_create would be expected here
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[IMPLICIT_TASK_ID]], parent_task_frame.exit=[[EXIT]], parent_task_frame.reenter=0x{{[0-f]+}}, new_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[TASK_FUNCTION:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // implicit barrier parallel
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+
+ // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address({{.}})=[[EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address(0)=[[REENTER:0x[0-f]+]]
+ // implicit barrier parallel
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[IMPLICIT_TASK_ID]], second_task_id=[[TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address(1)=[[TASK_EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], exit_frame=[[TASK_EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 1: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 2: parallel_id=[[IMPLICIT_PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[TASK_ID]], second_task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_end: task_id=[[TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+
+
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/tasks/task_types.c b/final/runtime/test/ompt/tasks/task_types.c
new file mode 100644
index 0000000..40ceb2d
--- /dev/null
+++ b/final/runtime/test/ompt/tasks/task_types.c
@@ -0,0 +1,222 @@
+// RUN: %libomp-compile-and-run | FileCheck %s
+// REQUIRES: ompt
+#include "callback.h"
+#include <omp.h>
+#include <math.h>
+
+int main() {
+ //initialize the OpenMP runtime
+ omp_get_num_threads();
+
+ // initial task
+ print_ids(0);
+
+ int x;
+// implicit task
+#pragma omp parallel num_threads(1)
+ {
+ print_ids(0);
+ x++;
+ }
+
+#pragma omp parallel num_threads(2)
+ {
+// explicit task
+#pragma omp single
+#pragma omp task
+ {
+ print_ids(0);
+ x++;
+ }
+// explicit task with undeferred
+#pragma omp single
+#pragma omp task if (0)
+ {
+ print_ids(0);
+ x++;
+ }
+
+// explicit task with untied
+#pragma omp single
+#pragma omp task untied
+ {
+ // Output of thread_id is needed to know on which thread task is executed
+ printf("%" PRIu64 ": explicit_untied\n", ompt_get_thread_data()->value);
+ print_ids(0);
+ print_frame(1);
+ x++;
+#pragma omp taskyield
+ printf("%" PRIu64 ": explicit_untied(2)\n",
+ ompt_get_thread_data()->value);
+ print_ids(0);
+ print_frame(1);
+ x++;
+#pragma omp taskwait
+ printf("%" PRIu64 ": explicit_untied(3)\n",
+ ompt_get_thread_data()->value);
+ print_ids(0);
+ print_frame(1);
+ x++;
+ }
+// explicit task with final
+#pragma omp single
+#pragma omp task final(1)
+ {
+ print_ids(0);
+ x++;
+// nested explicit task with final and undeferred
+#pragma omp task
+ {
+ print_ids(0);
+ x++;
+ }
+ }
+
+ // Mergeable task test deactivated for now
+ // explicit task with mergeable
+ /*
+ #pragma omp task mergeable if((int)sin(0))
+ {
+ print_ids(0);
+ x++;
+ }
+ */
+
+ // TODO: merged task
+ }
+
+ // Check if libomp supports the callbacks for this test.
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
+
+ // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: 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=[[INITIAL_TASK_ID:[0-9]+]], codeptr_ra=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_initial=1, has_dependences=no
+
+ // CHECK-NOT: 0: parallel_data initially not null
+
+ // initial task
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id={{[0-9]+}}
+ // CHECK-SAME: task_id=[[INITIAL_TASK_ID]], exit_frame=[[NULL]]
+ // CHECK-SAME: reenter_frame=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_initial=1, thread_num=0
+
+ // implicit task
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id={{[0-9]+}}
+ // CHECK-SAME: task_id={{[0-9]+}}, exit_frame={{0x[0-f]+}}
+ // CHECK-SAME: reenter_frame=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_implicit|ompt_task_undeferred=134217730
+ // CHECK-SAME: thread_num=0
+
+ // explicit task
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}
+ // CHECK-SAME: parent_task_frame.exit={{0x[0-f]+}}
+ // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}
+ // CHECK-SAME: new_task_id=[[EXPLICIT_TASK_ID:[0-9]+]]
+ // CHECK-SAME: codeptr_ra={{0x[0-f]+}}
+ // CHECK-SAME: task_type=ompt_task_explicit=4
+ // CHECK-SAME: has_dependences=no
+
+ // CHECK: [[THREAD_ID_1:[0-9]+]]: ompt_event_task_schedule:
+ // CHECK-SAME: second_task_id=[[EXPLICIT_TASK_ID]]
+
+ // CHECK: [[THREAD_ID_1]]: task level 0: parallel_id=[[PARALLEL_ID:[0-9]+]]
+ // CHECK-SAME: task_id=[[EXPLICIT_TASK_ID]], exit_frame={{0x[0-f]+}}
+ // CHECK-SAME: reenter_frame=[[NULL]], task_type=ompt_task_explicit=4
+ // CHECK-SAME: thread_num={{[01]}}
+
+ // explicit task with undeferred
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}
+ // CHECK-SAME: parent_task_frame.exit={{0x[0-f]+}}
+ // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}
+ // CHECK-SAME: new_task_id=[[EXPLICIT_UNDEFERRED_TASK_ID:[0-9]+]]
+ // CHECK-SAME: codeptr_ra={{0x[0-f]+}}
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732
+ // CHECK-SAME: has_dependences=no
+
+ // CHECK: [[THREAD_ID_2:[0-9]+]]: ompt_event_task_schedule:
+ // CHECK-SAME: second_task_id=[[EXPLICIT_UNDEFERRED_TASK_ID]]
+
+ // CHECK: [[THREAD_ID_2]]: task level 0: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[EXPLICIT_UNDEFERRED_TASK_ID]]
+ // CHECK-SAME: exit_frame={{0x[0-f]+}}, reenter_frame=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732
+ // CHECK-SAME: thread_num={{[01]}}
+
+ // explicit task with untied
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}
+ // CHECK-SAME: parent_task_frame.exit={{0x[0-f]+}}
+ // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}
+ // CHECK-SAME: new_task_id=[[EXPLICIT_UNTIED_TASK_ID:[0-9]+]]
+ // CHECK-SAME: codeptr_ra={{0x[0-f]+}}
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_untied=268435460
+ // CHECK-SAME: has_dependences=no
+
+ // Here the thread_id cannot be taken from a schedule event as there
+ // may be multiple of those
+ // CHECK: [[THREAD_ID_3:[0-9]+]]: explicit_untied
+ // CHECK: [[THREAD_ID_3]]: task level 0: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[EXPLICIT_UNTIED_TASK_ID]]
+ // CHECK-SAME: exit_frame={{0x[0-f]+}}, reenter_frame=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_untied=268435460
+ // CHECK-SAME: thread_num={{[01]}}
+
+ // after taskyield
+ // CHECK: [[THREAD_ID_3_2:[0-9]+]]: explicit_untied(2)
+ // CHECK: [[THREAD_ID_3_2]]: task level 0: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[EXPLICIT_UNTIED_TASK_ID]]
+ // CHECK-SAME: exit_frame={{0x[0-f]+}}, reenter_frame=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_untied=268435460
+ // CHECK-SAME: thread_num={{[01]}}
+
+ // after taskwait
+ // CHECK: [[THREAD_ID_3_3:[0-9]+]]: explicit_untied(3)
+ // CHECK: [[THREAD_ID_3_3]]: task level 0: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[EXPLICIT_UNTIED_TASK_ID]]
+ // CHECK-SAME: exit_frame={{0x[0-f]+}}, reenter_frame=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_untied=268435460
+ // CHECK-SAME: thread_num={{[01]}}
+
+ // explicit task with final
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}
+ // CHECK-SAME: parent_task_frame.exit={{0x[0-f]+}}
+ // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}
+ // CHECK-SAME: new_task_id=[[EXPLICIT_FINAL_TASK_ID:[0-9]+]]
+ // CHECK-SAME: codeptr_ra={{0x[0-f]+}}
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_final=536870916
+ // CHECK-SAME: has_dependences=no
+
+ // CHECK: [[THREAD_ID_4:[0-9]+]]: ompt_event_task_schedule:
+ // CHECK-SAME: second_task_id=[[EXPLICIT_FINAL_TASK_ID]]
+
+ // CHECK: [[THREAD_ID_4]]: task level 0: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[EXPLICIT_FINAL_TASK_ID]]
+ // CHECK-SAME: exit_frame={{0x[0-f]+}}, reenter_frame=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_final=536870916
+ // CHECK-SAME: thread_num={{[01]}}
+
+ // nested explicit task with final and undeferred
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}
+ // CHECK-SAME: parent_task_frame.exit={{0x[0-f]+}}
+ // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}
+ // CHECK-SAME: new_task_id=[[NESTED_FINAL_UNDEFERRED_TASK_ID:[0-9]+]]
+ // CHECK-SAME: codeptr_ra={{0x[0-f]+}}
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred
+ // CHECK-SAME:|ompt_task_final=671088644
+ // CHECK-SAME: has_dependences=no
+
+ // CHECK: [[THREAD_ID_5:[0-9]+]]: ompt_event_task_schedule:
+ // CHECK-SAME: second_task_id=[[NESTED_FINAL_UNDEFERRED_TASK_ID]]
+
+ // CHECK: [[THREAD_ID_5]]: task level 0: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[NESTED_FINAL_UNDEFERRED_TASK_ID]]
+ // CHECK-SAME: exit_frame={{0x[0-f]+}}, reenter_frame=[[NULL]]
+ // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred
+ // CHECK-SAME:|ompt_task_final=671088644
+ // CHECK-SAME: thread_num={{[01]}}
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/tasks/task_types_serialized.c b/final/runtime/test/ompt/tasks/task_types_serialized.c
new file mode 100644
index 0000000..7726f5b
--- /dev/null
+++ b/final/runtime/test/ompt/tasks/task_types_serialized.c
@@ -0,0 +1,113 @@
+// RUN: %libomp-compile-and-run | FileCheck %s
+// REQUIRES: ompt
+
+#include "callback.h"
+#include <omp.h>
+
+__attribute__ ((noinline)) // workaround for bug in icc
+void print_task_type(int id)
+{
+ #pragma omp critical
+ {
+ int task_type;
+ char buffer[2048];
+ ompt_get_task_info(0, &task_type, NULL, NULL, NULL, NULL);
+ format_task_type(task_type, buffer);
+ printf("%" PRIu64 ": id=%d task_type=%s=%d\n", ompt_get_thread_data()->value, id, buffer, task_type);
+ }
+};
+
+int main()
+{
+ //initial task
+ print_task_type(0);
+
+ int x;
+ //implicit task
+ #pragma omp parallel num_threads(1)
+ {
+ print_task_type(1);
+ x++;
+ }
+
+ #pragma omp parallel num_threads(1)
+ #pragma omp master
+ {
+ //explicit task
+ #pragma omp task
+ {
+ print_task_type(2);
+ x++;
+ }
+
+ //explicit task with undeferred
+ #pragma omp task if(0)
+ {
+ print_task_type(3);
+ x++;
+ }
+
+ //explicit task with untied
+ #pragma omp task untied
+ {
+ print_task_type(4);
+ x++;
+ }
+
+ //explicit task with final
+ #pragma omp task final(1)
+ {
+ print_task_type(5);
+ x++;
+ //nested explicit task with final and undeferred
+ #pragma omp task
+ {
+ print_task_type(6);
+ x++;
+ }
+ }
+
+/*
+ //TODO:not working
+ //explicit task with mergeable
+ #pragma omp task mergeable
+ {
+ print_task_type(7);
+ x++;
+ }
+*/
+
+ //TODO: merged task
+ }
+
+
+ // Check if libomp supports the callbacks for this test.
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
+
+
+ // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_create: parent_task_id=0, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=[[NULL]], new_task_id={{[0-9]+}}, codeptr_ra=[[NULL]], task_type=ompt_task_initial=1, has_dependences=no
+ // CHECK: {{^}}[[MASTER_ID]]: id=0 task_type=ompt_task_initial=1
+ // CHECK: {{^}}[[MASTER_ID]]: id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730
+
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_undeferred=134217732, has_dependences=no
+ // CHECK: {{^[0-9]+}}: id=2 task_type=ompt_task_explicit|ompt_task_undeferred=134217732
+
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_undeferred=134217732, has_dependences=no
+ // CHECK: {{^[0-9]+}}: id=3 task_type=ompt_task_explicit|ompt_task_undeferred=134217732
+
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_undeferred|ompt_task_untied=402653188, has_dependences=no
+ // CHECK: {{^[0-9]+}}: id=4 task_type=ompt_task_explicit|ompt_task_undeferred|ompt_task_untied=402653188
+
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_undeferred|ompt_task_final=671088644, has_dependences=no
+ // CHECK: {{^[0-9]+}}: id=5 task_type=ompt_task_explicit|ompt_task_undeferred|ompt_task_final=671088644
+
+ // CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_undeferred|ompt_task_final=671088644, has_dependences=no
+ // CHECK: {{^[0-9]+}}: id=6 task_type=ompt_task_explicit|ompt_task_undeferred|ompt_task_final=671088644
+
+ // ___CHECK: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_undeferred=134217732, has_dependences=no
+ // ___CHECK: {{^[0-9]+}}: id=7 task_type=ompt_task_explicit|ompt_task_undeferred=134217732
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/tasks/taskloop.c b/final/runtime/test/ompt/tasks/taskloop.c
new file mode 100644
index 0000000..59a47bf
--- /dev/null
+++ b/final/runtime/test/ompt/tasks/taskloop.c
@@ -0,0 +1,81 @@
+// RUN: %libomp-compile-and-run | FileCheck %s
+// RUN: %libomp-compile-and-run | FileCheck --check-prefix=TASKS %s
+// REQUIRES: ompt
+
+// These compilers don't support the taskloop construct
+// UNSUPPORTED: gcc-4, gcc-5, icc-16
+// GCC 6 has support for taskloops, but at least 6.3.0 is crashing on this test
+// UNSUPPORTED: gcc-6
+
+#include "callback.h"
+#include <omp.h>
+
+int main() {
+ unsigned int i, x;
+
+#pragma omp parallel num_threads(2)
+ {
+#pragma omp barrier
+
+#pragma omp master
+#pragma omp taskloop
+ for (i = 0; i < 5; i += 3) {
+ x++;
+ }
+ }
+ // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin:
+ // CHECK-SAME: parent_task_id={{[0-9]+}}
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]]
+ // CHECK-SAME: requested_team_size=2
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin:
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1:[0-9]+]]
+ // CHECK-SAME: team_size=2, thread_num=0
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskgroup_begin:
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID1]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskloop_begin:
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]]
+ // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]], count=2
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
+ // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]]
+ // CHECK-SAME: new_task_id=[[TASK_ID1:[0-9]+]]
+ // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS]]
+ // CHECK-SAME: task_type=ompt_task_explicit=4
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
+ // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]]
+ // CHECK-SAME: new_task_id=[[TASK_ID2:[0-9]+]]
+ // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS]]
+ // CHECK-SAME: task_type=ompt_task_explicit=4
+ // CHECK-NOT: {{^}}[[MASTER_ID]]: ompt_event_task_create:
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskloop_end:
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
+ // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]]
+ // CHECK-SAME: count=2
+ // CHECK-DAG: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_begin:
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_end:
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID1]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskgroup_end:
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID1]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=0
+ // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1]], team_size=2, thread_num=0
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end:
+ // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
+
+ // TASKS: ompt_event_task_create:{{.*}} new_task_id={{[0-9]+}}
+ // TASKS-SAME: task_type=ompt_task_initial
+ // TASKS: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_taskloop_begin:
+ // TASKS: ompt_event_task_create:{{.*}} new_task_id=[[TASK_ID1:[0-9]+]]
+ // TASKS-SAME: task_type=ompt_task_explicit
+ // TASKS-DAG: ompt_event_task_create:{{.*}} new_task_id=[[TASK_ID2:[0-9]+]]
+ // Schedule events:
+ // TASKS-DAG: {{^.*}}first_task_id={{[0-9]+}}, second_task_id=[[TASK_ID1]]
+ // TASKS-DAG: {{^.*}}first_task_id=[[TASK_ID1]], second_task_id={{[0-9]+}}
+ // TASKS-DAG: {{^.*}}first_task_id={{[0-9]+}}, second_task_id=[[TASK_ID2]]
+ // TASKS-DAG: {{^.*}}first_task_id=[[TASK_ID2]], second_task_id={{[0-9]+}}
+ // TASKS-NOT: ompt_event_task_schedule
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/tasks/taskyield.c b/final/runtime/test/ompt/tasks/taskyield.c
new file mode 100644
index 0000000..2dd0fa1
--- /dev/null
+++ b/final/runtime/test/ompt/tasks/taskyield.c
@@ -0,0 +1,62 @@
+// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
+// REQUIRES: ompt
+// Current GOMP interface implements taskyield as stub
+// XFAIL: gcc
+
+#include "callback.h"
+#include <omp.h>
+#include <unistd.h>
+
+int main()
+{
+ int condition=0, x=0;
+ #pragma omp parallel num_threads(2)
+ {
+ #pragma omp master
+ {
+ #pragma omp task shared(condition)
+ {
+ OMPT_SIGNAL(condition);
+ OMPT_WAIT(condition,2);
+ }
+ OMPT_WAIT(condition,1);
+ #pragma omp task shared(x)
+ {
+ x++;
+ }
+ printf("%" PRIu64 ": before yield\n", ompt_get_thread_data()->value);
+ #pragma omp taskyield
+ printf("%" PRIu64 ": after yield\n", ompt_get_thread_data()->value);
+ OMPT_SIGNAL(condition);
+ }
+ }
+
+
+ // 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_implicit_task'
+
+
+ // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
+
+ // make sure initial data pointers are null
+ // CHECK-NOT: 0: new_task_data initially not null
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID:[0-9]+]], team_size={{[0-9]+}}, thread_num={{[0-9]+}}
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id=[[WORKER_TASK:[0-9]+]], codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit=4, has_dependences=no
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id=[[MAIN_TASK:[0-9]+]], codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit=4, has_dependences=no
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_schedule: first_task_id=[[IMPLICIT_TASK_ID]], second_task_id=[[MAIN_TASK]], prior_task_status=ompt_task_yield=2
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_schedule: first_task_id=[[MAIN_TASK]], second_task_id=[[IMPLICIT_TASK_ID]], prior_task_status=ompt_task_complete=1
+
+ // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_task_schedule: first_task_id={{[0-9]+}}, second_task_id=[[WORKER_TASK]], prior_task_status=ompt_task_switch=7
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[WORKER_TASK]], second_task_id={{[0-9]+}}, prior_task_status=ompt_task_complete=1
+
+
+
+
+
+ return 0;
+}
diff --git a/final/runtime/test/ompt/tasks/untied_task.c b/final/runtime/test/ompt/tasks/untied_task.c
new file mode 100644
index 0000000..4ee3f11
--- /dev/null
+++ b/final/runtime/test/ompt/tasks/untied_task.c
@@ -0,0 +1,108 @@
+// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
+// REQUIRES: ompt
+#define TEST_NEED_PRINT_FRAME_FROM_OUTLINED_FN
+#include "callback.h"
+#include <omp.h>
+
+int main()
+{
+ int condition=0;
+ omp_set_nested(0);
+ print_frame(0);
+ #pragma omp parallel num_threads(2)
+ {
+ print_frame_from_outlined_fn(1);
+ print_ids(0);
+ print_ids(1);
+ print_frame(0);
+ #pragma omp master
+ {
+ print_ids(0);
+ #pragma omp task untied shared(condition)
+ {
+ OMPT_SIGNAL(condition);
+ print_frame(1);
+ print_ids(0);
+ print_ids(1);
+ print_ids(2);
+ #pragma omp task if(0)
+ {
+ print_ids(0);
+ print_ids(1);
+ print_ids(2);
+ }
+ print_ids(0);
+ print_ids(1);
+ print_ids(2);
+ }
+ OMPT_WAIT(condition,1);
+ print_ids(0);
+ }
+ #pragma omp barrier
+ print_ids(0);
+ }
+
+
+ // 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_mutex_acquire'
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
+ // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
+
+
+ // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
+
+ // make sure initial data pointers are null
+ // CHECK-NOT: 0: new_task_data initially not null
+
+ // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: __builtin_frame_address(0)=[[MAIN_REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=0x{{[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=2, codeptr_ra=0x{{[0-f]+}}, invoker=[[PARALLEL_INVOKER:[0-9]+]]
+ // nested parallel masters
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address({{.}})=[[EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID:[0-9]+]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // <- ompt_event_task_create would be expected here
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[IMPLICIT_TASK_ID]], parent_task_frame.exit=[[EXIT]], parent_task_frame.reenter=0x{{[0-f]+}}, new_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[TASK_FUNCTION:0x[0-f]+]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // explicit barrier after master
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // implicit barrier parallel
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+
+ // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address({{.}})=[[EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address(0)=[[REENTER:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=0x{{[0-f]+}}
+ // this is expected to come earlier and at MASTER:
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[IMPLICIT_TASK_ID]], second_task_id=[[TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address(1)=[[TASK_EXIT:0x[0-f]+]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], exit_frame=[[TASK_EXIT]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 1: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[THREAD_ID]]: task level 2: parallel_id=[[IMPLICIT_PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=0x{{[0-f]+}}
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[TASK_ID]], second_task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_end: task_id=[[TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+ // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+
+
+
+ return 0;
+}