1 // RUN: %libomp-compile && env OMP_CANCELLATION=true %libomp-run | %sort-threads | FileCheck %s
3 // UNSUPPORTED: clang-3, clang-4.0.0
4 // Current GOMP interface implementation does not support cancellation; icc 16 has a bug
14 #pragma omp parallel num_threads(2)
18 #pragma omp parallel num_threads(2)
24 #pragma omp task shared(condition)
26 printf("start execute task 1\n");
27 OMPT_SIGNAL(condition
);
28 OMPT_WAIT(condition
,2);
29 #pragma omp cancellation point taskgroup
30 printf("end execute task 1\n");
32 #pragma omp task shared(condition)
34 printf("start execute task 2\n");
35 OMPT_SIGNAL(condition
);
36 OMPT_WAIT(condition
,2);
37 #pragma omp cancellation point taskgroup
38 printf("end execute task 2\n");
40 #pragma omp task shared(condition)
42 printf("start execute task 3\n");
43 OMPT_SIGNAL(condition
);
44 OMPT_WAIT(condition
,2);
45 #pragma omp cancellation point taskgroup
46 printf("end execute task 3\n");
48 #pragma omp task if(0) shared(condition)
50 printf("start execute task 4\n");
51 OMPT_WAIT(condition
,1);
52 #pragma omp cancel taskgroup
53 printf("end execute task 4\n");
55 OMPT_SIGNAL(condition
);
61 // Check if libomp supports the callbacks for this test.
62 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_masked'
63 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
64 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule'
65 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_cancel'
66 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin'
68 // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
69 // 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: codeptr_ra={{0x[0-f]*}}
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
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
79 // 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]*}}
81 // 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
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]]
86 // 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]*}}