1 C******************************************************************************
4 C OpenMP Example - Parallel region with an orphaned directive - Fortran
6 C This example demonstrates a dot product being performed by an orphaned
7 C loop reduction construct. Scoping of the reduction variable is critical.
8 C AUTHOR: Blaise Barney 5/99
10 C******************************************************************************
13 COMMON /DOTDATA
/ A
, B
, SUM
15 PARAMETER (VECLEN
= 100)
16 REAL*8 A
(VECLEN
), B
(VECLEN
), SUM
26 WRITE(*,*) "Sum = ", SUM
32 COMMON /DOTDATA
/ A
, B
, SUM
33 INTEGER I
, TID
, OMP_GET_THREAD_NUM
, VECLEN
34 PARAMETER (VECLEN
= 100)
35 REAL*8 A
(VECLEN
), B
(VECLEN
), SUM
37 TID
= OMP_GET_THREAD_NUM
()
38 !$OMP
DO REDUCTION
(+:SUM
)
40 SUM
= SUM
+ (A
(I
)*B
(I
))
41 PRINT
*, ' TID= ',TID
,'I= ',I