From 51da749c73cd0deb34cb7cde5763e93f924205cb Mon Sep 17 00:00:00 2001 From: Hashim Sharif <hsharif3@miranda.cs.illinois.edu> Date: Mon, 5 Apr 2021 21:28:29 -0500 Subject: [PATCH] Removing more unused Runtime control policies (purely experimental) --- .../tensor_runtime/src/hpvm-rt-controller.cpp | 117 +----------------- 1 file changed, 1 insertion(+), 116 deletions(-) diff --git a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp index e7f801a197..3f41cd15df 100644 --- a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp +++ b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp @@ -1259,6 +1259,7 @@ float hpvm_rt_computeAccuracy3(uint32_t *labels, void *result_ptr) { } +/* NOTE: This is the default config selection routine - it selects the first configuration in the config-file */ extern "C" void llvm_hpvm_invokeRtControl_BASE(void *result, const char *str, int start, int end) { @@ -1390,120 +1391,4 @@ extern "C" void llvm_hpvm_invokeRtControl_ADJUST_PR(void *result, RC->end_iteration(); } -extern "C" void llvm_hpvm_invokeRtControl_SLOWDOWN(void *result, - const char *str, int start, - int end) { - uint32_t *labels_cached = hpvm_rt_readLabelsBatch_cached(str, start, end); - hpvm_rt_computeAccuracy3(labels_cached, result); - - // Read stats for iteration that was just completed - double current_iteration_time = RC->getCurrentIterationComputeTime(); - double current_iteration_energy = RC->getCurrentIterationComputeEnergy(); - - std::string prev_conf_name = - RC->getSpeedupConfigurations()[RC->getConfigurationIdx()]->name; - - RC->resume_profiler(); - float slowdown = RC->getSlowdowns()->getNextSlowdown(); - RC->findTargetConfiguration(slowdown, SPEEDUP); - RC->pause_profiler(); - - std::pair<double, double> pinfo = RC->get_time_energy(); - RC->reset_profiler(); - RC->addToCurrentIterationControlTime(pinfo.first); - RC->addToCurrentIterationControlEnergy(pinfo.second); - - std::string next_conf_name = - RC->getSpeedupConfigurations()[RC->getConfigurationIdx()]->name; - float next_conf_speedup = - RC->getSpeedupConfigurations()[RC->getConfigurationIdx()]->speedup; - - INFO("current iteration time = %f, current iteration energy = %f\n", - current_iteration_time, current_iteration_energy); - INFO("slowdown (target speedup) = %f\n", slowdown); - INFO("Previous configuration: %s\n", prev_conf_name.c_str()); - INFO("Swapping to next configuration: %s with speedup %f\n\n", - next_conf_name.c_str(), next_conf_speedup); - - // Note the end of iteration - RC->end_iteration(); -} - -extern "C" void llvm_hpvm_invokeRtControl_SLOWDOWN_PR(void *result, - const char *str, - int start, int end) { - - uint32_t *labels_cached = hpvm_rt_readLabelsBatch_cached(str, start, end); - hpvm_rt_computeAccuracy3(labels_cached, result); - - // Read stats for iteration that was just completed - double current_iteration_time = RC->getCurrentIterationComputeTime(); - double current_iteration_energy = RC->getCurrentIterationComputeEnergy(); - - std::string prev_conf_name = - RC->getSpeedupConfigurations()[RC->getConfigurationIdx()]->name; - - RC->resume_profiler(); - float slowdown = RC->getSlowdowns()->getNextSlowdown(); - RC->findTargetConfiguration(slowdown, SPEEDUP); - RC->adjustTargetConfiguration(slowdown); - RC->pause_profiler(); - - std::pair<double, double> pinfo = RC->get_time_energy(); - RC->reset_profiler(); - RC->addToCurrentIterationControlTime(pinfo.first); - RC->addToCurrentIterationControlEnergy(pinfo.second); - - std::string next_conf_name = - RC->getSpeedupConfigurations()[RC->getConfigurationIdx()]->name; - float next_conf_speedup = - RC->getSpeedupConfigurations()[RC->getConfigurationIdx()]->speedup; - - INFO("current iteration time = %f, current iteration energy = %f\n", - current_iteration_time, current_iteration_energy); - INFO("slowdown (target speedup) = %f\n", slowdown); - INFO("Previous configuration: %s\n", prev_conf_name.c_str()); - INFO("Swapping to next configuration: %s with speedup %f\n\n", - next_conf_name.c_str(), next_conf_speedup); - - // Note the end of iteration - RC->end_iteration(); -} - -extern "C" void llvm_hpvm_invokeRtControl_RAND(void *result, const char *str, - int start, int end) { - - uint32_t *labels_cached = hpvm_rt_readLabelsBatch_cached(str, start, end); - hpvm_rt_computeAccuracy3(labels_cached, result); - - // Read stats for iteration that was just completed - double current_iteration_time = RC->getCurrentIterationComputeTime(); - double current_iteration_energy = RC->getCurrentIterationComputeEnergy(); - - RC->resume_profiler(); - RC->findTargetConfiguration(RC->getGoalSpeedup(), SPEEDUP); - RC->pause_profiler(); - - std::pair<double, double> pinfo = RC->get_time_energy(); - RC->reset_profiler(); - RC->addToCurrentIterationControlTime(pinfo.first); - RC->addToCurrentIterationControlEnergy(pinfo.second); - - INFO("current iteration time = %f, current iteration energy = %f\n\n", - current_iteration_time, current_iteration_energy); - - // Note the end of iteration - RC->end_iteration(); -} - -template <typename T> -static void writeVectorToFile(const char *path, const std::vector<T> &vec) { - - std::ofstream of(path, std::ofstream::out | std::ofstream::app); - if (!of.good()) - ERROR("Cannot write to %s file", path); - for (float f : vec) - of << f << ' '; - of << '\n'; -} -- GitLab