`nvmlDeviceGetGraphicsRunningProcesses` failed with Insufficient Size


I’m trying to use NVML APIs to obtain some information. when I call nvmlDeviceGetGraphicsRunningProcesses to get the running processes, it often prints an error named failed with Insufficient Size (7).. The source code is in here.

When I comment the above function nvmlDeviceGetGraphicsRunningProcesses, the output of memory usage is wired.

GPU Memory Total: 134217577 MB
GPU Memory Used: 0 MB

My testing environments are the following two machines.

machine 1:
ubuntu 22.04 X86_64, GTX 1650, driver 525.60.13, nvcc V11.8.89
machine 2:
ubuntu 20.04 X86_64, A5000x2, driver 520.61.05, nvcc V11.6.124

Do you have any ideas about this error?

Thanks for your help! It works.

For memory usage, the nvmlDeviceGetMemoryInfo_v2 always returns some wired numbers. But the nvmlDeviceGetMemoryInfo works well.

Do you have any ideas?

I ask ChatGPT to write the nvml API part. Obviously ChatGPT doesn’t know how to correctly use some APIs. :D

Yes. I did it in the code. But the results of nvmlDeviceGetMemoryInfo_v2 is different from nvmlDeviceGetMemoryInfo. For example, the GPU memory used is 0MB in the result of nvmlDeviceGetMemoryInfo_v2 but I do have some gpu processes. and the result of nvmlDeviceGetMemoryInfo is correct.

Thank you! all issues are solved.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.