1! Check invalid calls to 'external' OpenACC routines. 2 3! { dg-additional-options "-fopt-info-optimized-omp" } 4 5 subroutine sub 6 implicit none 7 integer, parameter :: n = 100 8 integer :: a(n), i, j 9 external :: gangr, workerr, vectorr, seqr 10!$acc routine (gangr) gang 11!$acc routine (workerr) worker 12!$acc routine (vectorr) vector 13!$acc routine (seqr) seq 14 15! 16! Test subroutine calls inside nested loops. 17! 18 19!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 20 do i = 1, n 21!$acc loop ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 22! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } 23 do j = 1, n 24 call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 25 end do 26 end do 27!$acc end parallel loop 28 29!$acc parallel loop ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 30! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } 31 do i = 1, n 32!$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 33 do j = 1, n 34 call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 35! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 36 end do 37 end do 38!$acc end parallel loop 39 40! 41! Test calls to seq routines 42! 43 44!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } 45 do i = 1, n 46 call seqr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 47 end do 48!$acc end parallel loop 49 50!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 51 do i = 1, n 52 call seqr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 53 end do 54!$acc end parallel loop 55 56!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 57 do i = 1, n 58 call seqr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 59 end do 60!$acc end parallel loop 61 62!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 63 do i = 1, n 64 call seqr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 65 end do 66!$acc end parallel loop 67 68!$acc parallel loop seq ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 69 do i = 1, n 70 call seqr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 71 end do 72!$acc end parallel loop 73 74! 75! Test calls to gang routines 76! 77 78!$acc parallel loop ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 79! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } 80 do i = 1, n 81 call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang worker vector loop parallelism" } 82 end do 83!$acc end parallel loop 84 85!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 86 do i = 1, n 87 call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 88! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 89 end do 90!$acc end parallel loop 91 92!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 93 do i = 1, n 94 call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } 95! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 96 end do 97!$acc end parallel loop 98 99!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 100 do i = 1, n 101 call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } 102! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 103 end do 104!$acc end parallel loop 105 106!$acc parallel loop seq ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 107 do i = 1, n 108 call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang worker vector loop parallelism" } 109 end do 110!$acc end parallel loop 111 112! 113! Test calls to worker routines 114! 115 116!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 117 do i = 1, n 118 call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 119 end do 120!$acc end parallel loop 121 122!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 123 do i = 1, n 124 call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 125 end do 126!$acc end parallel loop 127 128!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 129 do i = 1, n 130 call workerr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 131! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 132 end do 133!$acc end parallel loop 134 135!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 136 do i = 1, n 137 call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 138! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 139 end do 140!$acc end parallel loop 141 142!$acc parallel loop seq ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 143 do i = 1, n 144 call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 145 end do 146!$acc end parallel loop 147 148! 149! Test calls to vector routines 150! 151 152!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } 153 do i = 1, n 154 call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 155 end do 156!$acc end parallel loop 157 158!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 159 do i = 1, n 160 call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 161 end do 162!$acc end parallel loop 163 164!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 165 do i = 1, n 166 call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 167 end do 168!$acc end parallel loop 169 170!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 171 do i = 1, n 172 call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 173! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 174 end do 175!$acc end parallel loop 176 177!$acc parallel loop seq ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 178 do i = 1, n 179 call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 180 end do 181!$acc end parallel loop 182 end subroutine sub 183 184 subroutine func 185 implicit none 186 integer, parameter :: n = 100 187 integer :: a(n), i, j 188 integer, external :: gangf, workerf, vectorf, seqf 189!$acc routine (gangf) gang 190!$acc routine (workerf) worker 191!$acc routine (vectorf) vector 192!$acc routine (seqf) seq 193 194! 195! Test subroutine calls inside nested loops. 196! 197 198!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 199 do i = 1, n 200!$acc loop ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 201! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } 202 do j = 1, n 203 a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 204 end do 205 end do 206!$acc end parallel loop 207 208!$acc parallel loop ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 209! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } 210 do i = 1, n 211!$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 212 do j = 1, n 213 a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 214! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 215 end do 216 end do 217!$acc end parallel loop 218 219! 220! Test calls to seq routines 221! 222 223!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } 224 do i = 1, n 225 a(i) = seqf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 226 end do 227!$acc end parallel loop 228 229!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 230 do i = 1, n 231 a(i) = seqf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 232 end do 233!$acc end parallel loop 234 235!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 236 do i = 1, n 237 a(i) = seqf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 238 end do 239!$acc end parallel loop 240 241!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 242 do i = 1, n 243 a(i) = seqf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 244 end do 245!$acc end parallel loop 246 247!$acc parallel loop seq ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 248 do i = 1, n 249 a(i) = seqf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 250 end do 251!$acc end parallel loop 252 253! 254! Test calls to gang routines 255! 256 257!$acc parallel loop ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 258! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } 259 do i = 1, n 260 a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang worker vector loop parallelism" } 261 end do 262!$acc end parallel loop 263 264!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 265 do i = 1, n 266 a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 267! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 268 end do 269!$acc end parallel loop 270 271!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 272 do i = 1, n 273 a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } 274! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 275 end do 276!$acc end parallel loop 277 278!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 279 do i = 1, n 280 a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } 281! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 282 end do 283!$acc end parallel loop 284 285!$acc parallel loop seq ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 286 do i = 1, n 287 a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang worker vector loop parallelism" } 288 end do 289!$acc end parallel loop 290 291! 292! Test calls to worker routines 293! 294 295!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 296 do i = 1, n 297 a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 298 end do 299!$acc end parallel loop 300 301!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 302 do i = 1, n 303 a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 304 end do 305!$acc end parallel loop 306 307!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 308 do i = 1, n 309 a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 310! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 311 end do 312!$acc end parallel loop 313 314!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 315 do i = 1, n 316 a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 317! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 318 end do 319!$acc end parallel loop 320 321!$acc parallel loop seq ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 322 do i = 1, n 323 a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } 324 end do 325!$acc end parallel loop 326 327! 328! Test calls to vector routines 329! 330 331!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } 332 do i = 1, n 333 a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 334 end do 335!$acc end parallel loop 336 337!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } 338 do i = 1, n 339 a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 340 end do 341!$acc end parallel loop 342 343!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } 344 do i = 1, n 345 a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 346 end do 347!$acc end parallel loop 348 349!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 350 do i = 1, n 351 a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 352! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } 353 end do 354!$acc end parallel loop 355 356!$acc parallel loop seq ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } 357 do i = 1, n 358 a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } 359 end do 360!$acc end parallel loop 361 end subroutine func 362