On 15/07/15 11:28, Thomas Schwinge wrote:
Hi!
On Tue, 14 Jul 2015 14:10:01 -0500, James Norris <jnor...@codesourcery.com>
wrote:
The attached adds testing for the independent clause
with the loop directive in Fortran.
Committed to gomp-4_0-branch.
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-independent.f90
Thanks! I had a look, and per -O2 -ftree-parallelize-loops=32
-fdump-tree-parloops_oacc_kernels-all -fdump-tree-optimized tree dumps,
indeed I see the anticipated »SUCCESS: may be parallelized« as well as
»#pragma omp target oacc_parallel num_gangs(32)« markers, so I think this
test case is being parallelized (as well as it executes correctly). So,
I'm correct in assuming that this is not showcasing the Fortran issue
that Tom raised yesterday?
The issue I remember raising is: PR66873 - fortran variant of outer-1.c
not parallelized by autopar.
I'm not sure if I mentioned it at the meeting, but marking the outer
loop of that example as independent does not result in parallelization
either. So that's something to be investigated.
Thanks,
- Tom
Anyway, assuming that it adds value to the
current set of test cases, should this also be made a compiler test case,
with dg-final directives checking for the anticipated properties, similar
to gcc/testsuite/gfortran.dg/goacc/kernels-loop.f95, for example?
@@ -0,0 +1,43 @@
+! { dg-do run } */
+! { dg-additional-options "-cpp" }
+! { dg-additional-options "-ftree-parallelize-loops=32" }
+
+#define N (1024 * 512)
+
+subroutine foo (a, b, c)
+ integer, parameter :: n = N
+ integer, dimension (n) :: a
+ integer, dimension (n) :: b
+ integer, dimension (n) :: c
+ integer i, ii
+
+ do i = 1, n
+ a(i) = i * 2;
+ end do
+
+ do i = 1, n
+ b(i) = i * 4;
+ end do
+
+ !$acc kernels copyin (a(1:n), b(1:n)) copyout (c(1:n))
+ !$acc loop independent
+ do ii = 1, n
+ c(ii) = a(ii) + b(ii)
+ end do
+ !$acc end kernels
+
+ do i = 1, n
+ if (c(i) .ne. a(i) + b(i)) call abort
+ end do
+
+end subroutine
+
+program main
+ integer, parameter :: n = N
+ integer :: a(n)
+ integer :: b(n)
+ integer :: c(n)
+
+ call foo (a, b, c)
+
+end program main
Grüße,
Thomas