'Returns a *IpcHandle* from a GPU allocation.'

def get_ipc_handle(self, memory):

    if (not SUPPORTS_IPC):
        raise OSError('OS    does    not    support    CUDA    IPC')
    ipchandle = drvapi.cu_ipc_mem_handle()
    driver.cuIpcGetMemHandle(ctypes.cast(ipchandle, ctypes.POINTER(drvapi.cu_ipc_mem_handle)), memory.handle)
    return IpcHandle(memory, ipchandle, memory.size)
