| 1 |
! RUN: %python %S/../test_errors.py %s %flang -fopenmp |
| 2 |
! OpenMP Version 4.5 |
| 3 |
! 2.7.1 Loop Construct restrictions on single directive. |
| 4 |
|
| 5 |
|
| 6 |
program omp_do |
| 7 |
|
| 8 |
integer n |
| 9 |
integer i,j,k |
| 10 |
!$omp do |
| 11 |
do i=1,10 |
| 12 |
if( i == 5 ) then |
| 13 |
cycle |
| 14 |
end if |
| 15 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 16 |
!$omp single |
| 17 |
do j=1,10 |
| 18 |
print *,"hello" |
| 19 |
end do |
| 20 |
!$omp end single |
| 21 |
end do |
| 22 |
!$omp end do |
| 23 |
|
| 24 |
!$omp parallel do |
| 25 |
do i=1,10 |
| 26 |
if( i == 9 ) then |
| 27 |
end if |
| 28 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 29 |
!$omp single |
| 30 |
do j=1,10 |
| 31 |
print *,"hello" |
| 32 |
end do |
| 33 |
!$omp end single |
| 34 |
end do |
| 35 |
!$omp end parallel do |
| 36 |
|
| 37 |
!$omp parallel do simd |
| 38 |
do i=1,10 |
| 39 |
if( i == 5 ) then |
| 40 |
cycle |
| 41 |
end if |
| 42 |
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. |
| 43 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 44 |
!$omp single |
| 45 |
do j=1,10 |
| 46 |
print *,"hello" |
| 47 |
end do |
| 48 |
!$omp end single |
| 49 |
end do |
| 50 |
!$omp end parallel do simd |
| 51 |
|
| 52 |
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. |
| 53 |
!$omp distribute parallel do |
| 54 |
do i=1,10 |
| 55 |
if( i == 3 ) then |
| 56 |
cycle |
| 57 |
end if |
| 58 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 59 |
!$omp single |
| 60 |
do j=1,10 |
| 61 |
print *,"hello" |
| 62 |
end do |
| 63 |
!$omp end single |
| 64 |
end do |
| 65 |
!$omp end distribute parallel do |
| 66 |
|
| 67 |
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. |
| 68 |
!$omp distribute parallel do simd |
| 69 |
do i=1,10 |
| 70 |
if( i == 3 ) then |
| 71 |
cycle |
| 72 |
end if |
| 73 |
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. |
| 74 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 75 |
!$omp single |
| 76 |
do j=1,10 |
| 77 |
print *,"hello" |
| 78 |
end do |
| 79 |
!$omp end single |
| 80 |
end do |
| 81 |
!$omp end distribute parallel do simd |
| 82 |
|
| 83 |
!$omp target parallel do |
| 84 |
do i=1,10 |
| 85 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 86 |
!$omp single |
| 87 |
do j=1,10 |
| 88 |
print *,"hello" |
| 89 |
end do |
| 90 |
!$omp end single |
| 91 |
end do |
| 92 |
!$omp end target parallel do |
| 93 |
|
| 94 |
!$omp target parallel do simd |
| 95 |
do i=1,10 |
| 96 |
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. |
| 97 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 98 |
!$omp single |
| 99 |
do j=1,10 |
| 100 |
print *,"hello" |
| 101 |
end do |
| 102 |
!$omp end single |
| 103 |
end do |
| 104 |
!$omp end target parallel do simd |
| 105 |
|
| 106 |
!$omp target teams distribute parallel do |
| 107 |
do i=1,10 |
| 108 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 109 |
!$omp single |
| 110 |
do j=1,10 |
| 111 |
print *,"hello" |
| 112 |
end do |
| 113 |
!$omp end single |
| 114 |
end do |
| 115 |
!$omp end target teams distribute parallel do |
| 116 |
|
| 117 |
!$omp target teams distribute parallel do simd |
| 118 |
do i=1,10 |
| 119 |
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. |
| 120 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 121 |
!$omp single |
| 122 |
do j=1,10 |
| 123 |
print *,"hello" |
| 124 |
end do |
| 125 |
!$omp end single |
| 126 |
end do |
| 127 |
!$omp end target teams distribute parallel do simd |
| 128 |
|
| 129 |
!$omp do |
| 130 |
do i=1,10 |
| 131 |
!$omp task |
| 132 |
do j=1,10 |
| 133 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 134 |
!$omp single |
| 135 |
do k=1,10 |
| 136 |
print *,"hello" |
| 137 |
end do |
| 138 |
!$omp end single |
| 139 |
end do |
| 140 |
!$omp end task |
| 141 |
end do |
| 142 |
!$omp end do |
| 143 |
|
| 144 |
!$omp do |
| 145 |
do i=1,10 |
| 146 |
!$omp parallel |
| 147 |
do j=1,10 |
| 148 |
!$omp single |
| 149 |
do k=1,10 |
| 150 |
print *,"hello" |
| 151 |
end do |
| 152 |
!$omp end single |
| 153 |
end do |
| 154 |
!$omp end parallel |
| 155 |
end do |
| 156 |
!$omp end do |
| 157 |
|
| 158 |
!$omp do |
| 159 |
do i=1,10 |
| 160 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 161 |
!$omp single |
| 162 |
do j=1,10 |
| 163 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 164 |
!$omp single |
| 165 |
do k=1,10 |
| 166 |
print *,"hello" |
| 167 |
end do |
| 168 |
!$omp end single |
| 169 |
end do |
| 170 |
!$omp end single |
| 171 |
|
| 172 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 173 |
!$omp single |
| 174 |
do k=1,10 |
| 175 |
print *,"hello" |
| 176 |
end do |
| 177 |
!$omp end single |
| 178 |
|
| 179 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 180 |
!$omp do |
| 181 |
do k=1,10 |
| 182 |
print *,"hello" |
| 183 |
end do |
| 184 |
!$omp end do |
| 185 |
end do |
| 186 |
!$omp end do |
| 187 |
|
| 188 |
!$omp parallel default(shared) |
| 189 |
!$omp do |
| 190 |
do i = 1, n |
| 191 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 192 |
!$omp single |
| 193 |
call work(i, 1) |
| 194 |
!$omp end single |
| 195 |
end do |
| 196 |
!$omp end do |
| 197 |
!$omp end parallel |
| 198 |
|
| 199 |
!$omp parallel default(shared) |
| 200 |
!$omp do |
| 201 |
do i = 1, n |
| 202 |
!$omp task |
| 203 |
do j=1,10 |
| 204 |
!ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region |
| 205 |
!$omp single |
| 206 |
call work(i, 1) |
| 207 |
!$omp end single |
| 208 |
end do |
| 209 |
!$omp end task |
| 210 |
end do |
| 211 |
!$omp end do |
| 212 |
!$omp end parallel |
| 213 |
|
| 214 |
end program omp_do |