pub unsafe extern "C" fn hipMemcpy2D(
dst: *mut c_void,
dpitch: usize,
src: *const c_void,
spitch: usize,
width: usize,
height: usize,
kind: hipMemcpyKind,
) -> hipError_tExpand description
@brief Copies data between host and device.
hipMemcpy2D supports memory matrix copy from the pointed area src to the pointed area dst. The copy direction is defined by kind which must be one of #hipMemcpyHostToDevice, #hipMemcpyHostToDevice, #hipMemcpyDeviceToHost #hipMemcpyDeviceToDevice or #hipMemcpyDefault. Device to Device copies don’t need to wait for host synchronization. The copy is executed on the default null tream. The src and dst must not overlap. dpitch and spitch are the widths in bytes in memory matrix, width cannot exceed dpitch or spitch.
For hipMemcpy2D, the copy is always performed by the current device (set by hipSetDevice). For multi-gpu or peer-to-peer configurations, it is recommended to set the current device to the device where the src data is physically located. For optimal peer-to-peer copies, the copy device must be able to access the src and dst pointers (by calling hipDeviceEnablePeerAccess with copy agent as the current device and src/dst as the peerDevice argument. if this is not done, the hipMemcpy2D will still work, but will perform the copy using a staging buffer on the host.
@warning Calling hipMemcpy2D with dst and src pointers that do not match the hipMemcpyKind results in undefined behavior.
@param[in] dst Destination memory address @param[in] dpitch Pitch size in bytes of destination memory @param[in] src Source memory address @param[in] spitch Pitch size in bytes of source memory @param[in] width Width size in bytes of matrix transfer (columns) @param[in] height Height size in bytes of matrix transfer (rows) @param[in] kind Type of transfer @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue, #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection
@see hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol, hipMemcpyAsync