NVIDIA / go-nvml

Go Bindings for the NVIDIA Management Library (NVML)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to call GetProcessUtilization: Insufficient Size

qisikai opened this issue · comments

info

go.mod: 
github.com/NVIDIA/go-nvml v0.11.1-0

code

sinceTs := time.Now().Add(-20*time.Second).UnixNano() / 1000
puis, ret := dev.GetProcessUtilization(uint64(sinceTs))

got

Insufficient Size (7, NVML_ERROR_INSUFFICIENT_SIZE)

@klueska plz help to deal with it, thank you

@qisikai thanks for reporting this.

Looking at the code, the issue is that we make a call to GetProcessUtilization once to get the number of samples and then use this value in a second call to retrieve the samples. However, it is likely that more samples were generated between these two calls.

If you like, you could submit a PR for the fix (the code here should follow a similar flow to DeviceGetSupportedVgpus), or we will work on it on our end.