Function: mem_get_allocation_granularity

C Prototype

aclError aclrtMemGetAllocationGranularity(aclrtPhysicalMemProp *prop, aclrtMemGranularityOptions option, size_t *granularity)

Python Function

granularity, ret = acl.rt.mem_get_allocation_granularity(prop, option)

Function Usage

Queries the memory allocation granularity. The system internally calculates the minimum granularity or recommended granularity for a given allocation specification and returns the granularity using the granularity parameter. This granularity can be used as a multiple of alignment, address size, or address mapping.

Input Description

prop: dict, physical memory attribute information. For details, see aclrtPhysicalMemProp.

option: int, minimum granularity or recommended granularity. For details, see aclrtMemGranularityOptions.

Return Value

granularity: int, memory allocation granularity, in bytes. Only 2 MB is supported.

ret: int, error code.

Restrictions

This API is not supported in Ascend RC form.