Skip to content
Snippets Groups Projects
Commit 40251fc8 authored by Yifan Zhao's avatar Yifan Zhao
Browse files

Handle float64 downstream

parent fe456002
No related branches found
No related tags found
No related merge requests found
...@@ -241,7 +241,8 @@ class TunerInterface(MeasurementInterface): ...@@ -241,7 +241,8 @@ class TunerInterface(MeasurementInterface):
self.pbar = tqdm(total=test_limit, leave=False) self.pbar = tqdm(total=test_limit, leave=False)
self.app_kwargs = app_kwargs self.app_kwargs = app_kwargs
objective = ThresholdAccuracyMinimizeTime(tuner_thres) # tune_thres can come in as np.float64 and opentuner doesn't like that
objective = ThresholdAccuracyMinimizeTime(float(tuner_thres))
input_manager = FixedInputManager(size=len(self.app.op_knobs)) input_manager = FixedInputManager(size=len(self.app.op_knobs))
super(TunerInterface, self).__init__( super(TunerInterface, self).__init__(
args, args,
...@@ -263,7 +264,8 @@ class TunerInterface(MeasurementInterface): ...@@ -263,7 +264,8 @@ class TunerInterface(MeasurementInterface):
from opentuner.resultsdb.models import Result from opentuner.resultsdb.models import Result
cfg = desired_result.configuration.data cfg = desired_result.configuration.data
qos, perf = self.app.measure_qos_perf(cfg, False) qos, perf = self.app.measure_qos_perf(cfg, False, **self.app_kwargs)
qos, perf = float(qos), float(perf)
# Print a debug message for each config in tuning and keep threshold # Print a debug message for each config in tuning and keep threshold
self.print_debug_config(qos, perf) self.print_debug_config(qos, perf)
self.pbar.update() self.pbar.update()
......
...@@ -110,8 +110,7 @@ class TorchApp(ModeledApp, abc.ABC): ...@@ -110,8 +110,7 @@ class TorchApp(ModeledApp, abc.ABC):
end = begin + len(target) end = begin + len(target)
qos = self.tensor_to_qos(tensor_output[begin:end], target) qos = self.tensor_to_qos(tensor_output[begin:end], target)
qoses.append(qos) qoses.append(qos)
# float64 -> float return self.combine_qos(np.array(qoses))
return float(self.combine_qos(np.array(qoses)))
return [ return [
LinearPerfModel(self._op_costs, self._knob_speedups), LinearPerfModel(self._op_costs, self._knob_speedups),
...@@ -137,7 +136,7 @@ class TorchApp(ModeledApp, abc.ABC): ...@@ -137,7 +136,7 @@ class TorchApp(ModeledApp, abc.ABC):
qoses.append(self.tensor_to_qos(outputs, targets)) qoses.append(self.tensor_to_qos(outputs, targets))
time_end = time_ns() / (10 ** 9) time_end = time_ns() / (10 ** 9)
qos = self.combine_qos(np.array(qoses)) qos = self.combine_qos(np.array(qoses))
return float(qos), time_end - time_begin # float64->float return qos, time_end - time_begin
def __repr__(self) -> str: def __repr__(self) -> str:
class_name = self.__class__.__name__ class_name = self.__class__.__name__
......
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