2018-03-25 Thomas Koenig <tkoenig@gcc.gnu.org>
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / kernels-loop-data-update.f95
blob4bee0e1e69a347b746851e0e8ea1cf30be2937a9
1 ! { dg-do run }
3 program main
4 implicit none
5 integer, parameter :: n = 1024
6 integer, dimension (0:n-1) :: a, b, c
7 integer :: i, ii
9 !$acc enter data create (a(0:n-1), b(0:n-1), c(0:n-1))
11 !$acc kernels present (a(0:n-1))
12 do i = 0, n - 1
13 a(i) = i * 2
14 end do
15 !$acc end kernels
17 do i = 0, n -1
18 b(i) = i * 4
19 end do
21 !$acc update device (b(0:n-1))
23 !$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
24 do ii = 0, n - 1
25 c(ii) = a(ii) + b(ii)
26 end do
27 !$acc end kernels
29 !$acc exit data copyout (a(0:n-1), c(0:n-1))
31 do i = 0, n - 1
32 if (c(i) .ne. a(i) + b(i)) STOP 1
33 end do
35 end program main