omp_target_associate_ptr
Purpose
The omp_target_associate_ptr function associates a device pointer with a host pointer. When the host pointer appears in a subsequent map clause, the associated device pointer is used as the target for data motion that is associated with that host pointer.
Prototype
int omp_target_associate_ptr(void * host_ptr, void * device_ptr,
size_t size, size_t device_offset, int device_num);
Parameters
- host_ptr
- Specifies the address in the memory of the host device.
- device_ptr
- Specifies the address in the memory of the target device denoted by device_num.
- size
- Specifies the size in bytes of the buffer that is being pointed to.
- device_offset
- Specifies the offset to be applied to device_ptr. device_ptr with the offset device_offset is used as the base address for the device side of the mapping.
- device_num
- Must be the device number of the host device or be non-negative and less than the number of target devices.
Usage
The function returns zero on success and nonzero on failure.
You can associate only one device buffer with a given host pointer value and device number pair.
The result of associating pointers that share underlying storage is unspecified. You can use the omp_target_is_present function to test whether a given host pointer has a corresponding variable in the device data environment.
You cannot call this function on a target device. 


