PR c++/86342 - -Wdeprecated-copy and system headers.
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / omp_reduction.f
blob0560bd8963d9a307519f915b4f30bc8803beda8c
1 C******************************************************************************
2 C FILE: omp_reduction.f
3 C DESCRIPTION:
4 C OpenMP Example - Combined Parallel Loop Reduction - Fortran Version
5 C This example demonstrates a sum reduction within a combined parallel loop
6 C construct. Notice that default data element scoping is assumed - there
7 C are no clauses specifying shared or private variables. OpenMP will
8 C automatically make loop index variables private within team threads, and
9 C global variables shared.
10 C AUTHOR: Blaise Barney 5/99
11 C LAST REVISED:
12 C******************************************************************************
14 PROGRAM REDUCTION
16 INTEGER I, N
17 REAL A(100), B(100), SUM
19 ! Some initializations
20 N = 100
21 DO I = 1, N
22 A(I) = I *1.0
23 B(I) = A(I)
24 ENDDO
25 SUM = 0.0
27 !$OMP PARALLEL DO REDUCTION(+:SUM)
28 DO I = 1, N
29 SUM = SUM + (A(I) * B(I))
30 ENDDO
32 PRINT *, ' Sum = ', SUM
33 END