LLVM OpenMP
20.0.0git
runtime
test
ompt
synchronization
test_lock.c
Go to the documentation of this file.
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_lock_t
lock
;
10
omp_init_lock(&
lock
);
11
print_fuzzy_address
(1);
12
13
omp_test_lock(&
lock
);
14
print_fuzzy_address
(2);
15
omp_unset_lock(&
lock
);
16
print_fuzzy_address
(3);
17
18
omp_set_lock(&
lock
);
19
print_fuzzy_address
(4);
20
omp_test_lock(&
lock
);
21
print_fuzzy_address
(5);
22
omp_unset_lock(&
lock
);
23
print_fuzzy_address
(6);
24
25
omp_destroy_lock(&
lock
);
26
print_fuzzy_address
(7);
27
28
// Check if libomp supports the callbacks for this test.
29
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire'
30
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
31
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
32
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock'
33
34
// CHECK: 0: NULL_POINTER=[[NULL:.*$]]
35
36
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_init_lock: wait_id=[[WAIT_ID:[0-9]+]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
37
// CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
38
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_test_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
39
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_test_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}}
40
// CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
41
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
42
// CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
43
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
44
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}}
45
// CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
46
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_test_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
47
// CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
48
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
49
// CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
50
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_destroy_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
51
// CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
52
53
return
0;
54
}
callback.h
print_fuzzy_address
#define print_fuzzy_address(id)
Definition:
callback.h:307
lock
static kmp_bootstrap_lock_t lock
Definition:
kmp_i18n.cpp:57
main
int main()
Definition:
test_lock.c:7
Generated on Wed Jan 29 2025 20:58:01 for LLVM OpenMP by
1.9.6