Function cuMemExportToShareableHandle

Source
pub unsafe extern "C" fn cuMemExportToShareableHandle(
    shareableHandle: *mut c_void,
    handle: CUmemGenericAllocationHandle,
    handleType: CUmemAllocationHandleType,
    flags: c_ulonglong,
) -> CUresult
Expand description

\brief Exports an allocation to a requested shareable handle type

Given a CUDA memory handle, create a shareable memory allocation handle that can be used to share the memory with other processes. The recipient process can convert the shareable handle back into a CUDA memory handle using ::cuMemImportFromShareableHandle and map it with ::cuMemMap. The implementation of what this handle is and how it can be transferred is defined by the requested handle type in \p handleType

Once all shareable handles are closed and the allocation is released, the allocated memory referenced will be released back to the OS and uses of the CUDA handle afterward will lead to undefined behavior.

This API can also be used in conjunction with other APIs (e.g. Vulkan, OpenGL) that support importing memory from the shareable type

\param[out] shareableHandle - Pointer to the location in which to store the requested handle type \param[in] handle - CUDA handle for the memory allocation \param[in] handleType - Type of shareable handle requested (defines type and size of the \p shareableHandle output parameter) \param[in] flags - Reserved, must be zero \returns ::CUDA_SUCCESS, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_PERMITTED, ::CUDA_ERROR_NOT_SUPPORTED

\sa ::cuMemImportFromShareableHandle