6.20. Fabric Copy

This section describes the fabric copy functions of the low-level CUDA driver application programming interface.

Enumerations

CUfabricCpyOperandType

These flags allow applications to convey the operand type for individual copies specified in cuFabricCpyBatchAsync .

Functions

CUresult cuFabricCpyBatchAsync(size_t numOps, CUDA_FABRIC_COPY_BATCH_OP *opList, unsigned long long flags, CUstream hStream)

Performs a batch of copies over a fabric asynchronously.

Structs

CUDA_FABRIC_COPY_BATCH_OP_st

Struct representing a single copy operation for use with cuFabricCpyBatchAsync .

CUfabricCpyOperand

Struct representing an operand for copy with cuFabricCpyBatchAsync .

6.20.1. Enumerations

enum CUfabricCpyOperandType

These flags allow applications to convey the operand type for individual copies specified in cuFabricCpyBatchAsync.

Values:

enumerator CU_FABRIC_COPY_OPERAND_TYPE_POINTER = 0x1

Copy operand is a valid pointer.

enumerator CU_FABRIC_COPY_OPERAND_TYPE_LOGICAL_ENDPOINT = 0x2

Copy operand is a logical endpoint.

enumerator CU_FABRIC_COPY_OPERAND_TYPE_MAX = 0x7FFFFFFF

6.20.2. Functions

CUresult cuFabricCpyBatchAsync(size_t numOps, CUDA_FABRIC_COPY_BATCH_OP *opList, unsigned long long flags, CUstream hStream)

Performs a batch of copies over a fabric asynchronously.

The batch as a whole executes in stream order but copies within a batch are not guaranteed to execute in any specific order. Specifying dependent copies within a single batch results in undefined behavior.

Performs copies as specified in the opList array. The length of this array is specified in numOps. Each entry describes a copy operation including source and destination operands (::CUDA_FABRIC_COPY_BATCH_OP::src and ::CUDA_FABRIC_COPY_BATCH_OP::dst) and the size in bytes (::CUDA_FABRIC_COPY_BATCH_OP::size). A size of zero makes that operation a no-op while preserving its position in the batch. Its operands are still validated.

The following operand type combinations are supported:

A single batch may contain a heterogeneous mix of operation types.

For a POINTER operand, ::CUfabricCpyOperand::op::ptr::ptr must contain the pointer where the copy begins. For managed memory or pageable memory on supported devices, ::CUfabricCpyOperand::op::ptr::locHint may hint the location of the operand.

For a LOGICAL_ENDPOINT operand, ::CUfabricCpyOperand::op::le::id specifies the logical endpoint and ::CUfabricCpyOperand::op::le::offset specifies the byte offset into that endpoint.

\notes

  1. Source and destination are always accessed in stream order. So care must be taken to ensure that neither operand is deallocated before the copy has completed. In particular, if the source is ephemeral, e.g., a stack variable, then the stream must be synchronized before the variable goes out of scope.

  2. For pointer-to-pointer copies, at least one operand must be local. For copies involving a pointer and a logical endpoint, the pointer must be local. Being “local” means it resides either on the stream’s device, or in the host memory.

  3. All operands must be accessible from the stream’s device.

  4. This API is only available on platforms that support logical endpoints. It returns CUDA_ERROR_NOT_SUPPORTED on all other configurations.

Note

Note that this function may also return error codes from previous, asynchronous launches.

Note

This function exhibits asynchronous behavior for most use cases.

Parameters
  • numOps – - Total number of copy operations.

  • opList – - Array of size numOps containing the copy operations.

  • flags – - Flags for future use, must be zero.

  • hStream – - Stream to enqueue the operations in. Must not be the legacy NULL stream.

Returns

CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_SUPPORTED