1+ // clang-format off
12// RUN: %libomp-compile && env OMP_CANCELLATION=true %libomp-run | %sort-threads | FileCheck %s
23// REQUIRES: ompt
34// UNSUPPORTED: clang-3, clang-4.0.0
45// Current GOMP interface implementation does not support cancellation; icc 16 has a bug
56// XFAIL: gcc, icc-16
7+ // clang-format on
68
79#include "callback.h"
8- #include <unistd.h>
10+ #include <unistd.h>
911#include <stdio.h>
1012
11- int main ()
12- {
13- int condition = 0 ;
14- #pragma omp parallel num_threads(2)
13+ int main () {
14+ int condition = 0 ;
15+ #pragma omp parallel num_threads(2)
1516 {}
1617
1718 print_frame (0 );
18- #pragma omp parallel num_threads(2)
19+ #pragma omp parallel num_threads(2)
1920 {
20- #pragma omp master
21+ #pragma omp master
2122 {
22- #pragma omp taskgroup
23+ #pragma omp taskgroup
2324 {
24- #pragma omp task shared(condition)
25+ #pragma omp task shared(condition)
2526 {
2627 printf ("start execute task 1\n" );
2728 OMPT_SIGNAL (condition );
28- OMPT_WAIT (condition ,2 );
29- #pragma omp cancellation point taskgroup
29+ OMPT_WAIT (condition , 2 );
30+ #pragma omp cancellation point taskgroup
3031 printf ("end execute task 1\n" );
3132 }
32- #pragma omp task shared(condition)
33+ #pragma omp task shared(condition)
3334 {
3435 printf ("start execute task 2\n" );
3536 OMPT_SIGNAL (condition );
36- OMPT_WAIT (condition ,2 );
37- #pragma omp cancellation point taskgroup
37+ OMPT_WAIT (condition , 2 );
38+ #pragma omp cancellation point taskgroup
3839 printf ("end execute task 2\n" );
3940 }
40- #pragma omp task shared(condition)
41+ #pragma omp task shared(condition)
4142 {
4243 printf ("start execute task 3\n" );
4344 OMPT_SIGNAL (condition );
44- OMPT_WAIT (condition ,2 );
45- #pragma omp cancellation point taskgroup
45+ OMPT_WAIT (condition , 2 );
46+ #pragma omp cancellation point taskgroup
4647 printf ("end execute task 3\n" );
4748 }
48- #pragma omp task if(0) shared(condition)
49+ #pragma omp task if (0) shared(condition)
4950 {
5051 printf ("start execute task 4\n" );
51- OMPT_WAIT (condition ,1 );
52- #pragma omp cancel taskgroup
52+ OMPT_WAIT (condition , 1 );
53+ #pragma omp cancel taskgroup
5354 printf ("end execute task 4\n" );
5455 }
5556 OMPT_SIGNAL (condition );
5657 }
5758 }
58- #pragma omp barrier
59+ #pragma omp barrier
5960 }
6061
62+ // clang-format off
6163 // Check if libomp supports the callbacks for this test.
6264 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_masked'
6365 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
@@ -67,24 +69,25 @@ int main()
6769
6870 // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
6971 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_masked_begin:
70- // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9 ]+]],
71- // CHECK-SAME: task_id=[[PARENT_TASK_ID:[0-9 ]+]],
72+ // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-f ]+]],
73+ // CHECK-SAME: task_id=[[PARENT_TASK_ID:[0-f ]+]],
7274 // CHECK-SAME: codeptr_ra={{(0x)?[0-f]*}}
7375
74- // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID]], parent_task_frame.exit={{(0x)?[0-f]*}}, parent_task_frame.reenter={{(0x)?[0-f]*}}, new_task_id=[[FIRST_TASK_ID:[0-9 ]+]], codeptr_ra={{(0x)?[0-f]*}}, task_type=ompt_task_explicit=4, has_dependences=no
75- // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID]], parent_task_frame.exit={{(0x)?[0-f]*}}, parent_task_frame.reenter={{(0x)?[0-f]*}}, new_task_id=[[SECOND_TASK_ID:[0-9 ]+]], codeptr_ra={{(0x)?[0-f]*}}, task_type=ompt_task_explicit=4, has_dependences=no
76- // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID]], parent_task_frame.exit={{(0x)?[0-f]*}}, parent_task_frame.reenter={{(0x)?[0-f]*}}, new_task_id=[[THIRD_TASK_ID:[0-9 ]+]], codeptr_ra={{(0x)?[0-f]*}}, task_type=ompt_task_explicit=4, has_dependences=no
76+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID]], parent_task_frame.exit={{(0x)?[0-f]*}}, parent_task_frame.reenter={{(0x)?[0-f]*}}, new_task_id=[[FIRST_TASK_ID:[0-f ]+]], codeptr_ra={{(0x)?[0-f]*}}, task_type=ompt_task_explicit=4, has_dependences=no
77+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID]], parent_task_frame.exit={{(0x)?[0-f]*}}, parent_task_frame.reenter={{(0x)?[0-f]*}}, new_task_id=[[SECOND_TASK_ID:[0-f ]+]], codeptr_ra={{(0x)?[0-f]*}}, task_type=ompt_task_explicit=4, has_dependences=no
78+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID]], parent_task_frame.exit={{(0x)?[0-f]*}}, parent_task_frame.reenter={{(0x)?[0-f]*}}, new_task_id=[[THIRD_TASK_ID:[0-f ]+]], codeptr_ra={{(0x)?[0-f]*}}, task_type=ompt_task_explicit=4, has_dependences=no
7779
78- // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID]], parent_task_frame.exit={{(0x)?[0-f]*}}, parent_task_frame.reenter={{(0x)?[0-f]*}}, new_task_id=[[CANCEL_TASK_ID:[0-9 ]+]], codeptr_ra={{(0x)?[0-f]*}}, task_type=ompt_task_explicit|ompt_task_undeferred=134217732, has_dependences=no
80+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID]], parent_task_frame.exit={{(0x)?[0-f]*}}, parent_task_frame.reenter={{(0x)?[0-f]*}}, new_task_id=[[CANCEL_TASK_ID:[0-f ]+]], codeptr_ra={{(0x)?[0-f]*}}, task_type=ompt_task_explicit|ompt_task_undeferred=134217732, has_dependences=no
7981 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_schedule: first_task_id=[[PARENT_TASK_ID]], second_task_id=[[CANCEL_TASK_ID]], prior_task_status=ompt_task_switch=7
80- // CHECK: {{^}}[[MASTER_ID]]: ompt_event_cancel: task_data =[[CANCEL_TASK_ID]], flags=ompt_cancel_taskgroup|ompt_cancel_activated=24, codeptr_ra={{(0x)?[0-f]*}}
82+ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_cancel: task_id =[[CANCEL_TASK_ID]], flags=ompt_cancel_taskgroup|ompt_cancel_activated=24, codeptr_ra={{(0x)?[0-f]*}}
8183 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_schedule: first_task_id=[[CANCEL_TASK_ID]], second_task_id=[[PARENT_TASK_ID]], prior_task_status=ompt_task_cancel=3
8284
83- // CHECK-DAG: {{^}}{{[0-9]+}}: ompt_event_cancel: task_data ={{[0-9 ]+}}, flags=ompt_cancel_taskgroup|ompt_cancel_discarded_task=72, codeptr_ra=[[NULL]]
84- // CHECK-DAG: {{^}}{{[0-9]+}}: ompt_event_cancel: task_data ={{[0-9 ]+}}, flags=ompt_cancel_taskgroup|ompt_cancel_discarded_task=72, codeptr_ra=[[NULL]]
85+ // CHECK-DAG: {{^}}{{[0-9]+}}: ompt_event_cancel: task_id ={{[0-f ]+}}, flags=ompt_cancel_taskgroup|ompt_cancel_discarded_task=72, codeptr_ra=[[NULL]]
86+ // CHECK-DAG: {{^}}{{[0-9]+}}: ompt_event_cancel: task_id ={{[0-f ]+}}, flags=ompt_cancel_taskgroup|ompt_cancel_discarded_task=72, codeptr_ra=[[NULL]]
8587
8688 // CHECK-DAG: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_thread_begin: thread_type=ompt_thread_worker=2, thread_id=[[THREAD_ID]]
87- // CHECK-DAG: {{^}}[[THREAD_ID]]: ompt_event_cancel: task_data={{[0-9]+}}, flags=ompt_cancel_taskgroup|ompt_cancel_detected=40, codeptr_ra={{(0x)?[0-f]*}}
89+ // CHECK-DAG: {{^}}[[THREAD_ID]]: ompt_event_cancel: task_id={{[0-f]+}}, flags=ompt_cancel_taskgroup|ompt_cancel_detected=40, codeptr_ra={{(0x)?[0-f]*}}
90+ // clang-format on
8891
8992 return 0 ;
9093}
0 commit comments