Function: mem_get_allocation_granularity

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

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.

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)
    

Parameter Description

Parameter

Description

prop

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

option

Int, minimum or recommended granularity. For details, see aclrtMemGranularityOptions.

Return Value Description

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

This API is not supported in the Ascend RC form.