I’m trying to use the NVML functions to measure my GPU’s energy consumption. I let my GPU sit idle without any workload and call nvmlDeviceGetTotalEnergyConsumption and nvmlDeviceGetPowerUsage every 5 seconds. I also inspect nvidia-smi to see the current power draw.
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 555.42.06 Driver Version: 555.42.06 CUDA Version: 12.5 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA RTX 6000 Ada Gene... Off | 00000000:02:00.0 Off | Off |
| 30% 38C P8 32W / 300W | 2MiB / 49140MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
According to both nvidia-smi and nvmlDeviceGetPowerUsage (mW column in the screenshot), the idle power consumption of my GPU seems to be about 32 W. So every 5 second it should consume about 32 W * 5 s = 160 J (as shown in P*deltaT column in the screenshot). However, the difference between my nvmlDeviceGetTotalEnergyConsumption calls is between 70 J and 100 J (as shown in deltamJ column).
I’m wondering why this is the case. nvmlDeviceGetTotalEnergyConsumption is supposed to return the energy consumption in mJ since the driver reload. So taking the difference between two timestamps should give me the energy consumption during this period. But the number seems to be off by some factor when comparing to power * time.
