4 implicit none (external, type)
5 integer :: d
, id
, i
, j
, k
, l
7 integer, target
:: q(0:127)
10 integer(kind
=c_size_t
) :: volume(0:2)
11 integer(kind
=c_size_t
) :: dst_offsets(0:2)
12 integer(kind
=c_size_t
) :: src_offsets(0:2)
13 integer(kind
=c_size_t
) :: dst_dimensions(0:2)
14 integer(kind
=c_size_t
) :: src_dimensions(0:2)
15 integer(kind
=c_size_t
) :: empty(1:0)
18 d
= omp_get_default_device ()
19 id
= omp_get_initial_device ()
21 if (d
< 0 .or
. d
>= omp_get_num_devices ()) &
25 p
= omp_target_alloc (130 * c_sizeof (q
), d
)
26 if (.not
. c_associated (p
)) &
29 if (omp_target_memcpy_rect (C_NULL_PTR
, C_NULL_PTR
, 0_c_size_t
, 0, &
30 empty
, empty
, empty
, empty
, empty
, d
, id
) < 3 &
31 .or
. omp_target_memcpy_rect (C_NULL_PTR
, C_NULL_PTR
, 0_c_size_t
, 0, &
32 empty
, empty
, empty
, empty
, empty
, &
34 .or
. omp_target_memcpy_rect (C_NULL_PTR
, C_NULL_PTR
, 0_c_size_t
, 0, &
35 empty
, empty
, empty
, empty
, empty
, &
39 if (omp_target_associate_ptr (c_loc (q
), p
, 128 * c_sizeof (q(0)), &
40 c_sizeof (q(0)), d
) == 0) then
41 volume
= [ 128, 0, 0 ]
42 dst_offsets
= [ 0, 0, 0 ]
43 src_offsets
= [ 1, 0, 0 ]
44 dst_dimensions
= [ 128, 0, 0 ]
45 src_dimensions
= [ 128, 0, 0 ]
48 if (omp_target_associate_ptr (c_loc (q
), p
, 128 * sizeof (q(0)), &
49 sizeof (q(0)), d
) /= 0) &
52 if (omp_target_is_present (c_loc (q
), d
) /= 1 &
53 .or
. omp_target_is_present (c_loc (q(32)), d
) /= 1 &
54 .or
. omp_target_is_present (c_loc (q(127)), d
) /= 1) &
57 if (omp_target_memcpy (p
, c_loc (q
), 128 * sizeof (q(0)), sizeof (q(0)), &
58 0_c_size_t
, d
, id
) /= 0) &
63 !$omp target if (d >= 0) device (i) map(alloc:q(0:31)) map(from:err)
77 if (omp_target_memcpy_rect (c_loc (q
), p
, sizeof (q(0)), 1, volume
, &
78 dst_offsets
, src_offsets
, dst_dimensions
, &
79 src_dimensions
, id
, d
) /= 0) &
100 src_dimensions(1) = 4
101 src_dimensions(0) = 9
103 if (omp_target_memcpy_rect (p
, c_loc (q
), sizeof (q(0)), 3, volume
, &
104 dst_offsets
, src_offsets
, dst_dimensions
, &
105 src_dimensions
, d
, id
) /= 0) &
110 !$omp target if (d >= 0) device (i) map(alloc:q(1:32)) map(from:err)
115 if (q(j
* 9 + k
* 3 + l
) /= 3 * 12 + 4 + 1 + l
+ k
* 3 + j
* 12) &
125 if (omp_target_memcpy (p
, p
, 10 * sizeof (q(1)), 51 * sizeof (q(1)), &
126 111 * sizeof (q(1)), d
, d
) /= 0) &
131 !$omp target if (d >= 0) device (i) map(alloc:q(0:31)) map(from:err)
134 if (q(50+j
) /= q(110 + j
)) &
142 if (omp_target_disassociate_ptr (c_loc (q
), d
) /= 0) &
146 call omp_target_free (p
, d
)