diff --git a/predtuner/pipedbin.py b/predtuner/pipedbin.py index b5d525ddf8e81f53271afde486f43a597b26a1a5..8882370bb4fefeb430000809f909b34dbea62680 100644 --- a/predtuner/pipedbin.py +++ b/predtuner/pipedbin.py @@ -92,11 +92,11 @@ class PipedBinaryApp(ModeledApp): def empirical_measure_qos_cost( self, with_approxes: KnobsT, is_test: bool ) -> Tuple[float, float]: - from time import time_ns + from time import time - time_begin = time_ns() / (10 ** 9) + time_begin = time() _, qos = self._run_on_knobs(with_approxes, is_test) - time_end = time_ns() / (10 ** 9) + time_end = time() return qos, time_end - time_begin def get_models(self) -> List[Union["IPerfModel", "IQoSModel"]]: diff --git a/predtuner/torchapp.py b/predtuner/torchapp.py index 33ceaad991b005d632b48497230ee28744c9b2df..92ca90cb37cc3ea7a01630411f6a6541b4d4eba9 100644 --- a/predtuner/torchapp.py +++ b/predtuner/torchapp.py @@ -172,7 +172,7 @@ class TorchApp(ModeledApp, abc.ABC): """Measure the QoS and performance of Module with given approximation empirically (i.e., by running the Module on the dataset).""" - from time import time_ns + from time import time from tqdm import tqdm dataloader = self.test_loader if is_test else self.tune_loader @@ -181,13 +181,13 @@ class TorchApp(ModeledApp, abc.ABC): approxed = self._apply_knobs(with_approxes) qoses = [] - time_begin = time_ns() / (10 ** 9) + time_begin = time() for inputs, targets in dataloader: inputs = move_to_device_recursively(inputs, self.device) targets = move_to_device_recursively(targets, self.device) outputs = approxed(inputs) qoses.append(self.tensor_to_qos(outputs, targets)) - time_end = time_ns() / (10 ** 9) + time_end = time() qos = float(self.combine_qos(np.array(qoses))) return qos, time_end - time_begin