Function: get_mem_info

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

Obtains the free and total memory sizes of an app with specified attributes, excluding the memory size reserved for the system.

Prototype

  • C Prototype
    1
    aclError aclrtGetMemInfo(aclrtMemAttr attr, size_t *free, size_t *total)
    
  • Python Function
    1
    free, total, ret = acl.rt.get_mem_info(attr)
    

Parameters

Parameter

Input/Output

Description

attr

Input

Memory attribute value to be queried. The value is of the int type. For details, see aclrtMemAttr.

Return Value

Return Value

Description

free

Int, free memory size of the corresponding attribute, in bytes.

total

Int, total memory size of the corresponding attribute, in bytes.

ret

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

Restrictions

  • Before calling this API, you must specify the device for computation (for example, call acl.rt.set_device to specify the device for computation). Therefore, the device ID is not displayed in this API.
  • Atlas training product

    Select the memory of a specified attribute based on hardware. Otherwise, the free memory size and total memory size output by this API call are both 0.

  • Atlas A2 training product/Atlas A2 inference product

    Select the memory of a specified attribute based on hardware. Otherwise, the free memory size and total memory size output by this API call are both 0.

  • Atlas 200I/500 A2 inference product

    If on-chip memory is queried, the system automatically queries the DDR memory because the device does not have on-chip memory. For example, the system queries ACL_DDR_MEM instead of ACL_HBM_MEM, and ACL_DDR_MEM_HUGE instead of ACL_HBM_MEM_HUGE.

  • Atlas inference product

    If on-chip memory is queried, the system automatically queries the DDR memory because the device does not have on-chip memory. For example, the system queries ACL_DDR_MEM instead of ACL_HBM_MEM, and ACL_DDR_MEM_HUGE instead of ACL_HBM_MEM_HUGE.

  • Atlas A3 training product/Atlas A3 inference product