Retro68/gcc/libgomp/testsuite/libgomp.oacc-fortran/firstprivate-1.f90

43 lines
720 B
Fortran
Raw Normal View History

2017-04-10 11:32:00 +00:00
! { dg-do run }
program firstprivate
integer, parameter :: Nupper=100
integer :: a, b(Nupper), c, d, n
include "openacc_lib.h"
2018-12-28 15:30:48 +00:00
if (acc_get_device_type () .ne. acc_device_host) then
2017-04-10 11:32:00 +00:00
n = Nupper
else
n = 1
end if
b(:) = -1
a = 5
!$acc parallel firstprivate (a) num_gangs (n)
!$acc loop gang
do i = 1, n
a = a + i
b(i) = a
end do
!$acc end parallel
do i = 1, n
2018-12-28 15:30:48 +00:00
if (b(i) .ne. i + a) STOP 1
2017-04-10 11:32:00 +00:00
end do
!$acc data copy (a)
!$acc parallel firstprivate (a) copyout (c)
a = 10
c = a
!$acc end parallel
!$acc parallel copyout (d) present (a)
d = a
!$acc end parallel
!$acc end data
2018-12-28 15:30:48 +00:00
if (c .ne. 10) STOP 2
if (d .ne. 5) STOP 3
2017-04-10 11:32:00 +00:00
end program firstprivate