Obtains the free memory and total memory of a specified attribute. This API is synchronous.
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.
Before this API call, you must specify the device for computation (by calling aclrtSetDevice). Therefore, the device ID is not set in this API.
aclError aclrtGetMemInfo(aclrtMemAttr attr, size_t *free, size_t *total)
Parameter |
Input/Output |
Description |
|---|---|---|
attr |
Input |
Memory attribute to be queried typedef enum aclrtMemAttr {
ACL_DDR_MEM, //DDR memory, that is, all huge page memory and normal page memory on the DDR
ACL_HBM_MEM, //HBM memory, that is, all huge page memory and normal page memory on the HBM
ACL_DDR_MEM_HUGE, //DDR huge page memory
ACL_DDR_MEM_NORMAL, //DDR normal page memory
ACL_HBM_MEM_HUGE, //HBM huge page memory
ACL_HBM_MEM_NORMAL, //HBM normal page memory
ACL_DDR_MEM_P2P_HUGE, //Huge page memory for inter-device memory copy on the DDR
ACL_DDR_MEM_P2P_NORMAL, //Normal page memory for inter-device memory copy on the DDR
ACL_HBM_MEM_P2P_HUGE, //Huge page memory for inter-device memory copy on the HBM
ACL_HBM_MEM_P2P_NORMAL, //Normal page memory for inter-device memory copy on the HBM
} aclrtMemAttr; |
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. |
0 on success; else, failure.