Skip to content

Commit

Permalink
don't measure gpu if not running on gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
undertherain committed Sep 29, 2020
1 parent 18a92fe commit 5454e1c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions benchmarker/modules/i_neural_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ def set_random_seed(self, seed):
def run(self):
self.params["power"]["joules_total"] = 0
self.params["power"]["avg_watt_total"] = 0
power_monitor_gpu = power_monitor_GPU(self.params)
power_monitor_gpu.start()
if self.params["nb_gpus"] > 0:
power_monitor_gpu = power_monitor_GPU(self.params)
power_monitor_gpu.start()
power_monitor_cpu = power_monitor_RAPL(self.params)
power_monitor_cpu.start()
results = self.run_internal()
power_monitor_gpu.stop()
if self.params["nb_gpus"] > 0:
power_monitor_gpu.stop()
power_monitor_cpu.stop()
results["time_batch"] = results["time_epoch"] / results["problem"]["cnt_batches_per_epoch"]
results["time_sample"] = results["time_batch"] / results["batch_size"]
Expand Down

0 comments on commit 5454e1c

Please sign in to comment.