Parallel Programming Guide for HP-UX Systems

Data privatization
Privatizing task variables
Chapter 6 119
REAL*8 A(1000), B(1000), WRK(1000)
.
.
.
C$DIR BEGIN_TASKS, TASK_PRIVATE(WRK)
DO I = 1, N
WRK(I) = A(I)
ENDDO
DO I = 1, N
A(I) = WRK(N+1-I)
.
.
.
ENDDO
C$DIR NEXT_TASK
DO J = 1, M
WRK(J) = B(J)
ENDDO
DO J = 1, M
B(J) = WRK(M+1-J)
.
.
.
ENDDO
C$DIR END_TASKS
In this example, the WRK array is used in the first task to temporarily
hold the A array so that its order is reversed. It serves the same purpose
for the B array in the second task. WRK is assigned before it is used in
each task.