OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [libgomp/] [testsuite/] [libgomp.fortran/] [omp_reduction.f] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
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******************************************************************************
13
 
14
      PROGRAM REDUCTION
15
 
16
      INTEGER I, N
17
      REAL A(100), B(100), SUM
18
 
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
26
 
27
!$OMP PARALLEL DO REDUCTION(+:SUM)
28
      DO I = 1, N
29
        SUM = SUM + (A(I) * B(I))
30
      ENDDO
31
 
32
      PRINT *, '   Sum = ', SUM
33
      END

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.