| 1 |
! RUN: %python %S/../test_errors.py %s %flang -fopenmp |
| 2 |
! OpenMP Version 5.1 |
| 3 |
! Check OpenMP construct validity for the following directives: |
| 4 |
! 2.19.9 Ordered Construct |
| 5 |
|
| 6 |
subroutine sub1() |
| 7 |
integer :: i, j, N = 10 |
| 8 |
real :: arrayA(10), arrayB(10) |
| 9 |
real, external :: foo, bar |
| 10 |
|
| 11 |
!$omp do ordered(1) |
| 12 |
do i = 1, N |
| 13 |
!$omp ordered depend(source) |
| 14 |
arrayA(i) = foo(i) |
| 15 |
!$omp ordered depend(sink: i - 1) |
| 16 |
arrayB(i) = bar(i - 1) |
| 17 |
end do |
| 18 |
!$omp end do |
| 19 |
|
| 20 |
!$omp do ordered(1) |
| 21 |
do i = 1, N |
| 22 |
!$omp target |
| 23 |
do j = 1, N |
| 24 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 25 |
!$omp ordered depend(source) |
| 26 |
arrayA(i) = foo(i) |
| 27 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 28 |
!$omp ordered depend(sink: i - 1) |
| 29 |
arrayB(i) = bar(i - 1) |
| 30 |
end do |
| 31 |
!$omp end target |
| 32 |
end do |
| 33 |
!$omp end do |
| 34 |
|
| 35 |
!$omp target |
| 36 |
!$omp parallel do ordered(1) |
| 37 |
do i = 1, N |
| 38 |
!$omp ordered depend(source) |
| 39 |
arrayA(i) = foo(i) |
| 40 |
!$omp ordered depend(sink: i - 1) |
| 41 |
arrayB(i) = bar(i - 1) |
| 42 |
end do |
| 43 |
!$omp end parallel do |
| 44 |
!$omp end target |
| 45 |
|
| 46 |
!$omp target parallel do ordered(1) |
| 47 |
do i = 1, N |
| 48 |
!$omp ordered depend(source) |
| 49 |
arrayA(i) = foo(i) |
| 50 |
!$omp ordered depend(sink: i - 1) |
| 51 |
arrayB(i) = bar(i - 1) |
| 52 |
end do |
| 53 |
!$omp end target parallel do |
| 54 |
|
| 55 |
!$omp target teams distribute parallel do ordered(1) |
| 56 |
do i = 1, N |
| 57 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 58 |
!$omp ordered depend(source) |
| 59 |
arrayA(i) = foo(i) |
| 60 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 61 |
!$omp ordered depend(sink: i - 1) |
| 62 |
arrayB(i) = bar(i - 1) |
| 63 |
end do |
| 64 |
!$omp end target teams distribute parallel do |
| 65 |
|
| 66 |
!$omp do ordered |
| 67 |
do i = 1, N |
| 68 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 69 |
!$omp ordered depend(source) |
| 70 |
arrayA(i) = foo(i) |
| 71 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 72 |
!$omp ordered depend(sink: i - 1) |
| 73 |
arrayB(i) = bar(i - 1) |
| 74 |
end do |
| 75 |
!$omp end do |
| 76 |
|
| 77 |
!$omp parallel do ordered |
| 78 |
do i = 1, N |
| 79 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 80 |
!$omp ordered depend(source) |
| 81 |
arrayA(i) = foo(i) |
| 82 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 83 |
!$omp ordered depend(sink: i - 1) |
| 84 |
arrayB(i) = bar(i - 1) |
| 85 |
end do |
| 86 |
!$omp end parallel do |
| 87 |
|
| 88 |
!$omp target parallel do ordered |
| 89 |
do i = 1, N |
| 90 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 91 |
!$omp ordered depend(source) |
| 92 |
arrayA(i) = foo(i) |
| 93 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 94 |
!$omp ordered depend(sink: i - 1) |
| 95 |
arrayB(i) = bar(i - 1) |
| 96 |
end do |
| 97 |
!$omp end target parallel do |
| 98 |
|
| 99 |
!$omp do ordered(1) |
| 100 |
do i = 1, N |
| 101 |
!ERROR: The number of variables in DEPEND(SINK: vec) clause does not match the parameter specified in ORDERED clause |
| 102 |
!$omp ordered depend(sink: i - 1) depend(sink: i - 1, j) |
| 103 |
arrayB(i) = bar(i - 1, j) |
| 104 |
end do |
| 105 |
!$omp end do |
| 106 |
|
| 107 |
!$omp do ordered(2) |
| 108 |
do i = 1, N |
| 109 |
do j = 1, N |
| 110 |
!ERROR: The number of variables in DEPEND(SINK: vec) clause does not match the parameter specified in ORDERED clause |
| 111 |
!$omp ordered depend(sink: i - 1) depend(sink: i - 1, j) |
| 112 |
arrayB(i) = foo(i - 1) + bar(i - 1, j) |
| 113 |
end do |
| 114 |
end do |
| 115 |
!$omp end do |
| 116 |
|
| 117 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 118 |
!$omp ordered depend(source) |
| 119 |
|
| 120 |
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter |
| 121 |
!$omp ordered depend(sink: i - 1) |
| 122 |
end |