207 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp2! OpenMP Version 4.53! Various checks with the nesting of SIMD construct4 5SUBROUTINE NESTED_GOOD(N)6 INTEGER N, I, J, K, A(10), B(10)7 !$OMP SIMD8 DO I = 1,N9 !$OMP ATOMIC10 K = K + 111 IF (I <= 10) THEN12 !$OMP ORDERED SIMD13 DO J = 1,N14 A(J) = J15 END DO16 !$OMP END ORDERED17 ENDIF18 END DO19 !$OMP END SIMD20 21 !$OMP SIMD22 DO I = 1,N23 IF (I <= 10) THEN24 !$OMP SIMD25 DO J = 1,N26 A(J) = J27 END DO28 !$OMP END SIMD29 ENDIF30 END DO31 !$OMP END SIMD32END SUBROUTINE NESTED_GOOD33 34SUBROUTINE NESTED_BAD(N)35 INTEGER N, I, J, K, A(10), B(10)36 37 !$OMP SIMD38 DO I = 1,N39 IF (I <= 10) THEN40 !$OMP ORDERED SIMD41 DO J = 1,N42 print *, "Hi"43 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.44 !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region45 !$omp teams 46 DO K = 1,N47 print *, 'Hello'48 END DO49 !$omp end teams50 END DO51 !$OMP END ORDERED52 ENDIF53 END DO54 !$OMP END SIMD55 56 !$OMP SIMD57 DO I = 1,N58 !$OMP ATOMIC59 K = K + 160 IF (I <= 10) THEN61 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.62 !$omp task 63 do J = 1, N64 K = 265 end do66 !$omp end task67 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.68 !$omp target 69 do J = 1, N70 K = 271 end do72 !$omp end target73 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.74 !$OMP DO75 DO J = 1,N76 A(J) = J77 END DO78 !$OMP END DO79 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.80 !$OMP PARALLEL DO81 DO J = 1,N82 A(J) = J83 END DO84 !$OMP END PARALLEL DO85 ENDIF86 END DO87 !$OMP END SIMD88 89 !$OMP DO SIMD90 DO I = 1,N91 !$OMP ATOMIC92 K = K + 193 IF (I <= 10) THEN94 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.95 !$omp task 96 do J = 1, N97 K = 298 end do99 !$omp end task100 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.101 !$omp target 102 do J = 1, N103 K = 2104 end do105 !$omp end target106 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.107 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region108 !$OMP DO109 DO J = 1,N110 A(J) = J111 END DO112 !$OMP END DO113 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.114 !$OMP PARALLEL DO115 DO J = 1,N116 A(J) = J117 END DO118 !$OMP END PARALLEL DO119 ENDIF120 END DO121 !$OMP END DO SIMD122 123 !$OMP PARALLEL DO SIMD124 DO I = 1,N125 !$OMP ATOMIC126 K = K + 1127 IF (I <= 10) THEN128 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.129 !$omp task 130 do J = 1, N131 K = 2132 end do133 !$omp end task134 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.135 !$omp target 136 do J = 1, N137 K = 2138 end do139 !$omp end target140 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.141 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region142 !$OMP DO143 DO J = 1,N144 A(J) = J145 END DO146 !$OMP END DO147 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.148 !$OMP PARALLEL DO149 DO J = 1,N150 A(J) = J151 END DO152 !$OMP END PARALLEL DO153 ENDIF154 END DO155 !$OMP END PARALLEL DO SIMD156 157 !$OMP TARGET SIMD158 DO I = 1,N159 !$OMP ATOMIC160 K = K + 1161 IF (I <= 10) THEN162 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.163 !$omp task 164 do J = 1, N165 K = 2166 end do167 !$omp end task168 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.169 !$omp target 170 do J = 1, N171 K = 2172 end do173 !$omp end target174 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.175 !$OMP DO176 DO J = 1,N177 A(J) = J178 END DO179 !$OMP END DO180 !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, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.181 !$OMP PARALLEL DO182 DO J = 1,N183 A(J) = J184 END DO185 !$OMP END PARALLEL DO186 ENDIF187 END DO188 !$OMP END TARGET SIMD189 190 191END SUBROUTINE NESTED_BAD192 193SUBROUTINE SIMD_LOOP(A, B, N)194 REAL :: A(100), B(100)195 INTEGER :: I, J, N196 197 !$OMP SIMD198 DO I = 1, N199 !$OMP LOOP200 DO J = 1, N201 B(J) = B(J) + A(J)202 END DO203 !$OMP END LOOP204 END DO205 !$OMP END SIMD206END SUBROUTINE207