cuda.bindings._v2.driver.mem_get_location_info#
- cuda.bindings._v2.driver.mem_get_location_info(
- uint64_t ptr,
- size_t size,
- size_t summary_granularity,
- size_t sampling_granularity,
Gets residency information for a memory address range.
Retrieves memory location information for the specified address range starting at
ptrwith sizesize. The API summarizes the location information with a granularity specified bysummary_granularity. For each summary region, the API determines the most common location by sampling memory at intervals defined bysampling_granularitywithin that region. The location information is returned in thelocation_outarray, with one entry per summary region. The total number of locations returned will be ceil(size/summary_granularity). The user is expected to allocate thelocation_outarray with sufficient memory. For example, with an address range of 1GB, asummary_granularityof 128MB, and asampling_granularityof 2MB, the function will:.Divide the 1GB range into 8 summary regions of 128MB each.
Within each 128MB region, sample every 2MB to determine the most common location. If there is a tie a random winner is chosen.
Populate the
location_outarray with 8 entries, one for each 128MB regionsummary_granularityshould be less than or equal tosizeand greater than 0.sampling_granularityshould be less than or equal tosummary_granularity. If thesampling_granularityis set to 0, a system dependent value is used as the granularity. In all other cases, the call returnsCUDA_ERROR_INVALID_VALUE.
When the memory is not resident on any processor, the call returns
CUDA_SUCCESSand the returned location type for that interval isCU_MEM_LOCATION_TYPE_NONE. The memory range must refer to one of the following:.Managed memory allocated via
cuMemAllocManaged, viacuMemAllocFromPoolfrom a managed memory pool or declared via managed variables.System-allocated pageable memory that is not registered via
cuMemHostRegister. If the memory range does not refer to one of the above, the call returnsCUDA_ERROR_INVALID_VALUE.
All devices on the system must have non-zero value of device attribute
CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. If not, this call returnsCUDA_ERROR_NOT_SUPPORTED.- Parameters:
ptr (uint64_t) – Starting address of the memory range to query.
size (size_t) – Size in bytes of the memory range to query.
summary_granularity (size_t) – Granularity in bytes at which to summarize location information.
sampling_granularity (size_t) – Granularity in bytes at which to sample memory within each summary region.
- Returns:
- Array to store location information, one entry
per summary region.
- Return type:
See also
cuMemGetLocationInfo