Function rcudnn_sys::cudaExternalMemoryGetMappedBuffer[][src]

pub unsafe extern "C" fn cudaExternalMemoryGetMappedBuffer(
    devPtr: *mut *mut c_void,
    extMem: cudaExternalMemory_t,
    bufferDesc: *const cudaExternalMemoryBufferDesc
) -> cudaError_t
Expand description

\brief Maps a buffer onto an imported memory object

Maps a buffer onto an imported memory object and returns a device pointer in \p devPtr.

The properties of the buffer being mapped must be described in \p bufferDesc. The ::cudaExternalMemoryBufferDesc structure is defined as follows:

\code typedef struct cudaExternalMemoryBufferDesc_st { unsigned long long offset; unsigned long long size; unsigned int flags; } cudaExternalMemoryBufferDesc; \endcode

where ::cudaExternalMemoryBufferDesc::offset is the offset in the memory object where the buffer’s base address is. ::cudaExternalMemoryBufferDesc::size is the size of the buffer. ::cudaExternalMemoryBufferDesc::flags must be zero.

The offset and size have to be suitably aligned to match the requirements of the external API. Mapping two buffers whose ranges overlap may or may not result in the same virtual address being returned for the overlapped portion. In such cases, the application must ensure that all accesses to that region from the GPU are volatile. Otherwise writes made via one address are not guaranteed to be visible via the other address, even if they’re issued by the same thread. It is recommended that applications map the combined range instead of mapping separate buffers and then apply the appropriate offsets to the returned pointer to derive the individual buffers.

The returned pointer \p devPtr must be freed using ::cudaFree.

\param devPtr - Returned device pointer to buffer \param extMem - Handle to external memory object \param bufferDesc - Buffer descriptor

\return ::cudaSuccess, ::cudaErrorInvalidResourceHandle \notefnerr \note_init_rt \note_callback

\sa ::cudaImportExternalMemory, ::cudaDestroyExternalMemory, ::cudaExternalMemoryGetMappedMipmappedArray