diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index ab8cfd47fe34..70db8981a848 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,14 @@ +2016-03-09 Tom de Vries + + * testsuite/libgomp.oacc-fortran/kernels-loop-2.f95: New test. + * testsuite/libgomp.oacc-fortran/kernels-loop-data-2.f95: Same. + * testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit-2.f95: + Same. + * testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit.f95: Same. + * testsuite/libgomp.oacc-fortran/kernels-loop-data-update.f95: Same. + * testsuite/libgomp.oacc-fortran/kernels-loop-data.f95: Same. + * testsuite/libgomp.oacc-fortran/kernels-loop.f95: Same. + 2016-03-07 Martin Jambor * testsuite/lib/libgomp.exp diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-2.f95 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-2.f95 new file mode 100644 index 000000000000..1fb40eee722b --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-2.f95 @@ -0,0 +1,32 @@ +! { dg-do run } +! { dg-options "-ftree-parallelize-loops=32" } + +program main + implicit none + integer, parameter :: n = 1024 + integer, dimension (0:n-1) :: a, b, c + integer :: i, ii + + !$acc kernels copyout (a(0:n-1)) + do i = 0, n - 1 + a(i) = i * 2 + end do + !$acc end kernels + + !$acc kernels copyout (b(0:n-1)) + do i = 0, n -1 + b(i) = i * 4 + end do + !$acc end kernels + + !$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) + do ii = 0, n - 1 + c(ii) = a(ii) + b(ii) + end do + !$acc end kernels + + do i = 0, n - 1 + if (c(i) .ne. a(i) + b(i)) call abort + end do + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-2.f95 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-2.f95 new file mode 100644 index 000000000000..7b52253e6dcd --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-2.f95 @@ -0,0 +1,38 @@ +! { dg-do run } +! { dg-options "-ftree-parallelize-loops=32" } + +program main + implicit none + integer, parameter :: n = 1024 + integer, dimension (0:n-1) :: a, b, c + integer :: i, ii + + !$acc data copyout (a(0:n-1)) + !$acc kernels present (a(0:n-1)) + do i = 0, n - 1 + a(i) = i * 2 + end do + !$acc end kernels + !$acc end data + + !$acc data copyout (b(0:n-1)) + !$acc kernels present (b(0:n-1)) + do i = 0, n -1 + b(i) = i * 4 + end do + !$acc end kernels + !$acc end data + + !$acc data copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) + !$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1)) + do ii = 0, n - 1 + c(ii) = a(ii) + b(ii) + end do + !$acc end kernels + !$acc end data + + do i = 0, n - 1 + if (c(i) .ne. a(i) + b(i)) call abort + end do + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit-2.f95 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit-2.f95 new file mode 100644 index 000000000000..af98efaa702a --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit-2.f95 @@ -0,0 +1,38 @@ +! { dg-do run } +! { dg-options "-ftree-parallelize-loops=32" } + +program main + implicit none + integer, parameter :: n = 1024 + integer, dimension (0:n-1) :: a, b, c + integer :: i, ii + + !$acc enter data create (a(0:n-1)) + !$acc kernels present (a(0:n-1)) + do i = 0, n - 1 + a(i) = i * 2 + end do + !$acc end kernels + !$acc exit data copyout (a(0:n-1)) + + !$acc enter data create (b(0:n-1)) + !$acc kernels present (b(0:n-1)) + do i = 0, n -1 + b(i) = i * 4 + end do + !$acc end kernels + !$acc exit data copyout (b(0:n-1)) + + !$acc enter data copyin (a(0:n-1), b(0:n-1)) create (c(0:n-1)) + !$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1)) + do ii = 0, n - 1 + c(ii) = a(ii) + b(ii) + end do + !$acc end kernels + !$acc exit data copyout (c(0:n-1)) + + do i = 0, n - 1 + if (c(i) .ne. a(i) + b(i)) call abort + end do + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit.f95 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit.f95 new file mode 100644 index 000000000000..bb6f8dca7fc5 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit.f95 @@ -0,0 +1,36 @@ +! { dg-do run } +! { dg-options "-ftree-parallelize-loops=32" } + +program main + implicit none + integer, parameter :: n = 1024 + integer, dimension (0:n-1) :: a, b, c + integer :: i, ii + + !$acc enter data create (a(0:n-1), b(0:n-1), c(0:n-1)) + + !$acc kernels present (a(0:n-1)) + do i = 0, n - 1 + a(i) = i * 2 + end do + !$acc end kernels + + !$acc kernels present (b(0:n-1)) + do i = 0, n -1 + b(i) = i * 4 + end do + !$acc end kernels + + !$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1)) + do ii = 0, n - 1 + c(ii) = a(ii) + b(ii) + end do + !$acc end kernels + + !$acc exit data copyout (a(0:n-1), b(0:n-1), c(0:n-1)) + + do i = 0, n - 1 + if (c(i) .ne. a(i) + b(i)) call abort + end do + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-update.f95 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-update.f95 new file mode 100644 index 000000000000..cab1f2c674c9 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data-update.f95 @@ -0,0 +1,36 @@ +! { dg-do run } +! { dg-options "-ftree-parallelize-loops=32" } + +program main + implicit none + integer, parameter :: n = 1024 + integer, dimension (0:n-1) :: a, b, c + integer :: i, ii + + !$acc enter data create (a(0:n-1), b(0:n-1), c(0:n-1)) + + !$acc kernels present (a(0:n-1)) + do i = 0, n - 1 + a(i) = i * 2 + end do + !$acc end kernels + + do i = 0, n -1 + b(i) = i * 4 + end do + + !$acc update device (b(0:n-1)) + + !$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1)) + do ii = 0, n - 1 + c(ii) = a(ii) + b(ii) + end do + !$acc end kernels + + !$acc exit data copyout (a(0:n-1), c(0:n-1)) + + do i = 0, n - 1 + if (c(i) .ne. a(i) + b(i)) call abort + end do + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data.f95 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data.f95 new file mode 100644 index 000000000000..f26671ddb4d8 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-data.f95 @@ -0,0 +1,36 @@ +! { dg-do run } +! { dg-options "-ftree-parallelize-loops=32" } + +program main + implicit none + integer, parameter :: n = 1024 + integer, dimension (0:n-1) :: a, b, c + integer :: i, ii + + !$acc data copyout (a(0:n-1), b(0:n-1), c(0:n-1)) + + !$acc kernels present (a(0:n-1)) + do i = 0, n - 1 + a(i) = i * 2 + end do + !$acc end kernels + + !$acc kernels present (b(0:n-1)) + do i = 0, n -1 + b(i) = i * 4 + end do + !$acc end kernels + + !$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1)) + do ii = 0, n - 1 + c(ii) = a(ii) + b(ii) + end do + !$acc end kernels + + !$acc end data + + do i = 0, n - 1 + if (c(i) .ne. a(i) + b(i)) call abort + end do + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop.f95 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop.f95 new file mode 100644 index 000000000000..b02dd57396d3 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-loop.f95 @@ -0,0 +1,28 @@ +! { dg-do run } +! { dg-options "-ftree-parallelize-loops=32" } + +program main + implicit none + integer, parameter :: n = 1024 + integer, dimension (0:n-1) :: a, b, c + integer :: i, ii + + do i = 0, n - 1 + a(i) = i * 2 + end do + + do i = 0, n -1 + b(i) = i * 4 + end do + + !$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) + do ii = 0, n - 1 + c(ii) = a(ii) + b(ii) + end do + !$acc end kernels + + do i = 0, n - 1 + if (c(i) .ne. a(i) + b(i)) call abort + end do + +end program main