Debian Codegraph @

libgomp/testsuite/libgomp.oacc-fortran/reduction-8.f90

raw
1 ! { dg-do run }
2
3 program reduction
4 implicit none
5 integer, parameter :: n = 100
6 integer :: i, h1, h2, s1, s2, a1, a2
7
8 h1 = 0
9 h2 = 0
10 do i = 1, n
11 h1 = h1 + 1
12 h2 = h2 + 2
13 end do
14
15 s1 = 0
16 s2 = 0
17 !$acc parallel loop reduction(+:s1, s2)
18 do i = 1, n
19 s1 = s1 + 1
20 s2 = s2 + 2
21 end do
22 !$acc end parallel loop
23
24 a1 = 0
25 a2 = 0
26 !$acc parallel loop reduction(+:a1, a2) async(1)
27 do i = 1, n
28 a1 = a1 + 1
29 a2 = a2 + 2
30 end do
31 !$acc end parallel loop
32
33 if (h1 .ne. s1) STOP 1
34 if (h2 .ne. s2) STOP 2
35
36 !$acc wait(1)
37
38 if (h1 .ne. a1) STOP 3
39 if (h2 .ne. a2) STOP 4
40
41 end program reduction