13 !$omp parallel num_threads (4)
16 j
= omp_get_thread_num () .eq
. 0
19 if (.not
. (i
.or
. j
)) call abort
20 end subroutine test_master
22 subroutine test_critical_1 (i
, j
)
24 !$omp critical(critical_foo)
26 !$omp end critical (critical_foo)
30 end subroutine test_critical_1
32 subroutine test_critical
37 !$omp parallel num_threads (4)
38 if (omp_get_thread_num () .eq
. 0) n
= omp_get_num_threads ()
39 call test_critical_1 (i
, j
)
40 call test_critical_1 (i
, j
)
44 !$omp critical (critical_foo)
46 !$omp endcritical (critical_foo)
48 if (n
.lt
. 1 .or
. i
.ne
. n
* 3 .or
. j
.ne
. n
* 3) call abort
49 end subroutine test_critical
51 subroutine test_barrier
56 !$omp parallel num_threads (4)
57 if (omp_get_thread_num () .eq
. 0) i
= 5
65 if (i
.ne
. 5 .or
. j
) call abort
66 end subroutine test_barrier
68 subroutine test_atomic
69 integer :: a
, b
, c
, d
, e
, f
, g
77 !$omp parallel num_threads (8)
87 e
= min (e
, omp_get_thread_num ())
89 f
= max (omp_get_thread_num (), f
)
90 if (omp_get_thread_num () .eq
. 0) g
= omp_get_num_threads ()
92 if (g
.le
. 0 .or
. g
.gt
. 8) call abort
93 if (a
.ne
. 6 * g
.or
. b
.ne
. 3 ** g
) call abort
94 if (iand (g
, 1) .eq
. 1) then
95 if (c
.ne
. 8) call abort
96 else if (c
.ne
. 0) then
99 if (d
.ne
. 1024 / (2 ** g
)) call abort
100 if (e
.ne
. 0 .or
. f
.ne
. g
- 1) call abort
101 end subroutine test_atomic