annotate libgomp/testsuite/libgomp.fortran/lib1.f90 @ 143:76e1cf5455ef

add cbc_gc test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:24:05 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 ! { dg-do run }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 use omp_lib
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 double precision :: d, e
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 logical :: l
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 integer (kind = omp_lock_kind) :: lck
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 integer (kind = omp_nest_lock_kind) :: nlck
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 d = omp_get_wtime ()
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 call omp_init_lock (lck)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 call omp_set_lock (lck)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
14 if (omp_test_lock (lck)) STOP 1
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 call omp_unset_lock (lck)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
16 if (.not. omp_test_lock (lck)) STOP 2
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
17 if (omp_test_lock (lck)) STOP 3
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 call omp_unset_lock (lck)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 call omp_destroy_lock (lck)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 call omp_init_nest_lock (nlck)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
22 if (omp_test_nest_lock (nlck) .ne. 1) STOP 4
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 call omp_set_nest_lock (nlck)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
24 if (omp_test_nest_lock (nlck) .ne. 3) STOP 5
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 call omp_unset_nest_lock (nlck)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 call omp_unset_nest_lock (nlck)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
27 if (omp_test_nest_lock (nlck) .ne. 2) STOP 6
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 call omp_unset_nest_lock (nlck)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 call omp_unset_nest_lock (nlck)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 call omp_destroy_nest_lock (nlck)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 call omp_set_dynamic (.true.)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
33 if (.not. omp_get_dynamic ()) STOP 7
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 call omp_set_dynamic (.false.)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
35 if (omp_get_dynamic ()) STOP 8
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 call omp_set_nested (.true.)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
38 if (.not. omp_get_nested ()) STOP 9
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 call omp_set_nested (.false.)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
40 if (omp_get_nested ()) STOP 10
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 call omp_set_num_threads (5)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
43 if (omp_get_num_threads () .ne. 1) STOP 11
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
44 if (omp_get_max_threads () .ne. 5) STOP 12
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
45 if (omp_get_thread_num () .ne. 0) STOP 13
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 call omp_set_num_threads (3)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
47 if (omp_get_num_threads () .ne. 1) STOP 14
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
48 if (omp_get_max_threads () .ne. 3) STOP 15
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
49 if (omp_get_thread_num () .ne. 0) STOP 16
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 l = .false.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 !$omp parallel reduction (.or.:l)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 l = omp_get_num_threads () .ne. 3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 l = l .or. (omp_get_thread_num () .lt. 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 l = l .or. (omp_get_thread_num () .ge. 3)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 !$omp master
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 l = l .or. (omp_get_thread_num () .ne. 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 !$omp end master
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 !$omp end parallel
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
59 if (l) STOP 17
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
61 if (omp_get_num_procs () .le. 0) STOP 18
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
62 if (omp_in_parallel ()) STOP 19
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 !$omp parallel reduction (.or.:l)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 l = .not. omp_in_parallel ()
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 !$omp end parallel
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 !$omp parallel reduction (.or.:l) if (.true.)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 l = .not. omp_in_parallel ()
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 !$omp end parallel
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
69 if (l) STOP 20
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 e = omp_get_wtime ()
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
72 if (d .gt. e) STOP 21
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 d = omp_get_wtick ()
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 ! Negative precision is definitely wrong,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 ! bigger than 1s clock resolution is also strange
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
76 if (d .le. 0 .or. d .gt. 1.) STOP 22
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 end