Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jae-Won Chung <jwnchung@umich.edu>
  • Loading branch information
parthraut and jaywonchung authored Oct 21, 2024
1 parent fb5de42 commit fb12654
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions zeus/device/gpu/amd.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ def __init__(self, gpu_index: int) -> None:
super().__init__(gpu_index)
self._get_handle()

self._supportsGetTotalEnergyConsumption = (
None # Must be set by `supportsGetTotalEnergyConsumption`
)
# Must be set by `supportsGetTotalEnergyConsumption`
self._supportsGetTotalEnergyConsumption = None

_exception_map = {
1: gpu_common.ZeusGPUInvalidArgError, # amdsmi.amdsmi_wrapper.AMDSMI_STATUS_INVAL
Expand Down Expand Up @@ -273,7 +272,7 @@ def supportsGetTotalEnergyConsumption(self) -> bool:
expected_energy = power * wait_time # power is in mW, wait_time is in seconds

# if the difference between measured and expected energy is less than 1% of the expected energy, then the API is supported
if abs(measured_energy - expected_energy) < threshold * expected_energy:
if 0.1 < measured_energy / expected_energy < 10:
self._supportsGetTotalEnergyConsumption = True
else:
self._supportsGetTotalEnergyConsumption = False
Expand Down

0 comments on commit fb12654

Please sign in to comment.