gcc/libgomp/testsuite/libgomp.oacc-fortran/data-4-2.f90
Thomas Schwinge 7fd549d24f OpenACC 2.5 default (present) clause
gcc/c/
	* c-parser.c (c_parser_omp_clause_default): Handle
	"OMP_CLAUSE_DEFAULT_PRESENT".
	gcc/cp/
	* parser.c (cp_parser_omp_clause_default): Handle
	"OMP_CLAUSE_DEFAULT_PRESENT".
	gcc/fortran/
	* gfortran.h (enum gfc_omp_default_sharing): Add
	"OMP_DEFAULT_PRESENT".
	* dump-parse-tree.c (show_omp_clauses): Handle it.
	* openmp.c (gfc_match_omp_clauses): Likewise.
	* trans-openmp.c (gfc_trans_omp_clauses): Likewise.
	gcc/
	* tree-core.h (enum omp_clause_default_kind): Add
	"OMP_CLAUSE_DEFAULT_PRESENT".
	* tree-pretty-print.c (dump_omp_clause): Handle it.
	* gimplify.c (enum gimplify_omp_var_data): Add
	"GOVD_MAP_FORCE_PRESENT".
	(gimplify_adjust_omp_clauses_1): Map it to
	"GOMP_MAP_FORCE_PRESENT".
	(oacc_default_clause): Handle "OMP_CLAUSE_DEFAULT_PRESENT".
	gcc/testsuite/
	* c-c++-common/goacc/default-1.c: Update.
	* c-c++-common/goacc/default-2.c: Likewise.
	* c-c++-common/goacc/default-4.c: Likewise.
	* gfortran.dg/goacc/default-1.f95: Likewise.
	* gfortran.dg/goacc/default-4.f: Likewise.
	* c-c++-common/goacc/default-5.c: New file.
	* gfortran.dg/goacc/default-5.f: Likewise.
	libgomp/
	* testsuite/libgomp.oacc-c++/template-reduction.C: Update.
	* testsuite/libgomp.oacc-c-c++-common/nested-2.c: Update.
	* testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/default-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/non-scalar-data.f90: Likewise.

From-SVN: r248280
2017-05-19 15:32:48 +02:00

140 lines
2.9 KiB
Fortran

! Copy of data-4.f90 with self exchanged with host for !acc update, and with
! default (present) clauses added.
! { dg-do run }
program asyncwait
real, allocatable :: a(:), b(:), c(:), d(:), e(:)
integer i, N
N = 64
allocate (a(N))
allocate (b(N))
allocate (c(N))
allocate (d(N))
allocate (e(N))
a(:) = 3.0
b(:) = 0.0
!$acc enter data copyin (a(1:N)) copyin (b(1:N)) copyin (N) async
!$acc parallel default (present) async wait
!$acc loop
do i = 1, N
b(i) = a(i)
end do
!$acc end parallel
!$acc update self (a(1:N), b(1:N)) async wait
!$acc wait
do i = 1, N
if (a(i) .ne. 3.0) call abort
if (b(i) .ne. 3.0) call abort
end do
a(:) = 2.0
b(:) = 0.0
!$acc update device (a(1:N), b(1:N)) async (1)
!$acc parallel default (present) async (1) wait (1)
!$acc loop
do i = 1, N
b(i) = a(i)
end do
!$acc end parallel
!$acc update host (a(1:N), b(1:N)) async (1) wait (1)
!$acc wait (1)
do i = 1, N
if (a(i) .ne. 2.0) call abort
if (b(i) .ne. 2.0) call abort
end do
a(:) = 3.0
b(:) = 0.0
c(:) = 0.0
d(:) = 0.0
!$acc enter data copyin (c(1:N), d(1:N)) async (1)
!$acc update device (a(1:N), b(1:N)) async (1)
!$acc parallel default (present) async (1)
do i = 1, N
b(i) = (a(i) * a(i) * a(i)) / a(i)
end do
!$acc end parallel
!$acc parallel default (present) async (1)
do i = 1, N
c(i) = (a(i) * 4) / a(i)
end do
!$acc end parallel
!$acc parallel default (present) async (1)
do i = 1, N
d(i) = ((a(i) * a(i) + a(i)) / a(i)) - a(i)
end do
!$acc end parallel
!$acc update self (a(1:N), b(1:N), c(1:N), d(1:N)) async (1) wait (1)
!$acc wait (1)
do i = 1, N
if (a(i) .ne. 3.0) call abort
if (b(i) .ne. 9.0) call abort
if (c(i) .ne. 4.0) call abort
if (d(i) .ne. 1.0) call abort
end do
a(:) = 2.0
b(:) = 0.0
c(:) = 0.0
d(:) = 0.0
e(:) = 0.0
!$acc enter data copyin (e(1:N)) async (1)
!$acc update device (a(1:N), b(1:N), c(1:N), d(1:N)) async (1)
!$acc parallel default (present) async (1)
do i = 1, N
b(i) = (a(i) * a(i) * a(i)) / a(i)
end do
!$acc end parallel
!$acc parallel default (present) async (1)
do i = 1, N
c(i) = (a(i) * 4) / a(i)
end do
!$acc end parallel
!$acc parallel default (present) async (1)
do i = 1, N
d(i) = ((a(i) * a(i) + a(i)) / a(i)) - a(i)
end do
!$acc end parallel
!$acc parallel default (present) wait (1) async (1)
do i = 1, N
e(i) = a(i) + b(i) + c(i) + d(i)
end do
!$acc end parallel
!$acc update self (a(1:N), b(1:N), c(1:N), d(1:N), e(1:N)) async (1) wait (1)
!$acc wait (1)
!$acc exit data delete (N, a(1:N), b(1:N), c(1:N), d(1:N), e(1:N))
do i = 1, N
if (a(i) .ne. 2.0) call abort
if (b(i) .ne. 4.0) call abort
if (c(i) .ne. 4.0) call abort
if (d(i) .ne. 1.0) call abort
if (e(i) .ne. 11.0) call abort
end do
end program asyncwait