Skip to content
Snippets Groups Projects
Commit 3fe3cd92 authored by Hashim Sharif's avatar Hashim Sharif
Browse files

Adding time profiling for DevTuner

parent a67c715a
No related branches found
No related tags found
No related merge requests found
...@@ -371,8 +371,11 @@ def adjustDevTimeLoss(loss): ...@@ -371,8 +371,11 @@ def adjustDevTimeLoss(loss):
if loss < 0.3: if loss < 0.3:
loss += 0.4 loss += 0.4
else: else:
loss = loss * 1.4 loss = loss * 1.33 # 33% extra error for unseen data
if loss < 0.0:
loss = 0.1
return loss return loss
......
...@@ -4,6 +4,7 @@ import os ...@@ -4,6 +4,7 @@ import os
import sys import sys
import subprocess import subprocess
import shutil import shutil
import time
from benchmarks import batch_id from benchmarks import batch_id
import utils import utils
import global_paths import global_paths
...@@ -17,7 +18,7 @@ class DevTimeTuner: ...@@ -17,7 +18,7 @@ class DevTimeTuner:
def __init__(self, Bench): def __init__(self, Bench):
self.autotuner_runs = 20 self.autotuner_runs = 300
self.binary_path = Bench.promise_binary self.binary_path = Bench.promise_binary
self.num_layers = Bench.num_layers self.num_layers = Bench.num_layers
self.gold_accuracy = Bench.promise_accuracy self.gold_accuracy = Bench.promise_accuracy
...@@ -27,7 +28,8 @@ class DevTimeTuner: ...@@ -27,7 +28,8 @@ class DevTimeTuner:
self.result_dir = global_paths.tensorRT_dir + "/" + Bench.base_dir + "/loss_123/" + batch_id + "/dev_tuner/" self.result_dir = global_paths.tensorRT_dir + "/" + Bench.base_dir + "/loss_123/" + batch_id + "/dev_tuner/"
# NOTE: maintains overall autotuning iterations completed - across multiple devtuner invocations # NOTE: maintains overall autotuning iterations completed - across multiple devtuner invocations
self.iterations_completed = 0 self.iterations_completed = 0
# Start time for timing autotuner runs
self.start_time = 0
def invokeDevTunerScript(self, accuracy_slack, autotuner_runs): def invokeDevTunerScript(self, accuracy_slack, autotuner_runs):
...@@ -145,17 +147,39 @@ class DevTimeTuner: ...@@ -145,17 +147,39 @@ class DevTimeTuner:
def setBaselineAccuracy(self): def setBaselineAccuracy(self):
self.gold_accuracy = utils.getBaselineAccuracy(self.binary_path, self.num_layers) self.gold_accuracy = utils.getBaselineAccuracy(self.binary_path, self.num_layers)
print ("NOTE: Baseline Accuracy = ", self.gold_accuracy, "\n\n") print ("NOTE: Baseline Accuracy = ", self.gold_accuracy, "\n\n")
def startTimer(self):
self.start_time = time.time()
print ("\n\n ---Starting DevTuner Timer ----- \n\n")
def endTimer(self):
end_time = time.time()
total_tuning_time = end_time - self.start_time
time_hrs = total_tuning_time * 1.0 / (60 * 60)
print ("\n\n --- Time In Hours = ", time_hrs, " \n\n")
time_file_path = self.result_dir + "tuning_time.txt"
f = open(time_file_path, "w+")
f.write("time_hrs = " + str(time_hrs) + "\n")
f.close()
def runDevTuner(self): def runDevTuner(self):
self.checkExistingDir() #self.checkExistingDir()
self.startTimer()
self.setBaselineAccuracy() self.setBaselineAccuracy()
...@@ -170,5 +194,6 @@ class DevTimeTuner: ...@@ -170,5 +194,6 @@ class DevTimeTuner:
# NOTE: dumping files for checking experimental parameters for each batch # NOTE: dumping files for checking experimental parameters for each batch
self.dumpReferenceFiles() self.dumpReferenceFiles()
self.endTimer()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment