forked from LLNL/HPC-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathomp_bug1.f
38 lines (30 loc) · 1.01 KB
/
omp_bug1.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
C******************************************************************************
C FILE: omp_bug1.f
C DESCRIPTION:
C This example attempts to show use of the PARALLEL DO construct. However
C it will generate errors at compile time. Try to determine what is causing
C the error. See omp_bug1fix.f for a corrected version.
C AUTHOR: Blaise Barney 5/99
C LAST REVISED:
C******************************************************************************
PROGRAM WORKSHARE3
INTEGER TID, OMP_GET_THREAD_NUM, N, I, CHUNKSIZE, CHUNK
PARAMETER (N=50)
PARAMETER (CHUNKSIZE=5)
REAL A(N), B(N), C(N)
! Some initializations
DO I = 1, N
A(I) = I * 1.0
B(I) = A(I)
ENDDO
CHUNK = CHUNKSIZE
!$OMP PARALLEL DO SHARED(A,B,C,CHUNK)
!$OMP& PRIVATE(I,TID)
!$OMP& SCHEDULE(STATIC,CHUNK)
TID = OMP_GET_THREAD_NUM()
DO I = 1, N
C(I) = A(I) + B(I)
PRINT *,'TID= ',TID,'I= ',I,'C(I)= ',C(I)
ENDDO
!$OMP END PARALLEL DO
END