1 | COMMON /mine/ z |
2 | INTEGER x(3), y(3), z |
3 | !$OMP THREADPRIVATE(mine) |
4 | !$OMP PARALLEL DO DEFAULT(PRIVATE), SHARED(x) |
5 | DO k = 1, 3 |
6 | x(k) = k |
7 | y(k) = k*k |
8 | z = z + x(i)*y(i) |
9 | END DO |
10 | !$OMP END PARALLEL DO |
11 | SHARED MEMORY |
12 | x |
13 | 1 |
14 | 2 |
15 | 3 |
16 | z |
17 | 36 |
18 | Thread 0 |
19 | z' |
20 | 1 |
21 | y |
22 | 1 |
23 | Thread 1 |
24 | z' |
25 | 4 |
26 | y |
27 | 4 |
28 | Thread 2 |
29 | z' |
30 | 9 |
31 | y |
32 | 9 |