aclrtGetMemInfo
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Description
Obtains the free and total memory sizes on the device based on a specified attribute, excluding the memory size reserved for the system.
Prototype
aclError aclrtGetMemInfo(aclrtMemAttr attr, size_t *free, size_t *total)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
attr |
Input |
Memory attribute to be queried. |
free |
Output |
Pointer to the free memory size of the corresponding attribute, in bytes. |
total |
Output |
Pointer to the total memory size of the corresponding attribute, in bytes. |
Returns
0 on success; else, failure. For details, see aclError.
Restrictions
- Before calling this API, you must specify the compute device (for example, by calling aclrtSetDevice). Therefore, no device ID is involved in this API.
- 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.
This restriction applies to the following models:
Atlas A3 training products /Atlas A3 inference products Atlas A2 training products /Atlas A2 inference products Atlas training products - If HBM memory is queried, the API automatically queries the DDR memory because the device does not have HBM memory. For example, the API queries ACL_DDR_MEM instead of ACL_HBM_MEM, and ACL_DDR_MEM_HUGE instead of ACL_HBM_MEM_HUGE.
This restriction applies to the following models:
Atlas 200I/500 A2 inference products Atlas inference products