aclrtGetMemInfo
Description
Obtains the free and total memory sizes of the AscendCL application on the device based on specified attributes, excluding the memory size reserved for the system.
Restrictions
- Before calling this API, you must specify the compute device (for example, calling aclrtSetDevice to specify the compute device). Therefore, the device ID is not 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 200/300/500 Inference Product Atlas Training Series Product
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 of a specified attribute, in bytes. |
total |
Output |
Pointer to the total memory of a specified attribute, in bytes. |
Returns
The value 0 indicates success, and other values indicate failure. For details, see aclError.
Parent topic: Memory Management