We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Device_utilization_desc_of_container 数据采集始终为0, 调试libvgpu 发现找不到hostpid
代码修改如下
int get_used_gpu_utilization(int *userutil,int *sysprocnum) { struct timeval cur; size_t microsec; int i,sum=0; unsigned int infcount; size_t summonitor=0; nvmlProcessInfo_v1_t infos[SHARED_REGION_MAX_PROCESS_NUM]; unsigned int nvmlCounts; CHECK_NVML_API(nvmlDeviceGetCount(&nvmlCounts)); int devi,cudadev; for (devi=0;devi<nvmlCounts;devi++){ sum=0; summonitor=0; shrreg_proc_slot_t *proc; cudadev = nvml_to_cuda_map((unsigned int)(devi)); if (cudadev<0) continue; nvmlDevice_t device; char uuid[NVML_DEVICE_UUID_BUFFER_SIZE]; CHECK_NVML_API(nvmlDeviceGetHandleByIndex(cudadev, &device)); // Get device UUID CHECK_NVML_API(nvmlDeviceGetUUID(device, uuid, NVML_DEVICE_UUID_BUFFER_SIZE)); nvmlReturn_t res = nvmlDeviceGetComputeRunningProcesses(device,&infcount,infos); if (res==NVML_ERROR_INSUFFICIENT_SIZE){ continue; } gettimeofday(&cur,NULL); microsec = (cur.tv_sec - 1) * 1000UL * 1000UL + cur.tv_usec; nvmlProcessUtilizationSample_t processes_sample[SHARED_REGION_MAX_PROCESS_NUM]; unsigned int processes_num = SHARED_REGION_MAX_PROCESS_NUM; res = nvmlDeviceGetProcessUtilization(device,processes_sample,&processes_num,microsec); LOG_DEBUG("processes_num=%d\n",processes_num); LOG_DEBUG("Device UUID: %s\n", uuid); LOG_DEBUG("nvmlDeviceGetProcessUtilization res: %d\n", res); if ((res==NVML_ERROR_INSUFFICIENT_SIZE) || (res==NVML_ERROR_NOT_FOUND)){ userutil[cudadev] = 0; for (i=0; i<infcount; i++){ proc = find_proc_by_hostpid(infos[i].pid); if (proc != NULL){ LOG_DEBUG("pid=%u monitor=%lld\n",infos[i].pid,infos[i].usedGpuMemory); summonitor += infos[i].usedGpuMemory; } set_gpu_device_memory_monitor(infos[i].pid,cudadev,summonitor); set_gpu_device_sm_utilization(infos[i].pid,cudadev,0); } continue; } for (i=0; i<processes_num; i++){ //if (processes_sample[i].timeStamp >= microsec){ proc = find_proc_by_hostpid(processes_sample[i].pid); if (proc != NULL){ //LOG_WARN("pid=%u num=%d\n",processes_sample[i].pid,processes_num); //proc = find_proc_by_hostpid(processes_sample[i].pid); //if (proc!=NULL) { // printf("inner pid=%u\n",proc->pid); sum += processes_sample[i].smUtil; summonitor += infos[i].usedGpuMemory; LOG_DEBUG("monitorused=%lld %d %d %d",infos[i].usedGpuMemory,proc->hostpid,proc->pid,pidfound); LOG_DEBUG("smutil=%u %u %u\n",processes_sample[i].smUtil,processes_sample[i].encUtil,processes_sample[i].decUtil); //} } else { LOG_DEBUG("find_proc_by_hostpid proc is null.\n") } set_gpu_device_memory_monitor(processes_sample[i].pid,cudadev,summonitor); set_gpu_device_sm_utilization(processes_sample[i].pid,cudadev,processes_sample[i].smUtil); } if (sum < 0) sum = 0; LOG_DEBUG("sum=%d\n", sum); userutil[cudadev] = sum; } return 0; }
请问是配置不正确吗?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Device_utilization_desc_of_container 数据采集始终为0, 调试libvgpu 发现找不到hostpid
代码修改如下
请问是配置不正确吗?
The text was updated successfully, but these errors were encountered: