Function: mem_get_allocation_granularity

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Description

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.

Prototype

  • C Prototype
    1
    aclError aclrtMemGetAllocationGranularity(aclrtPhysicalMemProp *prop, aclrtMemGranularityOptions option, size_t *granularity)
    
  • Python Function
    1
    granularity, ret = acl.rt.mem_get_allocation_granularity(prop, option)
    

Parameters

Parameter

Description

prop

Dict, physical memory attributes. For details, see aclrtPhysicalMemProp.

option

Minimum granularity or recommended granularity. For details, see aclrtMemGranularityOptions. The value is of the int type.

Return Value

Return Value

Description

granularity

Int, memory allocation granularity, in bytes. Currently, only 2 MB is supported.

ret

Int, error code. 0 on success; else, failure.

Restrictions

Ascend RC does not support this API.