When retrieving process utilization with the following snippet
unsigned int count = 100;
nvmlProcessUtilizationSample_t *utilization = (nvmlProcessUtilizationSample_t *)malloc(sizeof(nvmlProcessUtilizationSample_t) * count);
ret = nvmlDeviceGetProcessUtilization(device, utilization, &count, 0);
the count
variable is expected to be updated to “number of processes running” (per documentation). But when there isn’t any process running and count
is expected to be 0, it was left unchanged (count = 100, ret = 0, utilization all zero).
I tested on a machine with two RTX 3090Ti, and this may be the cause that there isn’t any process running on one of the GPU.