HOME
| OPENMP API Specification: Version 5.1 November 2020

3.8.5  omp_target_memcpy

Summary The omp_target_memcpy routine copies memory between any combination of host and device pointers.

Format

SVG-Viewer needed.

 

 
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 
);  

SVG-Viewer needed.

SVG-Viewer needed.

 

 
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_int, c_size_t 
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  

SVG-Viewer needed.

Constraints on Arguments Each device pointer specified must be valid for the device on the same side of the copy. The dst_device_num and src_device_num arguments must be greater than or equal to zero and less than or equal to the result of omp_get_num_devices().

Binding The binding task set for an omp_target_memcpy region is the generating task, which is the target task generated by the call to the omp_target_memcpy routine.

Effect This routine copies length bytes of memory at offset src_offset from src in the device data environment of device src_device_num to dst starting at offset dst_offset in the device data environment of device dst_device_num.

The omp_target_memcpy routine executes as if part of a target task that is generated by the call to the routine and that is an included task.

The return value is zero on success and non-zero on failure. This routine contains a task scheduling point.

SVG-Viewer needed.

The omp_target_memcpy routine requires an explicit interface and so might not be provided in omp_lib.h.

SVG-Viewer needed.

Execution Model Events The target-data-op-begin event occurs before a thread initiates a data transfer.

The target-data-op-end event occurs after a thread initiated a data transfer.

Tool Callbacks A thread dispatches a registered ompt_callback_target_data_op_emi callback with ompt_scope_begin as its endpoint argument for each occurrence of a target-data-op-begin event in that thread. Similarly, a thread dispatches a registered ompt_callback_target_data_op_emi callback with ompt_scope_end as its endpoint argument for each occurrence of a target-data-op-end event in that thread. These callbacks have type signature ompt_callback_target_data_op_emi_t.

A thread dispatches a registered ompt_callback_target_data_op callback for each occurrence of a target-data-op-end event in that thread. The callback occurs in the context of the target task and has type signature ompt_callback_target_data_op_t.

Restrictions Restrictions to the omp_target_memcpy routine are as follows.

Cross References