Joachim Protze | 6213ed0 | 2020-11-04 12:16:25 +0100 | [diff] [blame] | 1 | // RUN: %libomp-compile-and-run | FileCheck %s |
| 2 | // REQUIRES: ompt |
| 3 | // GCC generates code that does not call the runtime for the master construct |
| 4 | // XFAIL: gcc |
| 5 | |
| 6 | #include "callback.h" |
| 7 | #include <omp.h> |
| 8 | |
| 9 | int main() { |
| 10 | int x = 0; |
| 11 | #pragma omp parallel num_threads(2) |
| 12 | { |
| 13 | #pragma omp master |
| 14 | { |
| 15 | print_fuzzy_address(1); |
| 16 | x++; |
| 17 | } |
| 18 | print_current_address(2); |
| 19 | } |
| 20 | |
| 21 | printf("%" PRIu64 ": x=%d\n", ompt_get_thread_data()->value, x); |
| 22 | |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | // Check if libomp supports the callbacks for this test. |
| 27 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_masked' |
| 28 | |
| 29 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] |
| 30 | |
| 31 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_masked_begin: |
| 32 | // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], |
| 33 | // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} |
| 34 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] |
| 35 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_masked_end: |
| 36 | // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], |
| 37 | // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS_END:0x[0-f]+]] |
| 38 | // CHECK: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS_END]] |