Skip to content

Commit

Permalink
Compute power only in start - stop window
Browse files Browse the repository at this point in the history
  • Loading branch information
pgmpablo157321 committed Jul 31, 2024
1 parent b5cb220 commit 90cdb71
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions mlperf_logging/result_summarizer/result_summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,23 +521,35 @@ def _compute_power_node(loglines, time_to_train):
power_stop = 0
agg_power = 0
conversion_eff = 1.0
power_stop_found = False
power_start_found = False
loglines.sort(key=lambda x: x.timestamp)
for logline in loglines:
if logline.key == "power_measurement_start":
power_start = logline.timestamp
prev_timestamp = logline.timestamp
if logline.key == "power_reading":
agg_power += (logline.value['value'] * (logline.timestamp - prev_timestamp))
power_start_found = True
if (
(logline.key == "power_reading")
and (not power_stop_found)
and (power_start_found)
):
agg_power += logline.value["value"] * (logline.timestamp - prev_timestamp)
prev_timestamp = logline.timestamp
max_timestamp = max(max_timestamp, logline.timestamp)
if logline.key == "power_measurement_stop":
power_stop = logline.timestamp
break
power_stop_found = True
if logline.key == "conversion_eff":
conversion_eff = logline.value['value']

conversion_eff = logline.value["value"]

# If power stop is not found, set it to the latest power reading
if not power_stop_found:
power_stop = max_timestamp
# Compute the result, convert ms to s
power_stop = max(power_stop, max_timestamp)
result = conversion_eff * agg_power * time_to_train / (power_stop - power_start) / 1000
result = (
conversion_eff * agg_power * time_to_train / (power_stop - power_start) / 1000
)
return result


Expand Down

0 comments on commit 90cdb71

Please sign in to comment.