1 // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
2 // REQUIRES: ompt
3 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
4 #include "callback.h"
5 #include <omp.h>
6
main()7 int main() {
8 int a[10][10];
9 int i, j;
10 #pragma omp parallel num_threads(2)
11 #pragma omp for ordered(2)
12 for (i = 0; i < 2; i++)
13 for (j = 0; j < 2; j++) {
14 a[i][j] = i + j + 1;
15 printf("%d, %d\n", i, j);
16 #pragma omp ordered depend(sink : i - 1, j) depend(sink : i, j - 1)
17 if (i > 0 && j > 0)
18 a[i][j] = a[i - 1][j] + a[i][j - 1] + 1;
19 printf("%d, %d\n", i, j);
20 #pragma omp ordered depend(source)
21 }
22
23 return 0;
24 }
25 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
26
27 // CHECK: {{^}}[[MASTER:[0-9]+]]: ompt_event_loop_begin:
28 // CHECK-SAME: parallel_id={{[0-9]+}}, parent_task_id=[[ITASK:[0-9]+]],
29
30 // CHECK: {{^}}[[MASTER]]: ompt_event_dependences: task_id=[[ITASK]],
31 // CHECK-SAME: deps=[(0, ompt_dependence_type_source), (0,
32 // CHECK-SAME: ompt_dependence_type_source)], ndeps=2
33
34 // CHECK: {{^}}[[MASTER]]: ompt_event_dependences: task_id=[[ITASK]],
35 // CHECK-SAME: deps=[(0, ompt_dependence_type_sink), (0,
36 // CHECK-SAME: ompt_dependence_type_sink)], ndeps=2
37
38 // CHECK: {{^}}[[MASTER]]: ompt_event_dependences: task_id=[[ITASK]],
39 // CHECK-SAME: deps=[(0, ompt_dependence_type_source), (1,
40 // CHECK-SAME: ompt_dependence_type_source)], ndeps=2
41
42 // CHECK: {{^}}[[WORKER:[0-9]+]]: ompt_event_loop_begin:
43 // CHECK-SAME: parallel_id={{[0-9]+}}, parent_task_id=[[ITASK:[0-9]+]],
44
45 // CHECK: {{^}}[[WORKER]]: ompt_event_dependences: task_id=[[ITASK]],
46 // CHECK-SAME: deps=[(0, ompt_dependence_type_sink), (0,
47 // CHECK-SAME: ompt_dependence_type_sink)], ndeps=2
48
49 // CHECK: {{^}}[[WORKER]]: ompt_event_dependences: task_id=[[ITASK]],
50 // CHECK-SAME: deps=[(1, ompt_dependence_type_source), (0,
51 // CHECK-SAME: ompt_dependence_type_source)], ndeps=2
52
53 // either can be first for last iteration
54
55 // CHECK-DAG: [[ITASK]]{{.*}}deps=[(0{{.*}}sink), (1,{{.*}}sink)]
56
57 // CHECK-DAG: [[ITASK]]{{.*}}deps=[(1{{.*}}sink), (0,{{.*}}sink)]
58
59 // CHECK: {{^}}[[WORKER]]: ompt_event_dependences: task_id=[[ITASK]],
60 // CHECK-SAME: deps=[(1, ompt_dependence_type_source), (1,
61 // CHECK-SAME: ompt_dependence_type_source)], ndeps=2
62