PR c++/86342 - -Wdeprecated-copy and system headers.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / parallel-reduction.f90
blob487cfc436e269ef42eeeb473e6c4e78b4a03d014
1 ! { dg-do run }
2 ! { dg-additional-options "-w" }
4 program reduction
5 implicit none
6 integer, parameter :: n = 10
7 integer s1, s2
8 include "openacc_lib.h"
10 s1 = 0
11 s2 = 0
13 !$acc parallel reduction(+:s1,s2) num_gangs (n) copy(s1)
14 s1 = s1 + 1
15 s2 = s2 + 1
16 !$acc end parallel
18 if (acc_get_device_type () .ne. acc_device_host) then
19 if (s1 .ne. n) STOP 1
20 if (s2 .ne. n) STOP 2
21 else
22 if (s1 .ne. 1) STOP 3
23 if (s2 .ne. 1) STOP 4
24 end if
26 ! Test reductions inside subroutines
28 s1 = 0
29 s2 = 0
30 call redsub (s1, s2, n)
32 if (acc_get_device_type () .ne. acc_device_host) then
33 if (s1 .ne. n) STOP 5
34 else
35 if (s2 .ne. 1) STOP 6
36 end if
37 end program reduction
39 subroutine redsub(s1, s2, n)
40 implicit none
41 integer :: s1, s2, n
43 !$acc parallel reduction(+:s1,s2) num_gangs (10) copy(s1)
44 s1 = s1 + 1
45 s2 = s2 + 1
46 !$acc end parallel
47 end subroutine redsub