Skip to main content

Module copy

Module copy 

Source
Expand description

Explicit memory copy operations between host and device.

This module provides freestanding functions for copying data between host memory, device memory, and pinned host memory. Each function validates that the source and destination have matching lengths before issuing the underlying CUDA driver call.

For simple cases, the methods on DeviceBuffer (e.g. DeviceBuffer::copy_from_host) are more ergonomic. These freestanding functions are useful when you want to be explicit about the direction of the transfer or when working with PinnedBuffer for async operations.

§Length validation

All functions return CudaError::InvalidValue if the element counts of source and destination do not match.

Functions§

copy_dtod
Copies data from one device buffer to another (device-to-device).
copy_dtod_async
Asynchronously copies data from one device buffer to another.
copy_dtoh
Copies data from a device buffer into a host slice (device-to-host).
copy_dtoh_async
Asynchronously copies data from a device buffer into a pinned host buffer.
copy_dtoh_async_raw
Asynchronously copies data from a device buffer into a host slice.
copy_htod
Copies data from a host slice into a device buffer (host-to-device).
copy_htod_async
Asynchronously copies data from a pinned host buffer into a device buffer.
copy_htod_async_raw
Asynchronously copies data from a host slice into a device buffer.