cuda.bindings._v2.driver.mem_map#

cuda.bindings._v2.driver.mem_map(
uint64_t ptr,
size_t size,
size_t offset,
uint64_t handle,
unsigned long long flags,
)#

Maps an allocation handle to a reserved virtual address range.

Maps bytes of memory represented by handle starting from byte offset to size to address range [addr, addr + size]. This range must be an address reservation previously reserved with cuMemAddressReserve, and offset + size must be less than the size of the memory allocation. Both ptr, size, and offset must be a multiple of the value given via cuMemGetAllocationGranularity with the CU_MEM_ALLOC_GRANULARITY_MINIMUM flag. If handle represents a multicast object, ptr, size and offset must be aligned to the value returned by cuMulticastGetGranularity with the flag CU_MULTICAST_MINIMUM_GRANULARITY. For best performance however, it is recommended that ptr, size and offset be aligned to the value returned by cuMulticastGetGranularity with the flag CU_MULTICAST_RECOMMENDED_GRANULARITY. When handle represents a multicast object, this call may fail if the devices added via cuMulticastAddDevice do not belong to the same clique. When handle represents a multicast object, this call may return CUDA_ERROR_ILLEGAL_STATE if the system configuration is in an illegal state. In such cases, to continue using multicast, verify that the system configuration is in a valid state and all required driver daemons are running properly. Please note calling cuMemMap does not make the address accessible, the caller needs to update accessibility of a contiguous mapped VA range by calling cuMemSetAccess. Once a recipient process obtains a shareable memory handle from cuMemImportFromShareableHandle, the process must use cuMemMap to map the memory into its address ranges before setting accessibility with cuMemSetAccess. cuMemMap can only create mappings on VA range reservations that are not currently mapped.

Parameters:
  • ptr (uint64_t) – Address where memory will be mapped.

  • size (size_t) – Size of the memory mapping.

  • offset (size_t) – Offset into the memory represented by.

  • handle (uint64_t) – Handle to a shareable memory.

  • flags (unsigned long long) – flags for future use, must be zero now.

See also

cuMemMap