1 // RUN: %libomp-compile -fopenmp-version=50 && env OMP_NUM_THREADS='3' \
2 // RUN:    %libomp-run | %sort-threads | FileCheck %s
3 // REQUIRES: ompt
4 
5 // Checked gcc 10.1 still does not support detach clause on task construct.
6 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8, gcc-9, gcc-10
7 // clang supports detach clause since version 11.
8 // UNSUPPORTED: clang-10, clang-9, clang-8, clang-7
9 // icc compiler does not support detach clause.
10 // UNSUPPORTED: icc
11 
12 #include "callback.h"
13 #include <omp.h>
14 
main()15 int main() {
16 #pragma omp parallel
17 #pragma omp master
18   {
19     omp_event_handle_t event;
20 #pragma omp task detach(event) if (0)
21     { omp_fulfill_event(event); }
22 #pragma omp taskwait
23   }
24   return 0;
25 }
26 
27 // Check if libomp supports the callbacks for this test.
28 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
29 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule'
30 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'
31 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'
32 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
33 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire'
34 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
35 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
36 
37 // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
38 
39 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin:
40 // CHECK-SAME: parent_task_id=[[PARENT_TASK_ID:[0-9]+]],
41 // CHECK-SAME: parent_task_frame.exit=[[NULL]],
42 // CHECK-SAME: parent_task_frame.reenter=0x{{[0-f]+}},
43 // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]],
44 // CHECK-SAME: requested_team_size=3,
45 
46 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin:
47 // CHECK-SAME: parallel_id=[[PARALLEL_ID]],
48 // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
49 
50 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
51 // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID]],
52 // CHECK-SAME: parent_task_frame.exit=0x{{[0-f]+}},
53 // CHECK-SAME: parent_task_frame.reenter=0x{{[0-f]+}},
54 // CHECK-SAME: new_task_id=[[TASK_ID:[0-9]+]],
55 
56 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_schedule:
57 // CHECK-SAME: first_task_id=[[IMPLICIT_TASK_ID]],
58 // CHECK-SAME: second_task_id=[[TASK_ID]],
59 // CHECK-SAME: prior_task_status=ompt_task_switch=7
60 
61 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_schedule:
62 // CHECK-SAME: first_task_id=[[TASK_ID]],
63 // CHECK-SAME: second_task_id=18446744073709551615,
64 // CHECK-SAME: prior_task_status=ompt_task_early_fulfill=5
65 
66 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_schedule:
67 // CHECK-SAME: first_task_id=[[TASK_ID]],
68 // CHECK-SAME: second_task_id=[[IMPLICIT_TASK_ID]],
69 // CHECK-SAME: prior_task_status=ompt_task_complete=1
70