Skip to content
Snippets Groups Projects
Commit 23690e69 authored by kotsifa2's avatar kotsifa2
Browse files

Using new knob reading in hpvm controller and approxhpvm_runtime_utils

parent 6c862410
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "configuration.h" #include "configuration.h"
#include "hpvm-rt-controller.h" #include "hpvm-rt-controller.h"
#include "approx_knob_utils.h"
// Utilities header for ApproxHPVM runtime API (wrapper runtime API) // Utilities header for ApproxHPVM runtime API (wrapper runtime API)
...@@ -155,52 +156,15 @@ void* handleTensorConvApproximationTuples( ...@@ -155,52 +156,15 @@ void* handleTensorConvApproximationTuples(
} }
case GPUNodeConfiguration::APPROX::PERFORATION : case GPUNodeConfiguration::APPROX::PERFORATION :
{ {
int row = 0, col = 0, offset = 0; PerfParams params = perfParamSet->getPerfParams(param);
switch (param) {
case 21:
row = 1; col = 2; offset = 0;
break;
case 22:
row = 1; col = 2; offset = 1;
break;
case 23:
row = 1; col = 3; offset = 0;
break;
case 24:
row = 1; col = 3; offset = 1;
break;
case 25:
row = 1; col = 3; offset = 2;
break;
case 26:
row = 2; col = 1; offset = 0;
break;
case 27:
row = 2; col = 1; offset = 1;
break;
case 28:
row = 3; col = 1; offset = 0;
break;
case 29:
row = 3; col = 1; offset = 1;
break;
case 30:
row = 3; col = 1; offset = 2;
break;
default:
DEBUG("Unsupported Option: Select default, 1-2-0.\n");
row = 1; col = 2; offset = 0;
break;
}
void* t_out; void* t_out;
RC->resume_profiler(); RC->resume_profiler();
t_out = tensorConvApproxHalf2(input, filter, t_out = tensorConvApproxHalf2(input, filter,
conv_pad_h, conv_pad_w, conv_pad_h, conv_pad_w,
conv_stride_h, conv_stride_w, conv_stride_h, conv_stride_w,
1, 1, 1, 1,
row, col, 1, offset); params.row, params.col, 1, params.skip_offset);
RC->pause_profiler(); RC->pause_profiler();
std::pair<double, double> pinfo = RC->get_time_energy(); std::pair<double, double> pinfo = RC->get_time_energy();
RC->reset_profiler(); RC->reset_profiler();
...@@ -210,45 +174,20 @@ void* handleTensorConvApproximationTuples( ...@@ -210,45 +174,20 @@ void* handleTensorConvApproximationTuples(
} }
case GPUNodeConfiguration::APPROX::INPUT_SAMPLING : case GPUNodeConfiguration::APPROX::INPUT_SAMPLING :
{ {
int skip_rate = 2, offset = 0; SampParams params = sampParamSet->getSampParams(param);
switch (param) {
case 31:
skip_rate = 2; offset = 0;
break;
case 32:
skip_rate = 2; offset = 1;
break;
case 33:
skip_rate = 4; offset = 0;
break;
case 34:
skip_rate = 4; offset = 1;
break;
case 35:
skip_rate = 4; offset = 2;
break;
case 36:
skip_rate = 4; offset = 3;
break;
default:
DEBUG("Unsupported Option: Select default, 2-0.\n");
skip_rate = 2; offset = 0;
break;
}
void* t_out; void* t_out;
RC->resume_profiler(); RC->resume_profiler();
t_out = tensorConvApproxHalf2(input, filter, t_out = tensorConvApproxHalf2(input, filter,
conv_pad_h, conv_pad_w, conv_pad_h, conv_pad_w,
conv_stride_h, conv_stride_w, conv_stride_h, conv_stride_w,
1, 1, 1, 1,
1, 1, skip_rate, skip_rate - 1/*offset*/); //FIXME 1, 1,
params.skip_rate, params.skip_offset);
RC->pause_profiler(); RC->pause_profiler();
std::pair<double, double> pinfo = RC->get_time_energy(); std::pair<double, double> pinfo = RC->get_time_energy();
RC->reset_profiler(); RC->reset_profiler();
RC->addToCurrentIterationComputeTime("tensorConvApproxHalf(_samp)", pinfo.first); RC->addToCurrentIterationComputeTime("tensorConvApproxHalf(_samp)", pinfo.first);
RC->addToCurrentIterationComputeEnergy("tensorConvApproxHalf(_samp)", pinfo.second); RC->addToCurrentIterationComputeEnergy("tensorConvApproxHalf(_samp)", pinfo.second);
return t_out; return t_out;
} }
default : default :
......
#include "hpvm-rt-controller.h" #include "hpvm-rt-controller.h"
#include "img_tensor_utils.h" #include "img_tensor_utils.h"
#include "global_data.h"
/* /*
* Check if a file exists * Check if a file exists
...@@ -180,6 +181,7 @@ ProfileInfo::ProfileInfo() ...@@ -180,6 +181,7 @@ ProfileInfo::ProfileInfo()
energy_compute_current_iteration(0.0), energy_compute_current_iteration(0.0),
energy_control_current_iteration(0.0), energy_control_current_iteration(0.0),
energy_config_current_iteration(0.0), in_iteration(false) {} energy_config_current_iteration(0.0), in_iteration(false) {}
Slowdowns::Slowdowns() { Slowdowns::Slowdowns() {
idx = 0; idx = 0;
...@@ -190,6 +192,7 @@ Slowdowns::Slowdowns() { ...@@ -190,6 +192,7 @@ Slowdowns::Slowdowns() {
slowdowns.push_back(1.0 + (rand() / (RAND_MAX / (5.0 - 1.0)))); slowdowns.push_back(1.0 + (rand() / (RAND_MAX / (5.0 - 1.0))));
} }
} else { } else {
DEBUG("Found slowdowns file.\n");
for (std::string line; std::getline(s_in, line);) { for (std::string line; std::getline(s_in, line);) {
float s = std::stof(line); float s = std::stof(line);
slowdowns.push_back(s); slowdowns.push_back(s);
...@@ -273,6 +276,10 @@ void RuntimeController::init(const char *Cstr, const char *Qstr) { ...@@ -273,6 +276,10 @@ void RuntimeController::init(const char *Cstr, const char *Qstr) {
slowdowns = new Slowdowns(); slowdowns = new Slowdowns();
pseudo_rd = 0.0; pseudo_rd = 0.0;
// Initialize utility objects for knob reading
perfParamSet = new PerfParamSet();
sampParamSet = new SampParamSet();
// Start profiling thread in the background, ready to time // Start profiling thread in the background, ready to time
start_profiler(); start_profiler();
pause_profiler(); pause_profiler();
......
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