3.7.5 omp_target_memcpy – Copy data between devices

Description:

This routine copies length of bytes of data from the device identified by device number src_device_num to device dst_device_num. The data is copied from the source device from the address provided by src, shifted by the offset of src_offset bytes, to the destination device’s dst address shifted by dst_offset. The routine returns zero on success and non-zero otherwise.

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

C/C++
Prototype:int omp_target_memcpy(void *dst,
const void *src,
size_t length,
size_t dst_offset,
size_t src_offset,
int dst_device_num,
int src_device_num)
Fortran:
Interface:integer(c_int) function omp_target_memcpy( &
dst, src, length, dst_offset, src_offset, &
dst_device_num, src_device_num) bind(C)
use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int
type(c_ptr), value :: dst, src
integer(c_size_t), value :: length, dst_offset, src_offset
integer(c_int), value :: dst_device_num, src_device_num
See also:

omp_target_memcpy_async – Copy data between devices asynchronously, omp_target_memcpy_rect – Copy a subvolume of data between devices

Reference:

OpenMP specification v5.1, Section 3.8.5