| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
program main |
| 4 |
implicit none |
| 5 |
integer, parameter :: n = 1024 |
| 6 |
integer, dimension (0:n-1) :: a, b, c |
| 7 |
integer :: i, ii |
| 8 |
|
| 9 |
! Parallelism dimensions: compiler/runtime decides. |
| 10 |
!$acc kernels copyout (a(0:n-1)) |
| 11 |
do i = 0, n - 1 |
| 12 |
a(i) = i * 2 |
| 13 |
end do |
| 14 |
!$acc end kernels |
| 15 |
|
| 16 |
! Parallelism dimensions: variable. |
| 17 |
!$acc kernels copyout (b(0:n-1)) & |
| 18 |
!$acc num_gangs (3 + a(3)) num_workers (5 + a(5)) vector_length (7 + a(7)) |
| 19 |
! { dg-prune-output "using .vector_length \\(32\\)., ignoring runtime setting" } |
| 20 |
do i = 0, n -1 |
| 21 |
b(i) = i * 4 |
| 22 |
end do |
| 23 |
!$acc end kernels |
| 24 |
|
| 25 |
! Parallelism dimensions: literal. |
| 26 |
!$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) & |
| 27 |
!$acc num_gangs (3) num_workers (5) vector_length (7) |
| 28 |
! { dg-prune-output "using .vector_length \\(32\\)., ignoring 7" } |
| 29 |
do ii = 0, n - 1 |
| 30 |
c(ii) = a(ii) + b(ii) |
| 31 |
end do |
| 32 |
!$acc end kernels |
| 33 |
|
| 34 |
do i = 0, n - 1 |
| 35 |
if (a(i) .ne. i * 2) STOP 1 |
| 36 |
if (b(i) .ne. i * 4) STOP 2 |
| 37 |
if (c(i) .ne. a(i) + b(i)) STOP 3 |
| 38 |
end do |
| 39 |
|
| 40 |
end program main |