Skip to content

tsim.utils.cuda_helpers.copy_d2h

← Module overview

functioncopy_d2hsource

tsim.utils.cuda_helpers.copy_d2h

def copy_d2h(src, *, dst: np.ndarray | None = None) -> np.ndarray

Device-to-host copy, pinned-destination fast path when available.

Parameters

NameTypeDefaultDescription
src—requiredSingle-device contiguous array-like exposing ``unsafe_buffer_pointer()``, ``nbytes``, ``shape``, and ``dtype``. The caller must sync to the source's stream before invocation (``jax.block_until_ready(src)`` for a jax.Array).
dstnp.ndarray | NoneNoneOptional pre-allocated pinned ndarray to write into. Must have at least ``src.nbytes`` bytes.

Returns

np.ndarrayndarray with the same shape and dtype as ``src``.

source