4 implicit none (external, type)
5 integer :: d
, id
, n
, shared_mem
, i
6 integer, target
:: a(1:128)
9 d
= omp_get_default_device ()
10 id
= omp_get_initial_device ()
11 n
= omp_get_num_devices ()
13 if (d
< 0 .or
. d
>= n
) &
16 if (omp_target_is_accessible (p
, c_sizeof (d
), n
) /= 1) &
19 if (omp_target_is_accessible (p
, c_sizeof (d
), id
) /= 1) &
22 if (omp_target_is_accessible (p
, c_sizeof (d
), omp_initial_device
) /= 1) &
25 if (omp_target_is_accessible (p
, c_sizeof (d
), -5) /= 0) &
28 if (omp_target_is_accessible (p
, c_sizeof (d
), n
+ 1) /= 0) &
31 ! Currently, a host pointer is accessible if the device supports shared
32 ! memory or omp_target_is_accessible is executed on the host. This
33 ! test case must be adapted when unified shared memory is avialable.
34 do d
= 0, omp_get_num_devices ()
36 !$omp target map (alloc: shared_mem) device (d)
40 if (omp_target_is_accessible (p
, c_sizeof (d
), d
) /= shared_mem
) &
43 if (omp_target_is_accessible (c_loc (a
), 128 * sizeof (a(1)), d
) /= shared_mem
) &
47 if (omp_target_is_accessible (c_loc (a(i
)), sizeof (a(i
)), d
) /= shared_mem
) &