cuda.bindings._v2.driver.memcpy_batch_async#
- cuda.bindings._v2.driver.memcpy_batch_async(
- dsts,
- srcs,
- sizes,
- attrs,
- attrs_idxs,
- intptr_t h_stream,
Perform a batch of memory copies asynchronously.
The batch as a whole executes in stream order but copies within a batch are not guaranteed to execute in any specific order. This API only supports pointer-to-pointer copies; for copies involving CUDA arrays use
cuMemcpy3DBatchAsync.Every copy in the batch must be associated with a set of attributes via
attrs. Each entry inattrscan apply to more than one copy; theattrs_idxsarray gives the index of the first copy each attribute entry applies to. The first entry inattrs_idxsmust always be 0, entries must be strictly increasing, andlen(attrs)must be ≤len(dsts).CUmemcpyAttributes.srcAccessOrdercontrols source access ordering:CU_MEMCPY_SRC_ACCESS_ORDER_STREAM: source is accessed in stream order.CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL: source access is out of stream order but all accesses complete before the API returns (suited for ephemeral stack variables; allows the driver to optimize the copy and removes the need for a stream sync after the call).CU_MEMCPY_SRC_ACCESS_ORDER_ANY: source access is out of stream order and accesses may occur even after the API returns (suited for non-CUDA-allocated host pointers such as those frommalloc).
Each copy must have a valid
CUmemcpyAttributeswith an appropriatesrcAccessOrder; otherwiseCUDA_ERROR_INVALID_VALUEis returned.dsts,srcs, andsizesmust all have the same length;countis inferred from that length.attrsandattrs_idxsmust both beNoneor both be provided with the same length;numAttrsis inferred from that length.- Parameters:
dsts – Buffer of destination device pointers (e.g. numpy
uint64array).srcs – Buffer of source device pointers (e.g. numpy
uint64array).sizes – Buffer of copy sizes in bytes (e.g. numpy
uint64array).attrs – Buffer of
MemCpyAttributes_v1values, orNone.attrs_idxs – Buffer of per-attribute copy indices parallel to
attrs, orNoneifattrsisNone.h_stream (intptr_t) – Stream on which to perform the copies.
See also
cuMemcpyBatchAsync