2 ! { dg-options "-std=legacy" }
11 subroutine test_parallel
12 integer :: a
, b
, c
, e
, f
, g
, i
, j
13 integer, dimension (20) :: d
27 !$omp if (a .eq. 6) private (b, c) shared (d) private (e) &
28 !$omp firstprivate(f) num_threads (a - 1) first&
29 !$ompprivate(g)default (shared) reduction (.or. : h) &
31 if (i
.ne
. 1) h
= .true
.
33 if (f
.ne
. 24) h
= .true
.
34 if (g
.ne
. 27) h
= .true
.
36 b
= omp_get_thread_num ()
40 c
= omp_get_num_threads ()
41 if (c
.gt
. a
- 1 .or
. c
.le
. 0) h
= .true
.
42 if (b
.ge
. c
) h
= .true
.
44 if (f
.ne
. g
.or
. f
.ne
. b
) h
= .true
.
49 if (d(1) .eq
. -1) stop 4
52 if (d(g
) .ne
. d(1)) stop 5
56 end subroutine test_parallel
58 subroutine test_do_orphan
60 !$omp parallel do private (l)
63 end subroutine test_do_orphan
66 integer :: i
, j
, k
, l
, n
67 integer, dimension (64) :: d
74 !$omp parallel num_threads (4) shared (i, k, d) private (l) &
75 !$omp&reduction (.and. : m)
76 if (omp_get_thread_num () .eq
. 0) then
77 k
= omp_get_num_threads ()
80 !$omp do schedule (static) firstprivate (n)
82 if (i
.eq
. 1 .and
. n
.ne
. 24) stop 7
84 200 d(n
) = omp_get_thread_num ()
87 !$omp do lastprivate (i) schedule (static, 5)
88 do 201 i
= j
+ 1, 2 * j
89 201 d(i
) = omp_get_thread_num () + 1024
90 ! Implied omp end do here
92 if (i
.ne
. 33) m
= .false
.
94 !$omp do private (j) schedule (dynamic)
96 d(i
) = omp_get_thread_num () + 2048
100 !$omp do schedule (runtime)
102 d(i
) = omp_get_thread_num () + 4096
104 ! Implied omp end do here
110 if (d(i
) .lt
. j
.or
. d(i
) .ge
. j
+ k
) stop 9
111 if (i
.eq
. 16) j
= 1024
112 if (i
.eq
. 32) j
= 2048
113 if (i
.eq
. 48) j
= 4096
115 end subroutine test_do
117 subroutine test_sections
118 integer :: i
, j
, k
, l
, m
, n
125 call omp_set_dynamic (.false
.)
126 call omp_set_num_threads (4)
127 !$omp parallel num_threads (4)
128 !$omp sections private (i) firstprivate (j, k) lastprivate (j) &
129 !$omp& reduction (+ : l, m)
132 if (j
.ne
. 10 .or
. k
.ne
. 11 .or
. m
.ne
. 0) l
= 1
136 if (j
.ne
. 10 .or
. k
.ne
. 11) l
= 1
140 if (j
.ne
. 10 .or
. k
.ne
. 11) l
= 1
144 if (j
.ne
. 10 .or
. k
.ne
. 11) l
= 1
147 !$omp end sections nowait
148 !$omp sections lastprivate (n)
155 if (j
.ne
. 271 .or
. l
.ne
. 0) stop 10
156 if (m
.ne
. 4 + 6 + 8 + 10) stop 11
157 if (n
.ne
. 7) stop 12
158 end subroutine test_sections
160 subroutine test_single
161 integer :: i
, j
, k
, l
168 !$omp parallel num_threads (4), private (i, j), reduction (.or. : m)
169 i
= omp_get_thread_num ()
170 j
= omp_get_thread_num ()
171 !$omp single private (k)
173 !$omp end single nowait
174 !$omp single private (k) firstprivate (l)
175 if (i
.ne
. omp_get_thread_num () .or
. i
.ne
. j
) then
180 if (l
.ne
. 500) j
= -1
182 !$omp end single copyprivate (j)
183 if (i
.ne
. omp_get_thread_num () .or
. j
.ne
. -2) m
= .true
.
186 end subroutine test_single