| 1 |
// clang-format off |
| 2 |
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s |
| 3 |
// REQUIRES: ompt |
| 4 |
// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 |
| 5 |
// clang-format on |
| 6 |
|
| 7 |
#include "callback.h" |
| 8 |
#include <unistd.h> |
| 9 |
#include <stdio.h> |
| 10 |
|
| 11 |
int main() { |
| 12 |
int condition = 0; |
| 13 |
int x = 0; |
| 14 |
#pragma omp parallel num_threads(2) |
| 15 |
{ |
| 16 |
#pragma omp master |
| 17 |
{ |
| 18 |
#pragma omp taskgroup |
| 19 |
{ |
| 20 |
print_current_address(1); |
| 21 |
#pragma omp task |
| 22 |
{ |
| 23 |
#pragma omp atomic |
| 24 |
x++; |
| 25 |
} |
| 26 |
} |
| 27 |
print_current_address(2); |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
// clang-format off |
| 32 |
// Check if libomp supports the callbacks for this test. |
| 33 |
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' |
| 34 |
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule' |
| 35 |
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_cancel' |
| 36 |
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin' |
| 37 |
|
| 38 |
|
| 39 |
// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] |
| 40 |
|
| 41 |
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_taskgroup_begin: parallel_id=[[PARALLEL_ID:[0-f]+]], task_id=[[TASK_ID:[0-f]+]], codeptr_ra=[[RETURN_ADDRESS:(0x)?[0-f]+]] |
| 42 |
// CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] |
| 43 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_begin: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS:(0x)?[0-f]+]] |
| 44 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS]] |
| 45 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskgroup_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS]] |
| 46 |
// CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] |
| 47 |
// clang-format on |
| 48 |
|
| 49 |
return 0; |
| 50 |
} |