diff options
author | cltang <cltang@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-06-03 14:25:12 +0000 |
---|---|---|
committer | cltang <cltang@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-06-03 14:25:12 +0000 |
commit | 2234363c4bfaec33b99a8344fd6c15dd1d1c86ea (patch) | |
tree | 23dd423fd8de79a39d2c78c414903727101e5b86 /libgomp | |
parent | 3e346f54bf009e9c2dbccb3654ba1e81c8bb8e26 (diff) | |
download | gcc-2234363c4bfaec33b99a8344fd6c15dd1d1c86ea.tar.gz |
2016-06-03 Chung-Lin Tang <cltang@codesourcery.com>
c/
* c-typeck.c (c_finish_omp_clauses): Mark OpenACC reduction
arguments as addressable when async clause exists.
cp/
* semantics.c (finish_omp_clauses): Mark OpenACC reduction
arguments as addressable when async clause exists.
fortran/
* trans-openmp.c (gfc_trans_omp_reduction_list): Add mark_addressable
bool parameter, set reduction clause DECLs as addressable when true.
(gfc_trans_omp_clauses): Pass clauses->async to
gfc_trans_omp_reduction_list, add comment describing OpenACC situation.
libgomp/
* testsuite/libgomp.oacc-fortran/reduction-8.f90: New testcase.
* testsuite/libgomp.oacc-c-c++-common/reduction-8.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237070 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-8.c | 30 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-fortran/reduction-8.f90 | 41 |
2 files changed, 71 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-8.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-8.c new file mode 100644 index 00000000000..d25060572b5 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-8.c @@ -0,0 +1,30 @@ +const int n = 100; + +// Check async over parallel construct with reduction + +int +async_sum (int c) +{ + int s = 0; + +#pragma acc parallel loop num_gangs (10) gang reduction (+:s) async + for (int i = 0; i < n; i++) + s += i+c; + +#pragma acc wait + return s; +} + +int +main() +{ + int result = 0; + + for (int i = 0; i < n; i++) + result += i+1; + + if (async_sum (1) != result) + __builtin_abort (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.oacc-fortran/reduction-8.f90 b/libgomp/testsuite/libgomp.oacc-fortran/reduction-8.f90 new file mode 100644 index 00000000000..5cf4681191b --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/reduction-8.f90 @@ -0,0 +1,41 @@ +! { dg-do run } + +program reduction + implicit none + integer, parameter :: n = 100 + integer :: i, h1, h2, s1, s2, a1, a2 + + h1 = 0 + h2 = 0 + do i = 1, n + h1 = h1 + 1 + h2 = h2 + 2 + end do + + s1 = 0 + s2 = 0 + !$acc parallel loop reduction(+:s1, s2) + do i = 1, n + s1 = s1 + 1 + s2 = s2 + 2 + end do + !$acc end parallel loop + + a1 = 0 + a2 = 0 + !$acc parallel loop reduction(+:a1, a2) async(1) + do i = 1, n + a1 = a1 + 1 + a2 = a2 + 2 + end do + !$acc end parallel loop + + if (h1 .ne. s1) call abort () + if (h2 .ne. s2) call abort () + + !$acc wait(1) + + if (h1 .ne. a1) call abort () + if (h2 .ne. a2) call abort () + +end program reduction |