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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
program lastprivate
integer :: i
common /c/ i
!$omp parallel num_threads (4)
call test1
!$omp end parallel
if (i .ne. 21) STOP 1
!$omp parallel num_threads (4)
call test2
!$omp end parallel
if (i .ne. 64) STOP 2
!$omp parallel num_threads (4)
call test3
!$omp end parallel
if (i .ne. 14) STOP 3
call test4
call test5
call test6
call test7
call test8
call test9
call test10
call test11
call test12
contains
subroutine test1
integer :: i
common /c/ i
!$omp do lastprivate (i)
do i = 1, 20
end do
end subroutine test1
subroutine test2
integer :: i
common /c/ i
!$omp do lastprivate (i)
do i = 7, 61, 3
end do
end subroutine test2
function ret3 ()
integer :: ret3
ret3 = 3
end function ret3
subroutine test3
integer :: i
common /c/ i
!$omp do lastprivate (i)
do i = -10, 11, ret3 ()
end do
end subroutine test3
subroutine test4
integer :: j
!$omp parallel do lastprivate (j) num_threads (4) default (none)
do j = 1, 20
end do
if (j .ne. 21) STOP 4
end subroutine test4
subroutine test5
integer :: j
!$omp parallel do lastprivate (j) num_threads (4) default (none)
do j = 7, 61, 3
end do
if (j .ne. 64) STOP 5
end subroutine test5
subroutine test6
integer :: j
!$omp parallel do lastprivate (j) num_threads (4) default (none)
do j = -10, 11, ret3 ()
end do
if (j .ne. 14) STOP 6
end subroutine test6
subroutine test7
integer :: i
common /c/ i
!$omp parallel do lastprivate (i) num_threads (4) default (none)
do i = 1, 20
end do
if (i .ne. 21) STOP 7
end subroutine test7
subroutine test8
integer :: i
common /c/ i
!$omp parallel do lastprivate (i) num_threads (4) default (none)
do i = 7, 61, 3
end do
if (i .ne. 64) STOP 8
end subroutine test8
subroutine test9
integer :: i
common /c/ i
!$omp parallel do lastprivate (i) num_threads (4) default (none)
do i = -10, 11, ret3 ()
end do
if (i .ne. 14) STOP 9
end subroutine test9
subroutine test10
integer :: i
common /c/ i
!$omp parallel num_threads (4) default (none) shared (i)
!$omp do lastprivate (i)
do i = 1, 20
end do
!$omp end parallel
if (i .ne. 21) STOP 10
end subroutine test10
subroutine test11
integer :: i
common /c/ i
!$omp parallel num_threads (4) default (none) shared (i)
!$omp do lastprivate (i)
do i = 7, 61, 3
end do
!$omp end parallel
if (i .ne. 64) STOP 11
end subroutine test11
subroutine test12
integer :: i
common /c/ i
!$omp parallel num_threads (4) default (none) shared (i)
!$omp do lastprivate (i)
do i = -10, 11, ret3 ()
end do
!$omp end parallel
if (i .ne. 14) STOP 12
end subroutine test12
end program lastprivate
|