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