mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-24 11:24:05 +08:00
ffbdd78a4a
* testsuite/libgomp.oacc-fortran/abort-1.f90: Add 'dg-do run'. * testsuite/libgomp.oacc-fortran/abort-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Ditto. * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f90: Ditto. * testsuite/libgomp.oacc-fortran/lib-1.f90: Ditto. * testsuite/libgomp.oacc-fortran/common-block-1.f90: Use 'stop' not abort(). * testsuite/libgomp.oacc-fortran/common-block-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/common-block-3.f90: Ditto. * testsuite/libgomp.oacc-fortran/data-1.f90: Ditto. * testsuite/libgomp.oacc-fortran/data-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/data-5.f90: Ditto. * testsuite/libgomp.oacc-fortran/dummy-array.f90: Ditto. * testsuite/libgomp.oacc-fortran/gemm-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/gemm.f90: Ditto. * testsuite/libgomp.oacc-fortran/host_data-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/host_data-3.f90: Ditto. * testsuite/libgomp.oacc-fortran/host_data-4.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-collapse-3.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-collapse-4.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-independent.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-loop-1.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-map-1.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-parallel-loop-data-enter-exit.f95: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-vector-1.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-vector-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-1.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-3.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-4.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-5.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-6.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-private-vars-worker-7.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-reduction-1.f90: Ditto. * testsuite/libgomp.oacc-fortran/lib-12.f90: Ditto. * testsuite/libgomp.oacc-fortran/lib-13.f90: Ditto. * testsuite/libgomp.oacc-fortran/lib-14.f90: Ditto. * testsuite/libgomp.oacc-fortran/kernels-acc-loop-reduction-2.f90: Likewise and also add 'dg-do run'. * testsuite/libgomp.oacc-fortran/kernels-acc-loop-reduction.f90: Ditto. From-SVN: r277503
140 lines
2.0 KiB
Fortran
140 lines
2.0 KiB
Fortran
! { dg-do run }
|
|
!
|
|
! Test data located inside common blocks. This test does not exercise
|
|
! ACC DECLARE. Most of the data clauses are implicit.
|
|
|
|
module consts
|
|
integer, parameter :: n = 100
|
|
end module consts
|
|
|
|
subroutine validate
|
|
use consts
|
|
|
|
implicit none
|
|
integer i, j
|
|
real*4 x(n), y(n), z
|
|
common /BLOCK/ x, y, z, j
|
|
|
|
do i = 1, n
|
|
if (abs(x(i) - i - z) .ge. 0.0001) stop 1
|
|
end do
|
|
end subroutine validate
|
|
|
|
subroutine incr_parallel
|
|
use consts
|
|
|
|
implicit none
|
|
integer i, j
|
|
real*4 x(n), y(n), z
|
|
common /BLOCK/ x, y, z, j
|
|
|
|
!$acc parallel loop
|
|
do i = 1, n
|
|
x(i) = x(i) + z
|
|
end do
|
|
!$acc end parallel loop
|
|
end subroutine incr_parallel
|
|
|
|
subroutine incr_kernels
|
|
use consts
|
|
|
|
implicit none
|
|
integer i, j
|
|
real*4 x(n), y(n), z
|
|
common /BLOCK/ x, y, z, j
|
|
|
|
!$acc kernels
|
|
do i = 1, n
|
|
x(i) = x(i) + z
|
|
end do
|
|
!$acc end kernels
|
|
end subroutine incr_kernels
|
|
|
|
program main
|
|
use consts
|
|
|
|
implicit none
|
|
integer i, j
|
|
real*4 a(n), b(n), c
|
|
common /BLOCK/ a, b, c, j
|
|
|
|
!$acc data copyout(a, c)
|
|
|
|
c = 1.0
|
|
|
|
!$acc update device(c)
|
|
|
|
!$acc parallel loop
|
|
do i = 1, n
|
|
a(i) = i
|
|
end do
|
|
!$acc end parallel loop
|
|
|
|
call incr_parallel
|
|
call incr_parallel
|
|
call incr_parallel
|
|
!$acc end data
|
|
|
|
c = 3.0
|
|
call validate
|
|
|
|
! Test pcopy without copyout
|
|
|
|
c = 2.0
|
|
call incr_kernels
|
|
c = 5.0
|
|
call validate
|
|
|
|
!$acc kernels
|
|
do i = 1, n
|
|
b(i) = i
|
|
end do
|
|
!$acc end kernels
|
|
|
|
!$acc parallel loop
|
|
do i = 1, n
|
|
a(i) = b(i) + c
|
|
end do
|
|
!$acc end parallel loop
|
|
|
|
call validate
|
|
|
|
a(:) = b(:)
|
|
c = 0.0
|
|
call validate
|
|
|
|
! Test copy
|
|
|
|
c = 1.0
|
|
!$acc parallel loop
|
|
do i = 1, n
|
|
a(i) = b(i) + c
|
|
end do
|
|
!$acc end parallel loop
|
|
|
|
call validate
|
|
|
|
c = 2.0
|
|
!$acc data copyin(b, c) copyout(a)
|
|
|
|
!$acc kernels
|
|
do i = 1, n
|
|
a(i) = b(i) + c
|
|
end do
|
|
!$acc end kernels
|
|
|
|
!$acc end data
|
|
|
|
call validate
|
|
|
|
j = 0
|
|
|
|
!$acc parallel loop reduction(+:j)
|
|
do i = 1, n
|
|
j = j + 1
|
|
end do
|
|
!$acc end parallel loop
|
|
|
|
if (j .ne. n) stop 2
|
|
end program main
|