[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / ompt / synchronization / nest_lock.c
blob39681ae40069d88696b682c153b2003cfdc42822
1 // RUN: %libomp-compile-and-run | FileCheck %s
2 // REQUIRES: ompt
3 #include "callback.h"
4 #include <omp.h>
6 int main()
8 //need to use an OpenMP construct so that OMPT will be initialized
9 #pragma omp parallel num_threads(1)
10 print_ids(0);
12 omp_nest_lock_t nest_lock;
13 printf("%" PRIu64 ": &nest_lock: %" PRIu64 "\n",
14 ompt_get_thread_data()->value, (ompt_wait_id_t)(uintptr_t)&nest_lock);
15 omp_init_nest_lock(&nest_lock);
16 print_fuzzy_address(1);
17 omp_set_nest_lock(&nest_lock);
18 print_fuzzy_address(2);
19 omp_set_nest_lock(&nest_lock);
20 print_fuzzy_address(3);
21 omp_unset_nest_lock(&nest_lock);
22 print_fuzzy_address(4);
23 omp_unset_nest_lock(&nest_lock);
24 print_fuzzy_address(5);
25 omp_destroy_nest_lock(&nest_lock);
26 print_fuzzy_address(6);
29 // Check if libomp supports the callbacks for this test.
30 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire'
31 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
32 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
33 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock'
35 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
37 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_init_nest_lock: wait_id=[[WAIT_ID:[0-9]+]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
38 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
39 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
40 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_first: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}}
41 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
42 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
43 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_next: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]]
44 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
45 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_prev: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
46 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
47 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_last: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
48 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
49 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_destroy_nest_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
50 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
52 return 0;