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