1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s |
2 | // REQUIRES: ompt |
3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 |
4 | |
5 | #include "callback.h" |
6 | #include <omp.h> |
7 | #include <math.h> |
8 | #include <unistd.h> |
9 | |
10 | int main() { |
11 | int x = 0; |
12 | int condition=0; |
13 | #pragma omp parallel num_threads(2) |
14 | { |
15 | #pragma omp master |
16 | { |
17 | print_ids(0); |
18 | printf("%" PRIu64 ": address of x: %p\n" , ompt_get_thread_data()->value, |
19 | &x); |
20 | #pragma omp task depend(out : x) shared(condition) |
21 | { |
22 | x++; |
23 | OMPT_WAIT(condition,1); |
24 | } |
25 | print_fuzzy_address(1); |
26 | print_ids(0); |
27 | |
28 | #pragma omp task depend(in : x) |
29 | { x = -1; } |
30 | print_ids(0); |
31 | OMPT_SIGNAL(condition); |
32 | } |
33 | } |
34 | |
35 | x++; |
36 | |
37 | return 0; |
38 | } |
39 | |
40 | // Check if libomp supports the callbacks for this test. |
41 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' |
42 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_dependences' |
43 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_depende |
44 | |
45 | // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] |
46 | |
47 | // make sure initial data pointers are null |
48 | // CHECK-NOT: 0: new_task_data initially not null |
49 | |
50 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_implicit_task_begin: |
51 | // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]], |
52 | // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-9]+]] |
53 | |
54 | // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], |
55 | // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT:0x[0-f]+]], |
56 | // CHECK-SAME: reenter_frame=[[NULL]] |
57 | |
58 | // CHECK: {{^}}[[MASTER_ID]]: address of x: [[ADDRX:0x[0-f]+]] |
59 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: |
60 | // CHECK-SAME: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]], |
61 | // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}, |
62 | // CHECK-SAME: new_task_id=[[FIRST_TASK:[0-f]+]], |
63 | // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, |
64 | // CHECK-SAME: task_type=ompt_task_explicit=4, has_dependences=yes |
65 | |
66 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences: |
67 | // CHECK-SAME: task_id=[[FIRST_TASK]], deps=[([[ADDRX]], |
68 | // CHECK-SAME: ompt_dependence_type_inout)], ndeps=1 |
69 | |
70 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] |
71 | // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], |
72 | // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], |
73 | // CHECK-SAME: reenter_frame=[[NULL]] |
74 | |
75 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: |
76 | // CHECK-SAME: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]], |
77 | // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}, |
78 | // CHECK-SAME: new_task_id=[[SECOND_TASK:[0-f]+]], codeptr_ra={{0x[0-f]+}}, |
79 | // CHECK-SAME: task_type=ompt_task_explicit=4, has_dependences=yes |
80 | |
81 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences: |
82 | // CHECK-SAME: task_id=[[SECOND_TASK]], deps=[([[ADDRX]], |
83 | // CHECK-SAME: ompt_dependence_type_in)], ndeps=1 |
84 | |
85 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_dependence_pair: |
86 | // CHECK-SAME: first_task_id=[[FIRST_TASK]], second_task_id=[[SECOND_TASK]] |
87 | |
88 | // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], |
89 | // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], |
90 | // CHECK-SAME: reenter_frame=[[NULL]] |
91 | |