3.7.11 omp_get_mapped_ptr – Return device pointer to a host pointer

Description:

If the device number is refers to the initial device or to a device with memory accessible from the host (shared memory), the omp_get_mapped_ptr routines returns the value of the passed ptr. Otherwise, if associated storage to the passed host pointer ptr exists on device associated with device_num, it returns that pointer. In all other cases and in cases of an error, a null pointer is returned.

The association of storage location is established either via an explicit or implicit map clause, the declare target directive or the omp_target_associate_ptr routine.

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

C/C++
Prototype:void *omp_get_mapped_ptr(const void *ptr, int device_num);
Fortran:
Interface:type(c_ptr) function omp_get_mapped_ptr(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.11