warp.copy#

warp.copy(dest, src, dest_offset=0, src_offset=0, count=0, stream=None)[source]#

Copy array contents from src to dest.

Parameters:
  • dest (array) – Destination array, must be at least as large as source buffer

  • src (array) – Source array

  • dest_offset (int) – Non-negative element offset in the destination array

  • src_offset (int) – Non-negative element offset in the source array

  • count (int) – Number of array elements to copy (must be non-negative; copies all elements if set to 0)

  • stream (Stream | None) – The stream on which to perform the copy

The stream, if specified, can be from any device. If the stream is omitted, then Warp selects a stream based on the following rules: (1) If the destination array is on a CUDA device, use the current stream on the destination device. (2) Otherwise, if the source array is on a CUDA device, use the current stream on the source device.

If neither source nor destination are on a CUDA device, no stream is used for the copy.

The source and destination arrays must have the same element size in bytes; a copy between arrays whose element sizes differ raises an error.

When the source or destination is non-contiguous (e.g. a strided slice), dest_offset, src_offset, and count are only supported for one-dimensional arrays; using them with multi-dimensional non-contiguous, indexed, or Fabric arrays raises an error.