| 1 |
// clang-format off |
| 2 |
// RUN: %libomp-compile-and-run | FileCheck %s |
| 3 |
// RUN: %libomp-compile-and-run | FileCheck --check-prefix=TASKS %s |
| 4 |
// REQUIRES: ompt |
| 5 |
|
| 6 |
// These compilers don't support the taskloop construct |
| 7 |
// UNSUPPORTED: gcc-4, gcc-5, icc-16 |
| 8 |
// GCC 6 has support for taskloops, but at least 6.3.0 is crashing on this test |
| 9 |
// UNSUPPORTED: gcc-6 |
| 10 |
// clang-format on |
| 11 |
|
| 12 |
#include "callback.h" |
| 13 |
#include <omp.h> |
| 14 |
|
| 15 |
int main() { |
| 16 |
unsigned int i, x; |
| 17 |
|
| 18 |
#pragma omp parallel num_threads(2) |
| 19 |
{ |
| 20 |
#pragma omp barrier |
| 21 |
|
| 22 |
#pragma omp master |
| 23 |
#pragma omp taskloop |
| 24 |
for (i = 0; i < 5; i += 3) { |
| 25 |
x++; |
| 26 |
} |
| 27 |
} |
| 28 |
// clang-format off |
| 29 |
// CHECK: 0: NULL_POINTER=[[NULL:.*$]] |
| 30 |
|
| 31 |
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: |
| 32 |
// CHECK-SAME: parent_task_id={{[0-f]+}} |
| 33 |
// CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-f]+]] |
| 34 |
// CHECK-SAME: requested_team_size=2 |
| 35 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: |
| 36 |
// CHECK-SAME: parallel_id=[[PARALLEL_ID]] |
| 37 |
// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1:[0-9]+]] |
| 38 |
// CHECK-SAME: team_size=2, thread_num=0 |
| 39 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskgroup_begin: |
| 40 |
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID1]] |
| 41 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskloop_begin: |
| 42 |
// CHECK-SAME: parallel_id=[[PARALLEL_ID]] |
| 43 |
// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1]] |
| 44 |
// CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:(0x)?[0-f]+]], count=2 |
| 45 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: |
| 46 |
// CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]] |
| 47 |
// CHECK-SAME: new_task_id=[[TASK_ID1:[0-9]+]] |
| 48 |
// CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS]] |
| 49 |
// CHECK-SAME: task_type=ompt_task_explicit=4 |
| 50 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: |
| 51 |
// CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]] |
| 52 |
// CHECK-SAME: new_task_id=[[TASK_ID2:[0-9]+]] |
| 53 |
// CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS]] |
| 54 |
// CHECK-SAME: task_type=ompt_task_explicit=4 |
| 55 |
// CHECK-NOT: {{^}}[[MASTER_ID]]: ompt_event_task_create: |
| 56 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskloop_end: |
| 57 |
// CHECK-SAME: parallel_id=[[PARALLEL_ID]] |
| 58 |
// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1]] |
| 59 |
// CHECK-SAME: count=2 |
| 60 |
// CHECK-DAG: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_begin: |
| 61 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_end: |
| 62 |
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID1]] |
| 63 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskgroup_end: |
| 64 |
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID1]] |
| 65 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=0 |
| 66 |
// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1]], team_size=2, thread_num=0 |
| 67 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end: |
| 68 |
// CHECK-SAME: parallel_id=[[PARALLEL_ID]] |
| 69 |
|
| 70 |
// TASKS: ompt_event_initial_task_begin:{{.*}} task_id={{[0-f]+}} |
| 71 |
// TASKS: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_taskloop_begin: |
| 72 |
// TASKS: ompt_event_task_create:{{.*}} new_task_id=[[TASK_ID1:[0-9]+]] |
| 73 |
// TASKS-SAME: task_type=ompt_task_explicit |
| 74 |
// TASKS-DAG: ompt_event_task_create:{{.*}} new_task_id=[[TASK_ID2:[0-9]+]] |
| 75 |
// Schedule events: |
| 76 |
// TASKS-DAG: {{^.*}}first_task_id={{[0-f]+}}, second_task_id=[[TASK_ID1]] |
| 77 |
// TASKS-DAG: {{^.*}}first_task_id=[[TASK_ID1]], second_task_id={{[0-f]+}} |
| 78 |
// TASKS-DAG: {{^.*}}first_task_id={{[0-f]+}}, second_task_id=[[TASK_ID2]] |
| 79 |
// TASKS-DAG: {{^.*}}first_task_id=[[TASK_ID2]], second_task_id={{[0-f]+}} |
| 80 |
// TASKS-NOT: ompt_event_task_schedule |
| 81 |
// clang-format on |
| 82 |
|
| 83 |
return 0; |
| 84 |
} |