| 1 |
// clang-format off |
| 2 |
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s |
| 3 |
// REQUIRES: ompt |
| 4 |
// GCC generates code that does not call the runtime for the single construct |
| 5 |
// XFAIL: gcc |
| 6 |
// clang-format on |
| 7 |
|
| 8 |
#include "callback.h" |
| 9 |
#include <omp.h> |
| 10 |
|
| 11 |
int main() { |
| 12 |
int x = 0; |
| 13 |
#pragma omp parallel num_threads(2) |
| 14 |
{ |
| 15 |
#pragma omp single |
| 16 |
{ |
| 17 |
printf("%" PRIu64 ": in single\n", ompt_get_thread_data()->value); |
| 18 |
x++; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
printf("x=%d\n", x); |
| 23 |
|
| 24 |
// clang-format off |
| 25 |
// Check if libomp supports the callbacks for this test. |
| 26 |
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work' |
| 27 |
|
| 28 |
// CHECK: 0: NULL_POINTER=[[NULL:.*$]] |
| 29 |
|
| 30 |
// CHECK-DAG: {{^}}[[THREAD_ID_1:[0-9]+]]: ompt_event_single_in_block_begin: parallel_id=[[PARALLEL_ID:[0-f]+]], task_id=[[TASK_ID:[0-f]+]], codeptr_ra={{(0x)?[0-f]+}}, count=1 |
| 31 |
// CHECK-DAG: {{^}}[[THREAD_ID_1]]: in single |
| 32 |
// CHECK-DAG: {{^}}[[THREAD_ID_1]]: ompt_event_single_in_block_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{(0x)?[0-f]+}}, count=1 |
| 33 |
|
| 34 |
// CHECK-DAG: {{^}}[[THREAD_ID_2:[0-9]+]]: ompt_event_single_others_begin: parallel_id=[[PARALLEL_ID:[0-f]+]], task_id=[[TASK_ID:[0-f]+]], codeptr_ra={{(0x)?[0-f]+}}, count=1 |
| 35 |
// CHECK-DAG: {{^}}[[THREAD_ID_2]]: ompt_event_single_others_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{(0x)?[0-f]+}}, count=1 |
| 36 |
// clang-format on |
| 37 |
|
| 38 |
return 0; |
| 39 |
} |