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