cuda.bindings._v2.driver.ipc_open_mem_handle_v2#
- cuda.bindings._v2.driver.ipc_open_mem_handle_v2(handle, unsigned int flags) uint64_t#
Opens an interprocess memory handle exported from another process and returns a device pointer usable in the local process.
Maps memory exported from another process with
cuIpcGetMemHandleinto the current device address space. For contexts on different devicescuIpcOpenMemHandlecan attempt to enable peer access between the devices as if the user calledcuCtxEnablePeerAccess. This behavior is controlled by theCU_IPC_MEM_LAZY_ENABLE_PEER_ACCESSflag.cuDeviceCanAccessPeercan determine if a mapping is possible. Contexts that may openCUipcMemHandlesare restricted in the following way.CUipcMemHandlesfrom eachCUdevicein a given process may only be opened by oneCUcontextperCUdeviceper other process. If the memory handle has already been opened by the current context, the reference count on the handle is incremented by 1 and the existing device pointer is returned. Memory returned fromcuIpcOpenMemHandlemust be freed withcuIpcCloseMemHandle. CallingcuMemFreeon an exported memory region before callingcuIpcCloseMemHandlein the importing context will result in undefined behavior. IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC functionality by callingcuapiDeviceGetAttributewithCU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED.- Parameters:
handle (CUipcMemHandle_v1) –
CUipcMemHandleto open.flags (unsigned int) – flags for this operation. Must be specified as
CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS.
- Returns:
Returned device pointer.
- Return type:
uint64_t
Note
No guarantees are made about the address returned in
*pdptr. In particular, multiple processes may not receive the same address for the samehandle.See also
cuIpcOpenMemHandle_v2