cuda.bindings._v2.driver.external_memory_get_mapped_buffer#
- cuda.bindings._v2.driver.external_memory_get_mapped_buffer(
- intptr_t ext_mem,
- buffer_desc,
Maps a buffer onto an imported memory object.
Maps a buffer onto an imported memory object and returns a device pointer in
dev_ptr. The properties of the buffer being mapped must be described inbuffer_desc. TheCUDA_EXTERNAL_MEMORY_BUFFER_DESCstructure is defined as follows:. **View CUDA Toolkit Documentation for a C++ code example**. whereCUDA_EXTERNAL_MEMORY_BUFFER_DESC.offsetis the offset in the memory object where the buffer’s base address is.CUDA_EXTERNAL_MEMORY_BUFFER_DESC.sizeis the size of the buffer.CUDA_EXTERNAL_MEMORY_BUFFER_DESC.flagsmust 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 pointerdev_ptrmust be freed usingcuMemFree.- Parameters:
ext_mem (intptr_t) – Handle to external memory object.
buffer_desc (intptr_t) – Buffer descriptor.
- Returns:
Returned device pointer to buffer.
- Return type:
uint64_t
See also
cuExternalMemoryGetMappedBuffer