Skip to content

Commit

Permalink
Fix energy measurement that is not in microjoules
Browse files Browse the repository at this point in the history
The function nvmlDeviceGetTotalEnergyConsumption returns the energy consumption in millijoules, not microjoules. In order for it to have the same units as the other energy measurements, the returned value should be multiplied by 1000.

More info here: https://docs.nvidia.com/deploy/nvml-api/group__nvmlDeviceQueries.html
  • Loading branch information
kaminetzky authored Oct 1, 2021
1 parent 738387e commit ed67989
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyJoules/device/nvidia_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def configure(self, domains: List[NvidiaGPUDomain] = None):
self._handle = [pynvml.nvmlDeviceGetHandleByIndex(domain.device_id) for domain in self._configured_domains]

def get_energy(self):
return [pynvml.nvmlDeviceGetTotalEnergyConsumption(handle) for handle in self._handle]
return [pynvml.nvmlDeviceGetTotalEnergyConsumption(handle) * 1000 for handle in self._handle]

@staticmethod
def available_domains() -> List[NvidiaGPUDomain]:
Expand Down

0 comments on commit ed67989

Please sign in to comment.