COMMON /mine/ z |
INTEGER x(3), y(3), z |
!$OMP THREADPRIVATE(mine) |
!$OMP PARALLEL DO DEFAULT(PRIVATE), SHARED(x) |
DO k = 1, 3 |
x(k) = k |
y(k) = k*k |
z = z + x(i)*y(i) |
END DO |
!$OMP END PARALLEL DO |
SHARED MEMORY |
x |
1 |
2 |
3 |
z |
36 |
Thread 0 |
z' |
1 |
y |
1 |
Thread 1 |
z' |
4 |
y |
4 |
Thread 2 |
z' |
9 |
y |
9 |