comparison libgomp/testsuite/libgomp.fortran/lastprivate2.f90 @ 0:a06113de4d67

first commit
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 14:47:48 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
-1:000000000000 0:a06113de4d67
1 program lastprivate
2 integer :: i, k
3 common /c/ i, k
4 !$omp parallel num_threads (4)
5 call test1
6 !$omp end parallel
7 if (i .ne. 21 .or. k .ne. 20) call abort
8 !$omp parallel num_threads (4)
9 call test2
10 !$omp end parallel
11 if (i .ne. 64 .or. k .ne. 61) call abort
12 !$omp parallel num_threads (4)
13 call test3
14 !$omp end parallel
15 if (i .ne. 14 .or. k .ne. 11) call abort
16 call test4
17 call test5
18 call test6
19 call test7
20 call test8
21 call test9
22 call test10
23 call test11
24 call test12
25 contains
26 subroutine test1
27 integer :: i, k
28 common /c/ i, k
29 !$omp do lastprivate (i, k)
30 do i = 1, 20
31 k = i
32 end do
33 end subroutine test1
34 subroutine test2
35 integer :: i, k
36 common /c/ i, k
37 !$omp do lastprivate (i, k)
38 do i = 7, 61, 3
39 k = i
40 end do
41 end subroutine test2
42 function ret3 ()
43 integer :: ret3
44 ret3 = 3
45 end function ret3
46 subroutine test3
47 integer :: i, k
48 common /c/ i, k
49 !$omp do lastprivate (i, k)
50 do i = -10, 11, ret3 ()
51 k = i
52 end do
53 end subroutine test3
54 subroutine test4
55 integer :: j, l
56 !$omp parallel do lastprivate (j, l) num_threads (4)
57 do j = 1, 20
58 l = j
59 end do
60 if (j .ne. 21 .or. l .ne. 20) call abort
61 end subroutine test4
62 subroutine test5
63 integer :: j, l
64 l = 77
65 !$omp parallel do lastprivate (j, l) num_threads (4) firstprivate (l)
66 do j = 7, 61, 3
67 l = j
68 end do
69 if (j .ne. 64 .or. l .ne. 61) call abort
70 end subroutine test5
71 subroutine test6
72 integer :: j, l
73 !$omp parallel do lastprivate (j, l) num_threads (4)
74 do j = -10, 11, ret3 ()
75 l = j
76 end do
77 if (j .ne. 14 .or. l .ne. 11) call abort
78 end subroutine test6
79 subroutine test7
80 integer :: i, k
81 common /c/ i, k
82 !$omp parallel do lastprivate (i, k) num_threads (4)
83 do i = 1, 20
84 k = i
85 end do
86 if (i .ne. 21 .or. k .ne. 20) call abort
87 end subroutine test7
88 subroutine test8
89 integer :: i, k
90 common /c/ i, k
91 !$omp parallel do lastprivate (i, k) num_threads (4)
92 do i = 7, 61, 3
93 k = i
94 end do
95 if (i .ne. 64 .or. k .ne. 61) call abort
96 end subroutine test8
97 subroutine test9
98 integer :: i, k
99 common /c/ i, k
100 k = 77
101 !$omp parallel do lastprivate (i, k) num_threads (4) firstprivate (k)
102 do i = -10, 11, ret3 ()
103 k = i
104 end do
105 if (i .ne. 14 .or. k .ne. 11) call abort
106 end subroutine test9
107 subroutine test10
108 integer :: i, k
109 common /c/ i, k
110 !$omp parallel num_threads (4)
111 !$omp do lastprivate (i, k)
112 do i = 1, 20
113 k = i
114 end do
115 !$omp end parallel
116 if (i .ne. 21 .or. k .ne. 20) call abort
117 end subroutine test10
118 subroutine test11
119 integer :: i, k
120 common /c/ i, k
121 !$omp parallel num_threads (4)
122 !$omp do lastprivate (i, k)
123 do i = 7, 61, 3
124 k = i
125 end do
126 !$omp end parallel
127 if (i .ne. 64 .or. k .ne. 61) call abort
128 end subroutine test11
129 subroutine test12
130 integer :: i, k
131 common /c/ i, k
132 k = 77
133 !$omp parallel num_threads (4)
134 !$omp do lastprivate (i, k) firstprivate (k)
135 do i = -10, 11, ret3 ()
136 k = i
137 end do
138 !$omp end parallel
139 if (i .ne. 14 .or. k .ne. 11) call abort
140 end subroutine test12
141 end program lastprivate