cuda.bindings._v2.driver.ctx_enable_peer_access#

cuda.bindings._v2.driver.ctx_enable_peer_access(intptr_t peer_context, unsigned int flags)#

Enables direct access to memory allocations in a peer context.

If both the current context and peer_context are on devices which support unified addressing (as may be queried using CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING) and same major compute capability, then on success all allocations from peer_context will immediately be accessible by the current context. See Unified Addressing for additional details. Note that access granted by this call is unidirectional and that in order to access memory from the current context in peer_context, a separate symmetric call to ctx_enable_peer_access() is required. Note that there are both device-wide and system-wide limitations per system configuration, as noted in the CUDA Programming Guide under the section “Peer- to-Peer Memory Access”. Returns CUDA_ERROR_PEER_ACCESS_UNSUPPORTED if device_can_access_peer() indicates that the CUdevice of the current context cannot directly access memory from the CUdevice of peer_context. Returns CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED if direct access of peer_context from the current context has already been enabled. Returns CUDA_ERROR_TOO_MANY_PEERS if direct peer access is not possible because hardware resources required for peer access have been exhausted. Returns CUDA_ERROR_INVALID_CONTEXT if there is no current context, peer_context is not a valid context, or if the current context is peer_context. Returns CUDA_ERROR_INVALID_VALUE if flags is not 0.

Parameters:
  • peer_context (intptr_t) – Peer context to enable direct access to from the current context.

  • flags (unsigned int) – Reserved for future use and must be set to 0.

See also

cuCtxEnablePeerAccess