cuda.bindings._v2.driver.external_memory_get_mapped_buffer#

cuda.bindings._v2.driver.external_memory_get_mapped_buffer(
intptr_t ext_mem,
buffer_desc,
) → uint64_t#

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 in buffer_desc. The CUDA_EXTERNAL_MEMORY_BUFFER_DESC structure is defined as follows:. **View CUDA Toolkit Documentation for a C++ code example**. where CUDA_EXTERNAL_MEMORY_BUFFER_DESC.offset is the offset in the memory object where the buffer’s base address is. CUDA_EXTERNAL_MEMORY_BUFFER_DESC.size is the size of the buffer. CUDA_EXTERNAL_MEMORY_BUFFER_DESC.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 dev_ptr must be freed using cuMemFree.

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