2017-04-10 11:32:00 +00:00
|
|
|
! { dg-do run }
|
|
|
|
! { dg-additional-options "-cpp" }
|
|
|
|
|
|
|
|
program main
|
|
|
|
use openacc
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
integer, parameter :: N = 8
|
|
|
|
integer, parameter :: one = 1
|
|
|
|
integer, parameter :: zero = 0
|
|
|
|
integer i, nn
|
|
|
|
real, allocatable :: a(:), b(:)
|
|
|
|
real exp, exp2
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
|
|
|
|
allocate (a(N))
|
|
|
|
allocate (b(N))
|
|
|
|
|
|
|
|
a(:) = 4.0
|
|
|
|
|
|
|
|
!$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 5.0
|
|
|
|
#else
|
|
|
|
exp = 4.0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 1
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 16.0
|
|
|
|
|
|
|
|
!$acc parallel if (0 == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 17.0) STOP 2
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 8.0
|
|
|
|
|
|
|
|
!$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 9.0
|
|
|
|
#else
|
|
|
|
exp = 8.0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 3
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 22.0
|
|
|
|
|
|
|
|
!$acc parallel if (zero == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 23.0) STOP 4
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 16.0
|
|
|
|
|
|
|
|
!$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 17.0;
|
|
|
|
#else
|
|
|
|
exp = 16.0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 5
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 76.0
|
|
|
|
|
|
|
|
!$acc parallel if (.FALSE.)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 77.0) STOP 6
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 22.0
|
|
|
|
|
|
|
|
nn = 1
|
|
|
|
|
|
|
|
!$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (nn == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 23.0;
|
|
|
|
#else
|
|
|
|
exp = 22.0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 7
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 18.0
|
|
|
|
|
|
|
|
nn = 0
|
|
|
|
|
|
|
|
!$acc parallel if (nn == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 19.0) STOP 8
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 49.0
|
|
|
|
|
|
|
|
nn = 1
|
|
|
|
|
|
|
|
!$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 50.0
|
|
|
|
#else
|
|
|
|
exp = 49.0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 9
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 38.0
|
|
|
|
|
|
|
|
nn = 0;
|
|
|
|
|
|
|
|
!$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 39.0) STOP 10
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 91.0
|
|
|
|
|
|
|
|
!$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 92.0) STOP 11
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 43.0
|
|
|
|
|
|
|
|
!$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 44.0
|
|
|
|
#else
|
|
|
|
exp = 43.0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 12
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 87.0
|
|
|
|
|
|
|
|
!$acc parallel if (one == 0)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 88.0) STOP 13
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 3.0
|
|
|
|
b(:) = 9.0
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 0.0
|
|
|
|
exp2 = 0.0
|
|
|
|
#else
|
|
|
|
call acc_copyin (a, sizeof (a))
|
|
|
|
call acc_copyin (b, sizeof (b))
|
|
|
|
exp = 3.0;
|
|
|
|
exp2 = 9.0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc update device (a(1:N), b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
a(:) = 0.0
|
|
|
|
b(:) = 0.0
|
|
|
|
|
|
|
|
!$acc update host (a(1:N), b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (a(i) .ne. exp) STOP 14
|
|
|
|
if (b(i) .ne. exp2) STOP 15
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 6.0
|
|
|
|
b(:) = 12.0
|
|
|
|
|
|
|
|
!$acc update device (a(1:N), b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
a(:) = 0.0
|
|
|
|
b(:) = 0.0
|
|
|
|
|
|
|
|
!$acc update host (a(1:N), b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (a(i) .ne. exp) STOP 16
|
|
|
|
if (b(i) .ne. exp2) STOP 17
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 26.0
|
|
|
|
b(:) = 21.0
|
|
|
|
|
|
|
|
!$acc update device (a(1:N), b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
a(:) = 0.0
|
|
|
|
b(:) = 0.0
|
|
|
|
|
|
|
|
!$acc update host (a(1:N), b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (a(i) .ne. 0.0) STOP 18
|
|
|
|
if (b(i) .ne. 0.0) STOP 19
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
|
|
|
call acc_copyout (a, sizeof (a))
|
|
|
|
call acc_copyout (b, sizeof (b))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
a(:) = 4.0
|
|
|
|
b(:) = 0.0
|
|
|
|
|
|
|
|
!$acc data copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
!$acc parallel present (a(1:N))
|
|
|
|
do i = 1, N
|
|
|
|
b(i) = a(i)
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
!$acc end data
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 4.0) STOP 20
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 8.0
|
|
|
|
b(:) = 1.0
|
|
|
|
|
|
|
|
!$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (a) .eqv. .TRUE.) STOP 21
|
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 22
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc end data
|
|
|
|
|
|
|
|
a(:) = 18.0
|
|
|
|
b(:) = 21.0
|
|
|
|
|
|
|
|
!$acc data copyin (a(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (a) .eqv. .FALSE.) STOP 23
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc data copyout (b(1:N)) if (0 == 1)
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 24
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
!$acc data copyout (b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
!$acc parallel present (a(1:N)) present (b(1:N))
|
|
|
|
do i = 1, N
|
|
|
|
b(i) = a(i)
|
|
|
|
end do
|
|
|
|
!$acc end parallel
|
|
|
|
|
|
|
|
!$acc end data
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 25
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
!$acc end data
|
|
|
|
!$acc end data
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(1) .ne. 18.0) STOP 26
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 27
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .FALSE.) STOP 28
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 29
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (zero == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 30
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (zero == 1)
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (one == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .FALSE.) STOP 31
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (one == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 32
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (one == 0)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 33
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (one == 0)
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (one == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .FALSE.) STOP 34
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (one == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 35
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
a(:) = 4.0
|
|
|
|
|
|
|
|
!$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 5.0
|
|
|
|
#else
|
|
|
|
exp = 4.0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 36
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 16.0
|
|
|
|
|
|
|
|
!$acc kernels if (0 == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 17.0) STOP 37
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 8.0
|
|
|
|
|
|
|
|
!$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 9.0
|
|
|
|
#else
|
|
|
|
exp = 8.0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 38
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 22.0
|
|
|
|
|
|
|
|
!$acc kernels if (zero == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 23.0) STOP 39
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 16.0
|
|
|
|
|
|
|
|
!$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 17.0;
|
|
|
|
#else
|
|
|
|
exp = 16.0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 40
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 76.0
|
|
|
|
|
|
|
|
!$acc kernels if (.FALSE.)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 77.0) STOP 41
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 22.0
|
|
|
|
|
|
|
|
nn = 1
|
|
|
|
|
|
|
|
!$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (nn == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 23.0;
|
|
|
|
#else
|
|
|
|
exp = 22.0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 42
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 18.0
|
|
|
|
|
|
|
|
nn = 0
|
|
|
|
|
|
|
|
!$acc kernels if (nn == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 19.0) STOP 43
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 49.0
|
|
|
|
|
|
|
|
nn = 1
|
|
|
|
|
|
|
|
!$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 50.0
|
|
|
|
#else
|
|
|
|
exp = 49.0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 44
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 38.0
|
|
|
|
|
|
|
|
nn = 0;
|
|
|
|
|
|
|
|
!$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 39.0) STOP 45
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 91.0
|
|
|
|
|
|
|
|
!$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 92.0) STOP 46
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 43.0
|
|
|
|
|
|
|
|
!$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 44.0
|
|
|
|
#else
|
|
|
|
exp = 43.0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. exp) STOP 47
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 87.0
|
|
|
|
|
|
|
|
!$acc kernels if (one == 0)
|
|
|
|
do i = 1, N
|
|
|
|
if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
|
|
|
|
b(i) = a(i) + 1
|
|
|
|
else
|
|
|
|
b(i) = a(i)
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 88.0) STOP 48
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 3.0
|
|
|
|
b(:) = 9.0
|
|
|
|
|
|
|
|
#if ACC_MEM_SHARED
|
|
|
|
exp = 0.0
|
|
|
|
exp2 = 0.0
|
|
|
|
#else
|
|
|
|
call acc_copyin (a, sizeof (a))
|
|
|
|
call acc_copyin (b, sizeof (b))
|
|
|
|
exp = 3.0;
|
|
|
|
exp2 = 9.0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc update device (a(1:N), b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
a(:) = 0.0
|
|
|
|
b(:) = 0.0
|
|
|
|
|
|
|
|
!$acc update host (a(1:N), b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (a(i) .ne. exp) STOP 49
|
|
|
|
if (b(i) .ne. exp2) STOP 50
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 6.0
|
|
|
|
b(:) = 12.0
|
|
|
|
|
|
|
|
!$acc update device (a(1:N), b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
a(:) = 0.0
|
|
|
|
b(:) = 0.0
|
|
|
|
|
|
|
|
!$acc update host (a(1:N), b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (a(i) .ne. exp) STOP 51
|
|
|
|
if (b(i) .ne. exp2) STOP 52
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 26.0
|
|
|
|
b(:) = 21.0
|
|
|
|
|
|
|
|
!$acc update device (a(1:N), b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
a(:) = 0.0
|
|
|
|
b(:) = 0.0
|
|
|
|
|
|
|
|
!$acc update host (a(1:N), b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (a(i) .ne. 0.0) STOP 53
|
|
|
|
if (b(i) .ne. 0.0) STOP 54
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
|
|
|
call acc_copyout (a, sizeof (a))
|
|
|
|
call acc_copyout (b, sizeof (b))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
a(:) = 4.0
|
|
|
|
b(:) = 0.0
|
|
|
|
|
|
|
|
!$acc data copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
!$acc kernels present (a(1:N))
|
|
|
|
do i = 1, N
|
|
|
|
b(i) = a(i)
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
!$acc end data
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(i) .ne. 4.0) STOP 55
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
a(:) = 8.0
|
|
|
|
b(:) = 1.0
|
|
|
|
|
|
|
|
!$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (a) .eqv. .TRUE.) STOP 56
|
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 57
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc end data
|
|
|
|
|
|
|
|
a(:) = 18.0
|
|
|
|
b(:) = 21.0
|
|
|
|
|
|
|
|
!$acc data copyin (a(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (a) .eqv. .FALSE.) STOP 58
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc data copyout (b(1:N)) if (0 == 1)
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 59
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
!$acc data copyout (b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
!$acc kernels present (a(1:N)) present (b(1:N))
|
|
|
|
do i = 1, N
|
|
|
|
b(i) = a(i)
|
|
|
|
end do
|
|
|
|
!$acc end kernels
|
|
|
|
|
|
|
|
!$acc end data
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 60
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
!$acc end data
|
|
|
|
!$acc end data
|
|
|
|
|
|
|
|
do i = 1, N
|
2018-12-28 15:30:48 +00:00
|
|
|
if (b(1) .ne. 18.0) STOP 61
|
2017-04-10 11:32:00 +00:00
|
|
|
end do
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 62
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (0 == 1)
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .FALSE.) STOP 63
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (1 == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 64
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (zero == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 65
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (zero == 1)
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (one == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .FALSE.) STOP 66
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (one == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 67
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (one == 0)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 68
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (one == 0)
|
|
|
|
|
|
|
|
!$acc enter data copyin (b(1:N)) if (one == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .FALSE.) STOP 69
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
!$acc exit data delete (b(1:N)) if (one == 1)
|
|
|
|
|
|
|
|
#if !ACC_MEM_SHARED
|
2018-12-28 15:30:48 +00:00
|
|
|
if (acc_is_present (b) .eqv. .TRUE.) STOP 70
|
2017-04-10 11:32:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
end program main
|