1 | // RUN: %libomp-compile-and-run | FileCheck %s |
2 | // REQUIRES: ompt |
3 | |
4 | #include "callback.h" |
5 | #include <omp.h> |
6 | |
7 | int main() |
8 | { |
9 | omp_nest_lock_t nest_lock; |
10 | omp_init_nest_lock(&nest_lock); |
11 | |
12 | omp_test_nest_lock(&nest_lock); |
13 | omp_unset_nest_lock(&nest_lock); |
14 | |
15 | omp_set_nest_lock(&nest_lock); |
16 | omp_test_nest_lock(&nest_lock); |
17 | omp_unset_nest_lock(&nest_lock); |
18 | omp_unset_nest_lock(&nest_lock); |
19 | |
20 | omp_destroy_nest_lock(&nest_lock); |
21 | |
22 | // Check if libomp supports the callbacks for this test. |
23 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire' |
24 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired' |
25 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released' |
26 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock' |
27 | |
28 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] |
29 | |
30 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_init_nest_lock: wait_id=[[WAIT_ID:[0-9]+]], hint=0, impl={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} |
31 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_test_nest_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} |
32 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_test_nest_lock_first: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} |
33 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_last: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} |
34 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} |
35 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_first: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} |
36 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_test_nest_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} |
37 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_next: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} |
38 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_prev: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} |
39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_last: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} |
40 | |
41 | return 0; |
42 | } |
43 | |