]> gcc.gnu.org Git - gcc.git/blob - libgomp/testsuite/libgomp.oacc-fortran/reduction-4.f90
Merge current set of OpenACC changes from gomp-4_0-branch.
[gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / reduction-4.f90
1 ! { dg-do run }
2
3 ! complex reductions
4
5 program reduction_4
6 implicit none
7
8 integer, parameter :: n = 10, vl = 32
9 integer :: i
10 complex :: vresult, result
11 complex, dimension (n) :: array
12
13 do i = 1, n
14 array(i) = i
15 end do
16
17 result = 0
18 vresult = 0
19
20 ! '+' reductions
21
22 !$acc parallel vector_length(vl) num_gangs(1)
23 !$acc loop reduction(+:result)
24 do i = 1, n
25 result = result + array(i)
26 end do
27 !$acc end parallel
28
29 ! Verify the results
30 do i = 1, n
31 vresult = vresult + array(i)
32 end do
33
34 if (result .ne. vresult) call abort
35
36 result = 1
37 vresult = 1
38
39 ! ! '*' reductions
40 !
41 ! !$acc parallel vector_length(vl)
42 ! !$acc loop reduction(*:result)
43 ! do i = 1, n
44 ! result = result * array(i)
45 ! end do
46 ! !$acc end parallel
47 !
48 ! ! Verify the results
49 ! do i = 1, n
50 ! vresult = vresult * array(i)
51 ! end do
52 !
53 ! if (result.ne.vresult) call abort
54 end program reduction_4
This page took 0.039571 seconds and 5 git commands to generate.