3.7.4 omp_target_is_accessible – Check whether memory is device accessible


This routine tests whether memory, starting at the address given by ptr and extending size bytes, is accessibly on the device specified by device_num. If so, it returns a nonzero value and otherwise zero.

The address given by ptr is interpreted to be in the address space of the device and size must be positive.

Note that GCC’s current implementation assumes that ptr is a valid host pointer. Therefore, all addresses given by ptr are assumed to be accessible on the initial device. And, to err on the safe side, this memory is only available on a non-host device that can access all host memory ([uniform] shared memory access).

Running this routine in a target region except on the initial device is not supported.

Prototype:int omp_target_is_accessible(const void *ptr,
size_t size,
int device_num)
Interface:integer(c_int) function omp_target_is_accessible(ptr, &
size, device_num) bind(C)
use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int
type(c_ptr), value :: ptr
integer(c_size_t), value :: size
integer(c_int), value :: device_num
See also:

omp_target_associate_ptr – Associate a device pointer with a host pointer


OpenMP specification v5.1, Section 3.8.4