215 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp2! OpenMP Version 4.53! 2.7.1 Loop Construct restrictions on single directive.4 5 6program omp_do7 8 integer n9 integer i,j,k10 !$omp do11 do i=1,1012 if( i == 5 ) then13 cycle14 end if15 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region16 !$omp single17 do j=1,1018 print *,"hello"19 end do20 !$omp end single21 end do22 !$omp end do23 24 !$omp parallel do25 do i=1,1026 if( i == 9 ) then27 end if28 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region29 !$omp single30 do j=1,1031 print *,"hello"32 end do33 !$omp end single34 end do35 !$omp end parallel do36 37 !$omp parallel do simd38 do i=1,1039 if( i == 5 ) then40 cycle41 end if42 !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.43 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region44 !$omp single45 do j=1,1046 print *,"hello"47 end do48 !$omp end single49 end do50 !$omp end parallel do simd51 52 !WARNING: `DISTRIBUTE` must be dynamically enclosed in a `TEAMS` region.53 !$omp distribute parallel do54 do i=1,1055 if( i == 3 ) then56 cycle57 end if58 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region59 !$omp single60 do j=1,1061 print *,"hello"62 end do63 !$omp end single64 end do65 !$omp end distribute parallel do66 67 !WARNING: `DISTRIBUTE` must be dynamically enclosed in a `TEAMS` region.68 !$omp distribute parallel do simd69 do i=1,1070 if( i == 3 ) then71 cycle72 end if73 !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 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region75 !$omp single76 do j=1,1077 print *,"hello"78 end do79 !$omp end single80 end do81 !$omp end distribute parallel do simd82 83 !$omp target parallel do 84 do i=1,1085 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region86 !$omp single87 do j=1,1088 print *,"hello"89 end do90 !$omp end single91 end do92 !$omp end target parallel do93 94 !$omp target parallel do simd95 do i=1,1096 !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.97 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region98 !$omp single99 do j=1,10100 print *,"hello"101 end do102 !$omp end single103 end do104 !$omp end target parallel do simd105 106 !$omp target teams distribute parallel do107 do i=1,10108 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region109 !$omp single110 do j=1,10111 print *,"hello"112 end do113 !$omp end single114 end do115 !$omp end target teams distribute parallel do116 117 !$omp target teams distribute parallel do simd118 do i=1,10119 !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.120 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region121 !$omp single122 do j=1,10123 print *,"hello"124 end do125 !$omp end single126 end do127 !$omp end target teams distribute parallel do simd128 129 !$omp do130 do i=1,10131 !$omp task132 do j=1,10133 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region134 !$omp single135 do k=1,10136 print *,"hello"137 end do138 !$omp end single139 end do140 !$omp end task141 end do142 !$omp end do143 144 !$omp do145 do i=1,10146 !$omp parallel147 do j=1,10148 !$omp single149 do k=1,10150 print *,"hello"151 end do152 !$omp end single153 end do154 !$omp end parallel155 end do156 !$omp end do157 158!$omp do159do i=1,10160 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region161 !$omp single162 do j=1,10163 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region164 !$omp single165 do k=1,10166 print *,"hello"167 end do168 !$omp end single169 end do170 !$omp end single171 172 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region173 !$omp single174 do k=1,10175 print *,"hello"176 end do177 !$omp end single178 179 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region180 !$omp do181 do k=1,10182 print *,"hello"183 end do184 !$omp end do185end do186!$omp end do187 188 !$omp parallel default(shared)189 !$omp do190 do i = 1, n191 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region192 !$omp single193 call work(i, 1)194 !$omp end single195 end do196 !$omp end do197 !$omp end parallel198 199 !$omp parallel default(shared)200 !$omp do201 do i = 1, n202 !$omp task203 do j=1,10204 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region205 !$omp single206 call work(i, 1)207 !$omp end single208 end do209 !$omp end task210 end do211 !$omp end do212 !$omp end parallel213 214end program omp_do215