pub unsafe fn memcpy_batch(
src_ptrs: *const *const c_void,
dst_ptrs: *const *mut c_void,
size_per_copy: usize,
num_copies: usize,
mode: MemcpyBatchMode,
stream: cudaStream_t,
) -> cudaError_tExpand description
Batched memcpy using cudaMemcpyBatchAsync (CUDA 12.9+) and/or individual cudaMemcpyAsync.
Takes HOST arrays of src/dst pointers - no device allocation needed. Direction is auto-determined by CUDA from pointer types using cudaMemcpyDefault.
The mode parameter controls dispatch:
MemcpyBatchMode::BatchedWithFallback: try batch API, fall back to individual copies on errorMemcpyBatchMode::FallbackOnly: always use individual cudaMemcpyAsync loopMemcpyBatchMode::BatchWithoutFallback: try batch API, return error if unavailable
ยงSafety
src_ptrsmust point to a valid array ofnum_copiessource pointersdst_ptrsmust point to a valid array ofnum_copiesdestination pointers- Each source/destination pointer pair must have at least
size_per_copybytes accessible streammust be a valid CUDA stream handle