| 1 |
// clang-format off |
| 2 |
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s |
| 3 |
// REQUIRES: ompt |
| 4 |
// Some compilers generate code that does not distinguish between sections and loops |
| 5 |
// XFAIL: gcc, clang-3, clang-4, clang-5, icc-16, icc-17 |
| 6 |
// UNSUPPORTED: icc-18 |
| 7 |
// clang-format on |
| 8 |
|
| 9 |
#include "callback.h" |
| 10 |
#include <omp.h> |
| 11 |
|
| 12 |
int main() { |
| 13 |
#pragma omp parallel sections num_threads(2) |
| 14 |
{ |
| 15 |
#pragma omp section |
| 16 |
{ |
| 17 |
printf("%lu: section 1\n", ompt_get_thread_data()->value); |
| 18 |
} |
| 19 |
#pragma omp section |
| 20 |
{ |
| 21 |
printf("%lu: section 2\n", ompt_get_thread_data()->value); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
// clang-format off |
| 26 |
// Check if libomp supports the callbacks for this test. |
| 27 |
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work' |
| 28 |
|
| 29 |
// CHECK: 0: NULL_POINTER=[[NULL:.*$]] |
| 30 |
|
| 31 |
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID:[0-f]+]], task_id=[[TASK_ID:[0-f]+]], codeptr_ra=[[SECT_BEGIN:(0x)?[0-f]+]], count=2 |
| 32 |
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_sections_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-f]+}}, codeptr_ra=[[SECT_END:(0x)?[0-f]+]] |
| 33 |
|
| 34 |
// CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID:[0-f]+]], codeptr_ra=[[SECT_BEGIN]], count=2 |
| 35 |
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_sections_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-f]+}}, codeptr_ra=[[SECT_END]] |
| 36 |
// clang-format on |
| 37 |
|
| 38 |
return 0; |
| 39 |
} |