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
-
enumerator CU_FABRIC_COPY_OPERAND_TYPE_POINTER = 0x1
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
opListarray. The length of this array is specified innumOps. 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:
CU_FABRIC_COPY_OPERAND_TYPE_POINTER to CU_FABRIC_COPY_OPERAND_TYPE_POINTER: Copy between two device-accessible pointers. At least one operand must be local to the stream’s device.
CU_FABRIC_COPY_OPERAND_TYPE_POINTER to CU_FABRIC_COPY_OPERAND_TYPE_LOGICAL_ENDPOINT: — copy from a local pointer to a remote UNICAST or MULTICAST logical endpoint at the specified offset.
CU_FABRIC_COPY_OPERAND_TYPE_LOGICAL_ENDPOINT to CU_FABRIC_COPY_OPERAND_TYPE_POINTER: — copy from a remote UNICAST logical endpoint at the specified offset to a local pointer.
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
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.
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.
All operands must be accessible from the stream’s device.
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
numOpscontaining 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