3 ! Like imperfect2.f90, but enables offloading.
6 integer, save :: f1count(3), f2count(3), g1count(3), g2count(3)
7 !$omp declare target enter (f1count, f2count)
8 !$omp declare target enter (g1count, g2count)
26 ! All intervening code at the same depth must be executed the same
28 if (f1count(1) /= f2count(1)) error
stop 101
29 if (f1count(2) /= f2count(2)) error
stop 102
30 if (f1count(3) /= f2count(3)) error
stop 103
31 if (g1count(1) /= f1count(1)) error
stop 104
32 if (g2count(1) /= f1count(1)) error
stop 105
33 if (g1count(2) /= f1count(2)) error
stop 106
34 if (g2count(2) /= f1count(2)) error
stop 107
35 if (g1count(3) /= f1count(3)) error
stop 108
36 if (g2count(3) /= f1count(3)) error
stop 109
38 ! Intervening code must be executed at least as many times as the loop
40 if (f1count(1) < 3) error
stop 111
41 if (f1count(2) < 3 * 4) error
stop 112
43 ! Intervening code must not be executed more times than the number
44 ! of logical iterations.
45 if (f1count(1) > 3 * 4 * 5) error
stop 121
46 if (f1count(2) > 3 * 4 * 5) error
stop 122
48 ! Check that the innermost loop body is executed exactly the number
49 ! of logical iterations expected.
50 if (f1count(3) /= 3 * 4 * 5) error
stop 131
54 subroutine f1 (depth
, iter
)
55 integer :: depth
, iter
57 f1count(depth
) = f1count(depth
) + 1
60 subroutine f2 (depth
, iter
)
61 integer :: depth
, iter
63 f2count(depth
) = f2count(depth
) + 1
66 subroutine g1 (depth
, iter
)
67 integer :: depth
, iter
69 g1count(depth
) = g1count(depth
) + 1
72 subroutine g2 (depth
, iter
)
73 integer :: depth
, iter
75 g2count(depth
) = g2count(depth
) + 1
78 subroutine s1 (a1
, a2
, a3
)
82 !$omp target parallel do collapse(3) map(always, tofrom:f1count, f2count, g1count, g2count)