bool HIP_get_pid_mem() {
processInfos.clear();
if (!g_rsmi_initialized && !init_rsmi()) {
return false;
}
uint32_t num_items = 0;
rsmi_status_t ret = rsmi_compute_process_info_get(nullptr, &num_items);
if (ret != RSMI_STATUS_SUCCESS && ret != RSMI_STATUS_INSUFFICIENT_SIZE) {
std::cerr << "Failed to get process count: " << ret << std::endl;
return false;
}
if (num_items == 0) {
return true;
}
rsmi_process_info_t* procs = new rsmi_process_info_t[num_items];
ret = rsmi_compute_process_info_get(procs, &num_items);
if (ret != RSMI_STATUS_SUCCESS) {
std::cerr << "Failed to get process information: " << ret << std::endl;
delete[] procs;
return false;
}
for (uint32_t i = 0; i < num_items; i++) {
HipProcessInfo info;
info.pid = procs[i].process_id;
info.usedHIPMemory = procs[i].vram_usage;
processInfos.push_back(info);
std::cout << "Process ID: " << info.pid
<< ", Used HIP Memory: " << info.usedHIPMemory / (1024*1024)
<< " MiB" << std::endl;
}
delete[] procs;
// rsmi_shut_down();
return true;
}
当我使用HIP_get_pid_mem()这个函数在DCU上获取显存使用量的时候,我发现该函数给我返回了一个超大的结果:
"Process ID: 3506246, Used HIP Memory: 133496575 MiB"
请问这是为什么?

暂无数据