tsim.utils.cuda_helpers.copy_d2h
← Module overview
function
source
functioncopy_d2h¶source
tsim.utils.cuda_helpers.copy_d2h
def copy_d2h(src, *, dst: np.ndarray | None = None) -> np.ndarrayDevice-to-host copy, pinned-destination fast path when available.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
src | — | required | Single-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). |
dst | np.ndarray | None | None | Optional 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``.