3.7.3 omp_target_is_present – Check whether storage is mapped

Description:

This routine tests whether storage, identified by the host pointer ptr is mapped to the device specified by device_num. If so, it returns a nonzero value and otherwise zero.

In GCC, this includes self mapping such that omp_target_is_present returns true when device_num specifies the host or when the host and the device share memory. If ptr is a null pointer, true is returned and if device_num is an invalid device number, false is returned.

If those conditions do not apply, true is returned if the association has been established by an explicit or implicit map clause, the declare target directive or a call to the omp_target_associate_ptr routine.

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

C/C++
Prototype:int omp_target_is_present(const void *ptr,
int device_num)
Fortran:
Interface:integer(c_int) function omp_target_is_present(ptr, &
device_num) bind(C)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
type(c_ptr), value :: ptr
integer(c_int), value :: device_num
See also:

omp_target_associate_ptr – Associate a device pointer with a host pointer

Reference:

OpenMP specification v5.1, Section 3.8.3