From e99b1679039066454b8deeb360b8244b994e8253 Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Wed, 26 Nov 2025 14:05:26 +0100 Subject: [PATCH 1/4] revise scheduler interface removed timeout method of scheduler documentation for scheduler multi --- apps/ilp_bsp_scheduler.cpp | 3 +- .../StringToScheduler/run_bsp_scheduler.hpp | 139 +++++++++------ .../GreedySchedulers/GreedyChildren.hpp | 9 +- .../GreedySchedulers/RandomGreedy.hpp | 5 +- .../IlpSchedulers/CoptFullScheduler.hpp | 13 +- .../TotalCommunicationScheduler.hpp | 34 ++-- .../bsp/scheduler/ImprovementScheduler.hpp | 14 -- .../HillClimbing/hill_climbing.hpp | 2 + .../scheduler/MultilevelCoarseAndSchedule.hpp | 158 +++++++++--------- include/osp/bsp/scheduler/Scheduler.hpp | 94 +++-------- include/osp/bsp/scheduler/Serial.hpp | 21 +-- 11 files changed, 239 insertions(+), 253 deletions(-) diff --git a/apps/ilp_bsp_scheduler.cpp b/apps/ilp_bsp_scheduler.cpp index 206a52a0..d0c44e37 100644 --- a/apps/ilp_bsp_scheduler.cpp +++ b/apps/ilp_bsp_scheduler.cpp @@ -90,8 +90,7 @@ int main(int argc, char *argv[]) { CoptFullScheduler scheduler; scheduler.setMaxNumberOfSupersteps(steps); - scheduler.setTimeLimitHours(48); - + if (recomp) { BspScheduleRecomp schedule(instance); diff --git a/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp b/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp index 4ad35699..91898d01 100644 --- a/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp +++ b/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp @@ -26,10 +26,9 @@ limitations under the License. #include #include "../ConfigParser.hpp" +#include "get_coarser.hpp" #include "osp/bsp/model/BspSchedule.hpp" -#include "osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp" #include "osp/bsp/scheduler/CoarseAndSchedule.hpp" -#include "osp/bsp/scheduler/ImprovementScheduler.hpp" #include "osp/bsp/scheduler/CoarsenRefineSchedulers/MultiLevelHillClimbing.hpp" #include "osp/bsp/scheduler/GreedySchedulers/BspLocking.hpp" #include "osp/bsp/scheduler/GreedySchedulers/CilkScheduler.hpp" @@ -39,31 +38,33 @@ limitations under the License. #include "osp/bsp/scheduler/GreedySchedulers/GrowLocalAutoCores.hpp" #include "osp/bsp/scheduler/GreedySchedulers/RandomGreedy.hpp" #include "osp/bsp/scheduler/GreedySchedulers/VarianceFillup.hpp" +#include "osp/bsp/scheduler/ImprovementScheduler.hpp" #include "osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing.hpp" #include "osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_include.hpp" #include "osp/bsp/scheduler/LocalSearch/KernighanLin_v2/kl_include_mt.hpp" +#include "osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp" #include "osp/bsp/scheduler/Scheduler.hpp" #include "osp/bsp/scheduler/Serial.hpp" -#include "osp/coarser/coarser_util.hpp" #include "osp/coarser/MultilevelCoarser.hpp" -#include "get_coarser.hpp" +#include "osp/coarser/coarser_util.hpp" #include "osp/graph_implementations/boost_graphs/boost_graph.hpp" #ifdef COPT #include "osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp" -//#include "osp/bsp/scheduler/IlpSchedulers/TotalCommunicationScheduler.hpp" +// #include "osp/bsp/scheduler/IlpSchedulers/TotalCommunicationScheduler.hpp" #endif - namespace osp { const std::set get_available_bsp_scheduler_names() { - return {"Serial", "GreedyBsp", "GrowLocal", "BspLocking", "Cilk", "Etf", - "GreedyRandom", "GreedyChildren", "Variance", "MultiHC", "LocalSearch", "Coarser", "FullILP", "MultiLevel"};; + return {"Serial", "GreedyBsp", "GrowLocal", "BspLocking", "Cilk", "Etf", "GreedyRandom", + "GreedyChildren", "Variance", "MultiHC", "LocalSearch", "Coarser", "FullILP", "MultiLevel"}; + ; } -template -std::unique_ptr> get_bsp_improver_by_name(const ConfigParser &, const boost::property_tree::ptree &algorithm) { +template +std::unique_ptr> get_bsp_improver_by_name(const ConfigParser &, + const boost::property_tree::ptree &algorithm) { const std::string improver_name = algorithm.get_child("name").get_value(); if (improver_name == "kl_total_comm") { @@ -78,8 +79,8 @@ std::unique_ptr> get_bsp_improver_by_name(const Co } template -std::unique_ptr> -get_base_bsp_scheduler_by_name(const ConfigParser &parser, const boost::property_tree::ptree &algorithm) { +std::unique_ptr> get_base_bsp_scheduler_by_name(const ConfigParser &parser, + const boost::property_tree::ptree &algorithm) { const std::string id = algorithm.get_child("id").get_value(); @@ -88,35 +89,49 @@ get_base_bsp_scheduler_by_name(const ConfigParser &parser, const boost::property return scheduler; } else if (id == "GreedyBsp") { - float max_percent_idle_processors = algorithm.get_child("parameters").get_child("max_percent_idle_processors").get_value(); - bool increase_parallelism_in_new_superstep = algorithm.get_child("parameters").get_child("increase_parallelism_in_new_superstep").get_value(); - auto scheduler = std::make_unique>(max_percent_idle_processors, increase_parallelism_in_new_superstep); + float max_percent_idle_processors = + algorithm.get_child("parameters").get_child("max_percent_idle_processors").get_value(); + bool increase_parallelism_in_new_superstep = + algorithm.get_child("parameters").get_child("increase_parallelism_in_new_superstep").get_value(); + auto scheduler = std::make_unique>(max_percent_idle_processors, + increase_parallelism_in_new_superstep); return scheduler; } else if (id == "GrowLocal") { GrowLocalAutoCores_Params> params; params.minSuperstepSize = algorithm.get_child("parameters").get_child("minSuperstepSize").get_value(); - params.syncCostMultiplierMinSuperstepWeight = algorithm.get_child("parameters").get_child("syncCostMultiplierMinSuperstepWeight").get_value>(); - params.syncCostMultiplierParallelCheck = algorithm.get_child("parameters").get_child("syncCostMultiplierParallelCheck").get_value>(); + params.syncCostMultiplierMinSuperstepWeight = algorithm.get_child("parameters") + .get_child("syncCostMultiplierMinSuperstepWeight") + .get_value>(); + params.syncCostMultiplierParallelCheck = algorithm.get_child("parameters") + .get_child("syncCostMultiplierParallelCheck") + .get_value>(); return std::make_unique>(params); } else if (id == "BspLocking") { - float max_percent_idle_processors = algorithm.get_child("parameters").get_child("max_percent_idle_processors").get_value(); - bool increase_parallelism_in_new_superstep = algorithm.get_child("parameters").get_child("increase_parallelism_in_new_superstep").get_value(); - auto scheduler = std::make_unique>(max_percent_idle_processors, increase_parallelism_in_new_superstep); + float max_percent_idle_processors = + algorithm.get_child("parameters").get_child("max_percent_idle_processors").get_value(); + bool increase_parallelism_in_new_superstep = + algorithm.get_child("parameters").get_child("increase_parallelism_in_new_superstep").get_value(); + auto scheduler = + std::make_unique>(max_percent_idle_processors, increase_parallelism_in_new_superstep); return scheduler; } else if (id == "Cilk") { auto scheduler = std::make_unique>(); - algorithm.get_child("parameters").get_child("mode").get_value() == "SJF" ? scheduler->setMode(CilkMode::SJF) : scheduler->setMode(CilkMode::CILK); + algorithm.get_child("parameters").get_child("mode").get_value() == "SJF" + ? scheduler->setMode(CilkMode::SJF) + : scheduler->setMode(CilkMode::CILK); return scheduler; } else if (id == "Etf") { auto scheduler = std::make_unique>(); - algorithm.get_child("parameters").get_child("mode").get_value() == "BL_EST" ? scheduler->setMode(EtfMode::BL_EST) : scheduler->setMode(EtfMode::ETF); + algorithm.get_child("parameters").get_child("mode").get_value() == "BL_EST" + ? scheduler->setMode(EtfMode::BL_EST) + : scheduler->setMode(EtfMode::ETF); return scheduler; } else if (id == "GreedyRandom") { @@ -128,9 +143,12 @@ get_base_bsp_scheduler_by_name(const ConfigParser &parser, const boost::property return scheduler; } else if (id == "Variance") { - float max_percent_idle_processors = algorithm.get_child("parameters").get_child("max_percent_idle_processors").get_value(); - bool increase_parallelism_in_new_superstep = algorithm.get_child("parameters").get_child("increase_parallelism_in_new_superstep").get_value(); - auto scheduler = std::make_unique>(max_percent_idle_processors, increase_parallelism_in_new_superstep); + float max_percent_idle_processors = + algorithm.get_child("parameters").get_child("max_percent_idle_processors").get_value(); + bool increase_parallelism_in_new_superstep = + algorithm.get_child("parameters").get_child("increase_parallelism_in_new_superstep").get_value(); + auto scheduler = std::make_unique>(max_percent_idle_processors, + increase_parallelism_in_new_superstep); return scheduler; } @@ -139,12 +157,13 @@ get_base_bsp_scheduler_by_name(const ConfigParser &parser, const boost::property if (id == "MultiHC") { auto scheduler = std::make_unique>(); const unsigned timeLimit = parser.global_params.get_child("timeLimit").get_value(); - scheduler->setTimeLimitSeconds(timeLimit); + // scheduler->setTimeLimitSeconds(timeLimit); unsigned step = algorithm.get_child("parameters").get_child("hill_climbing_steps").get_value(); scheduler->setNumberOfHcSteps(step); - const double contraction_rate = algorithm.get_child("parameters").get_child("contraction_rate").get_value(); + const double contraction_rate = + algorithm.get_child("parameters").get_child("contraction_rate").get_value(); scheduler->setContractionRate(contraction_rate); scheduler->useLinearRefinementSteps(20U); scheduler->setMinTargetNrOfNodes(100U); @@ -159,25 +178,30 @@ template RETURN_STATUS run_bsp_scheduler(const ConfigParser &parser, const boost::property_tree::ptree &algorithm, BspSchedule &schedule) { - using vertex_type_t_or_default = std::conditional_t, v_type_t, unsigned>; - using edge_commw_t_or_default = std::conditional_t, e_commw_t, v_commw_t>; - using boost_graph_t = boost_graph, v_commw_t, v_memw_t, vertex_type_t_or_default, edge_commw_t_or_default>; + using vertex_type_t_or_default = + std::conditional_t, v_type_t, unsigned>; + using edge_commw_t_or_default = + std::conditional_t, e_commw_t, v_commw_t>; + using boost_graph_t = boost_graph, v_commw_t, v_memw_t, + vertex_type_t_or_default, edge_commw_t_or_default>; const std::string id = algorithm.get_child("id").get_value(); std::cout << "Running algorithm: " << id << std::endl; if (id == "LocalSearch") { - RETURN_STATUS status = run_bsp_scheduler(parser, algorithm.get_child("parameters").get_child("scheduler"), schedule); - if (status == RETURN_STATUS::ERROR) return RETURN_STATUS::ERROR; - - std::unique_ptr> improver = get_bsp_improver_by_name(parser, algorithm.get_child("parameters").get_child("improver")); + RETURN_STATUS status = + run_bsp_scheduler(parser, algorithm.get_child("parameters").get_child("scheduler"), schedule); + if (status == RETURN_STATUS::ERROR) + return RETURN_STATUS::ERROR; + + std::unique_ptr> improver = + get_bsp_improver_by_name(parser, algorithm.get_child("parameters").get_child("improver")); return improver->improveSchedule(schedule); #ifdef COPT } else if (id == "FullILP") { CoptFullScheduler scheduler; const unsigned timeLimit = parser.global_params.get_child("timeLimit").get_value(); - scheduler.setTimeLimitSeconds(timeLimit); // max supersteps scheduler.setMaxNumberOfSupersteps( @@ -185,15 +209,16 @@ RETURN_STATUS run_bsp_scheduler(const ConfigParser &parser, const boost::propert // initial solution if (algorithm.get_child("parameters").get_child("use_initial_solution").get_value()) { - std::string init_sched = algorithm.get_child("parameters").get_child("initial_solution_scheduler").get_value(); + std::string init_sched = + algorithm.get_child("parameters").get_child("initial_solution_scheduler").get_value(); if (init_sched == "FullILP") { throw std::invalid_argument("Parameter error: Initial solution cannot be FullILP.\n"); } BspSchedule initial_schedule(schedule.getInstance()); - RETURN_STATUS status = - run_bsp_scheduler(parser, algorithm.get_child("parameters").get_child("initial_solution_scheduler"), initial_schedule); + RETURN_STATUS status = run_bsp_scheduler( + parser, algorithm.get_child("parameters").get_child("initial_solution_scheduler"), initial_schedule); if (status != RETURN_STATUS::OSP_SUCCESS && status != RETURN_STATUS::BEST_FOUND) { throw std::invalid_argument("Error while computing initial solution.\n"); @@ -205,36 +230,48 @@ RETURN_STATUS run_bsp_scheduler(const ConfigParser &parser, const boost::propert // intermediate solutions if (algorithm.get_child("parameters").get_child("write_intermediate_solutions").get_value()) { scheduler.enableWriteIntermediateSol( - algorithm.get_child("parameters").get_child("intermediate_solutions_directory").get_value(), + algorithm.get_child("parameters") + .get_child("intermediate_solutions_directory") + .get_value(), algorithm.get_child("parameters").get_child("intermediate_solutions_prefix").get_value()); } - return scheduler.computeSchedule(schedule); + return scheduler.computeScheduleWithTimeLimit(schedule, timeLimit); #endif } else if (id == "Coarser") { - std::unique_ptr> coarser = get_coarser_by_name(parser, algorithm.get_child("parameters").get_child("coarser")); - const auto &instance = schedule.getInstance(); + std::unique_ptr> coarser = + get_coarser_by_name(parser, algorithm.get_child("parameters").get_child("coarser")); + const auto &instance = schedule.getInstance(); BspInstance instance_coarse; std::vector> reverse_vertex_map; - bool status = coarser->coarsenDag(instance.getComputationalDag(), instance_coarse.getComputationalDag(),reverse_vertex_map); - if (!status) return RETURN_STATUS::ERROR; + bool status = coarser->coarsenDag(instance.getComputationalDag(), instance_coarse.getComputationalDag(), + reverse_vertex_map); + if (!status) + return RETURN_STATUS::ERROR; instance_coarse.setArchitecture(instance.getArchitecture()); instance_coarse.setNodeProcessorCompatibility(instance.getProcessorCompatibilityMatrix()); BspSchedule schedule_coarse(instance_coarse); - const auto status_coarse = run_bsp_scheduler(parser, algorithm.get_child("parameters").get_child("scheduler"), schedule_coarse); - if (status_coarse != RETURN_STATUS::OSP_SUCCESS and status_coarse != RETURN_STATUS::BEST_FOUND) return status_coarse; - + const auto status_coarse = + run_bsp_scheduler(parser, algorithm.get_child("parameters").get_child("scheduler"), schedule_coarse); + if (status_coarse != RETURN_STATUS::OSP_SUCCESS and status_coarse != RETURN_STATUS::BEST_FOUND) + return status_coarse; + status = coarser_util::pull_back_schedule(schedule_coarse, reverse_vertex_map, schedule); - if (!status) return RETURN_STATUS::ERROR; + if (!status) + return RETURN_STATUS::ERROR; return RETURN_STATUS::OSP_SUCCESS; } else if (id == "MultiLevel") { - std::unique_ptr> ml_coarser = get_multilevel_coarser_by_name(parser, algorithm.get_child("parameters").get_child("coarser")); - std::unique_ptr> improver = get_bsp_improver_by_name(parser, algorithm.get_child("parameters").get_child("improver")); - std::unique_ptr> scheduler = get_base_bsp_scheduler_by_name(parser, algorithm.get_child("parameters").get_child("scheduler")); + std::unique_ptr> ml_coarser = + get_multilevel_coarser_by_name( + parser, algorithm.get_child("parameters").get_child("coarser")); + std::unique_ptr> improver = + get_bsp_improver_by_name(parser, algorithm.get_child("parameters").get_child("improver")); + std::unique_ptr> scheduler = get_base_bsp_scheduler_by_name( + parser, algorithm.get_child("parameters").get_child("scheduler")); MultilevelCoarseAndSchedule coarse_and_schedule(*scheduler, *improver, *ml_coarser); return coarse_and_schedule.computeSchedule(schedule); diff --git a/include/osp/bsp/scheduler/GreedySchedulers/GreedyChildren.hpp b/include/osp/bsp/scheduler/GreedySchedulers/GreedyChildren.hpp index 0af27959..9b3880b9 100644 --- a/include/osp/bsp/scheduler/GreedySchedulers/GreedyChildren.hpp +++ b/include/osp/bsp/scheduler/GreedySchedulers/GreedyChildren.hpp @@ -34,9 +34,8 @@ class GreedyChildren : public Scheduler { bool ensure_enough_sources; public: - GreedyChildren(bool ensure_enough_sources_ = true) : ensure_enough_sources(ensure_enough_sources_) {}; - GreedyChildren(unsigned time_limit, bool ensure_enough_sources_ = true) - : Scheduler(time_limit), ensure_enough_sources(ensure_enough_sources_) {}; + + GreedyChildren(bool ensure_enough_sources_ = true) : Scheduler(), ensure_enough_sources(ensure_enough_sources_) {}; RETURN_STATUS computeSchedule(BspSchedule &sched) override { @@ -75,7 +74,7 @@ class GreedyChildren : public Scheduler { if (nodes_assigned_this_superstep.count(par)) { if (!processor_set) { const unsigned par_proc = sched.assignedProcessor(par); - if(!instance.isCompatible(node, par_proc)) { + if (!instance.isCompatible(node, par_proc)) { failed_to_allocate = true; break; } @@ -106,7 +105,7 @@ class GreedyChildren : public Scheduler { } } sched.setAssignedProcessor(node, best_proc); - } + } nodes_assigned_this_superstep.emplace(node); processor_weights[sched.assignedProcessor(node)] += graph.vertex_work_weight(node); diff --git a/include/osp/bsp/scheduler/GreedySchedulers/RandomGreedy.hpp b/include/osp/bsp/scheduler/GreedySchedulers/RandomGreedy.hpp index 4297f2d2..bf7e160c 100644 --- a/include/osp/bsp/scheduler/GreedySchedulers/RandomGreedy.hpp +++ b/include/osp/bsp/scheduler/GreedySchedulers/RandomGreedy.hpp @@ -37,9 +37,8 @@ class RandomGreedy : public Scheduler { bool ensure_enough_sources; public: - RandomGreedy(bool ensure_enough_sources_ = true) : ensure_enough_sources(ensure_enough_sources_) {}; - RandomGreedy(unsigned time_limit, bool ensure_enough_sources_) - : Scheduler(time_limit), ensure_enough_sources(ensure_enough_sources_) {}; + + RandomGreedy(bool ensure_enough_sources_ = true) : Scheduler(), ensure_enough_sources(ensure_enough_sources_) {}; RETURN_STATUS computeSchedule(BspSchedule &sched) override { diff --git a/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp b/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp index f1109b93..5695b8b1 100644 --- a/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp +++ b/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp @@ -70,6 +70,8 @@ class CoptFullScheduler : public Scheduler { bool use_initial_schedule_recomp = false; const BspScheduleRecomp *initial_schedule_recomp; + unsigned timeLimitSeconds = 0; + bool write_solutions_found; std::string write_solutions_path; std::string solution_file_prefix; @@ -869,6 +871,13 @@ class CoptFullScheduler : public Scheduler { return status; } } + + virtual RETURN_STATUS computeScheduleWithTimeLimit(BspSchedule &schedule, unsigned timeLimit) { + + timeLimitSeconds = timeLimit; + return computeSchedule(schedule); + } + virtual RETURN_STATUS computeMaxBspSchedule(MaxBspSchedule &schedule) { MaxBspScheduleCS schedule_cs(schedule.getInstance()); @@ -934,7 +943,9 @@ class CoptFullScheduler : public Scheduler { virtual void computeScheduleBase(const BspScheduleRecomp &schedule, Model &model) { - model.SetDblParam(COPT_DBLPARAM_TIMELIMIT, Scheduler::timeLimitSeconds); + if (timeLimitSeconds > 0) { + model.SetDblParam(COPT_DBLPARAM_TIMELIMIT, timeLimitSeconds); + } model.SetIntParam(COPT_INTPARAM_THREADS, 128); model.SetIntParam(COPT_INTPARAM_STRONGBRANCHING, 1); diff --git a/include/osp/bsp/scheduler/IlpSchedulers/TotalCommunicationScheduler.hpp b/include/osp/bsp/scheduler/IlpSchedulers/TotalCommunicationScheduler.hpp index d152d259..362b0744 100644 --- a/include/osp/bsp/scheduler/IlpSchedulers/TotalCommunicationScheduler.hpp +++ b/include/osp/bsp/scheduler/IlpSchedulers/TotalCommunicationScheduler.hpp @@ -21,10 +21,10 @@ limitations under the License. #include #include +#include "osp/auxiliary/io/DotFileWriter.hpp" #include "osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_comm.hpp" #include "osp/bsp/scheduler/Scheduler.hpp" #include "osp/graph_algorithms/directed_graph_edge_view.hpp" -#include "osp/auxiliary/io/DotFileWriter.hpp" namespace osp { @@ -76,9 +76,9 @@ class TotalCommunicationScheduler : public Scheduler { auto sched = constructBspScheduleFromCallback(); DotFileWriter sched_writer; - sched_writer.write_schedule(write_solutions_path_cb + "intmed_sol_" + solution_file_prefix_cb + "_" + - std::to_string(counter) + "_schedule.dot", - sched); + sched_writer.write_schedule(write_solutions_path_cb + "intmed_sol_" + solution_file_prefix_cb + + "_" + std::to_string(counter) + "_schedule.dot", + sched); counter++; } @@ -95,8 +95,8 @@ class TotalCommunicationScheduler : public Scheduler { for (unsigned processor = 0; processor < instance_ptr->numberOfProcessors(); processor++) { - for (unsigned step = 0; step < static_cast((*node_to_processor_superstep_var_ptr)[0][0].Size()); - step++) { + for (unsigned step = 0; + step < static_cast((*node_to_processor_superstep_var_ptr)[0][0].Size()); step++) { assert(size < std::numeric_limits::max()); if (GetSolution( @@ -170,8 +170,8 @@ class TotalCommunicationScheduler : public Scheduler { for (unsigned processor = 0; processor < instance_ptr->numberOfProcessors(); processor++) { - for (unsigned step = 0; step < static_cast((*node_to_processor_superstep_var_ptr)[0][0].Size()); - step++) { + for (unsigned step = 0; + step < static_cast((*node_to_processor_superstep_var_ptr)[0][0].Size()); step++) { assert(step <= std::numeric_limits::max()); if (GetSolution( (*node_to_processor_superstep_var_ptr)[node][processor][static_cast(step)]) >= @@ -203,8 +203,8 @@ class TotalCommunicationScheduler : public Scheduler { for (unsigned processor = 0; processor < instance_ptr->numberOfProcessors(); processor++) { - for (unsigned step = 0; step < static_cast((*node_to_processor_superstep_var_ptr)[0][0].Size()); - step++) { + for (unsigned step = 0; + step < static_cast((*node_to_processor_superstep_var_ptr)[0][0].Size()); step++) { if (schedule.assignedProcessor(node) == processor && schedule.assignedSuperstep(node) == step) { assert(step <= std::numeric_limits::max()); @@ -425,7 +425,8 @@ class TotalCommunicationScheduler : public Scheduler { model.AddConstr(superstep_used_var[0] == 1); for (unsigned int step = 0; step < max_number_supersteps - 1; step++) { - model.AddConstr(superstep_used_var[static_cast(step)] >= superstep_used_var[static_cast(step + 1)]); + model.AddConstr(superstep_used_var[static_cast(step)] >= + superstep_used_var[static_cast(step + 1)]); } // superstep is used at all @@ -579,7 +580,7 @@ class TotalCommunicationScheduler : public Scheduler { Expr expr_work; for (const auto &node : instance.vertices()) { expr_work += instance.getComputationalDag().vertex_work_weight(node) * - node_to_processor_superstep_var[node][processor][static_cast(step)]; + node_to_processor_superstep_var[node][processor][static_cast(step)]; } model.AddConstr(max_work_superstep_var[static_cast(step)] >= expr_work); @@ -632,6 +633,11 @@ class TotalCommunicationScheduler : public Scheduler { virtual ~TotalCommunicationScheduler() = default; + virtual RETURN_STATUS computeScheduleWithTimeLimit(BspSchedule &schedule, unsigned timeout) override { + model.SetDblParam(COPT_DBLPARAM_TIMELIMIT, timeout); + return computeSchedule(schedule); + } + /** * @brief Compute the schedule for the given BspInstance using the COPT solver. * @@ -662,13 +668,11 @@ class TotalCommunicationScheduler : public Scheduler { loadInitialSchedule(); } - model.SetDblParam(COPT_DBLPARAM_TIMELIMIT, Scheduler::timeLimitSeconds); + model.SetIntParam(COPT_INTPARAM_THREADS, 128); - model.SetIntParam(COPT_INTPARAM_STRONGBRANCHING, 1); model.SetIntParam(COPT_INTPARAM_LPMETHOD, 1); model.SetIntParam(COPT_INTPARAM_ROUNDINGHEURLEVEL, 1); - model.SetIntParam(COPT_INTPARAM_SUBMIPHEURLEVEL, 1); // model.SetIntParam(COPT_INTPARAM_PRESOLVE, 1); // model.SetIntParam(COPT_INTPARAM_CUTLEVEL, 0); diff --git a/include/osp/bsp/scheduler/ImprovementScheduler.hpp b/include/osp/bsp/scheduler/ImprovementScheduler.hpp index 99b236ea..f45ab33c 100644 --- a/include/osp/bsp/scheduler/ImprovementScheduler.hpp +++ b/include/osp/bsp/scheduler/ImprovementScheduler.hpp @@ -102,20 +102,6 @@ class ComboScheduler : public Scheduler { ComboScheduler(Scheduler &base, ImprovementScheduler &improvement) : Scheduler(), base_scheduler(base), improvement_scheduler(improvement) {} - virtual void setTimeLimitSeconds(unsigned int limit) override { - - Scheduler::timeLimitSeconds = limit; - base_scheduler.setTimeLimitSeconds(limit); - improvement_scheduler.setTimeLimitSeconds(limit); - } - - virtual void setTimeLimitHours(unsigned int limit) override { - - Scheduler::timeLimitSeconds = limit * 3600; - base_scheduler.setTimeLimitHours(limit); - improvement_scheduler.setTimeLimitHours(limit); - } - virtual ~ComboScheduler() = default; virtual std::string getScheduleName() const override { diff --git a/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing.hpp b/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing.hpp index c58031e8..f876229b 100644 --- a/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing.hpp +++ b/include/osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing.hpp @@ -22,6 +22,8 @@ limitations under the License. #include "osp/bsp/scheduler/ImprovementScheduler.hpp" #include "osp/graph_algorithms/directed_graph_top_sort.hpp" +#include + namespace osp{ template diff --git a/include/osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp b/include/osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp index 9d737aab..90227221 100644 --- a/include/osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp +++ b/include/osp/bsp/scheduler/MultilevelCoarseAndSchedule.hpp @@ -27,9 +27,8 @@ limitations under the License. #include "osp/bsp/model/BspSchedule.hpp" #include "osp/bsp/scheduler/ImprovementScheduler.hpp" #include "osp/bsp/scheduler/Scheduler.hpp" -#include "osp/coarser/coarser_util.hpp" #include "osp/coarser/MultilevelCoarser.hpp" - +#include "osp/coarser/coarser_util.hpp" namespace osp { @@ -37,40 +36,45 @@ template class MultilevelCoarseAndSchedule : public Scheduler { private: const BspInstance *original_inst; + protected: - inline const BspInstance * getOriginalInstance() const { return original_inst; }; + inline const BspInstance *getOriginalInstance() const { return original_inst; }; Scheduler *sched; ImprovementScheduler *improver; MultilevelCoarser *ml_coarser; long int active_graph; - std::unique_ptr< BspInstance > active_instance; - std::unique_ptr< BspSchedule > active_schedule; + std::unique_ptr> active_instance; + std::unique_ptr> active_schedule; RETURN_STATUS compute_initial_schedule(); RETURN_STATUS expand_active_schedule(); - RETURN_STATUS expand_active_schedule_to_original_schedule(BspSchedule& schedule); + RETURN_STATUS expand_active_schedule_to_original_schedule(BspSchedule &schedule); RETURN_STATUS improve_active_schedule(); - RETURN_STATUS run_expansions(BspSchedule& schedule); + RETURN_STATUS run_expansions(BspSchedule &schedule); void clear_computation_data(); public: - MultilevelCoarseAndSchedule() : Scheduler(), original_inst(nullptr), sched(nullptr), improver(nullptr), ml_coarser(nullptr), active_graph(-1L) {}; - MultilevelCoarseAndSchedule(Scheduler &sched_, MultilevelCoarser &ml_coarser_) - : Scheduler(), original_inst(nullptr), sched(&sched_), improver(nullptr), ml_coarser(&ml_coarser_), active_graph(-1L) {}; - MultilevelCoarseAndSchedule(Scheduler &sched_, ImprovementScheduler &improver_, MultilevelCoarser &ml_coarser_) - : Scheduler(), original_inst(nullptr), sched(&sched_), improver(&improver_), ml_coarser(&ml_coarser_), active_graph(-1L) {}; - MultilevelCoarseAndSchedule(unsigned timelimit, Scheduler &sched_, MultilevelCoarser &ml_coarser_) - : Scheduler(timelimit), original_inst(nullptr), sched(&sched_), improver(nullptr), ml_coarser(&ml_coarser_), active_graph(-1L) {}; - MultilevelCoarseAndSchedule(unsigned timelimit, Scheduler &sched_, ImprovementScheduler &improver_, MultilevelCoarser &ml_coarser_) - : Scheduler(timelimit), original_inst(nullptr), sched(&sched_), improver(&improver_), ml_coarser(&ml_coarser_), active_graph(-1L) {}; + MultilevelCoarseAndSchedule() + : Scheduler(), original_inst(nullptr), sched(nullptr), improver(nullptr), ml_coarser(nullptr), + active_graph(-1L) {}; + MultilevelCoarseAndSchedule(Scheduler &sched_, + MultilevelCoarser &ml_coarser_) + : Scheduler(), original_inst(nullptr), sched(&sched_), improver(nullptr), ml_coarser(&ml_coarser_), + active_graph(-1L) {}; + MultilevelCoarseAndSchedule(Scheduler &sched_, ImprovementScheduler &improver_, + MultilevelCoarser &ml_coarser_) + : Scheduler(), original_inst(nullptr), sched(&sched_), improver(&improver_), ml_coarser(&ml_coarser_), + active_graph(-1L) {}; virtual ~MultilevelCoarseAndSchedule() = default; inline void setInitialScheduler(Scheduler &sched_) { sched = &sched_; }; inline void setImprovementScheduler(ImprovementScheduler &improver_) { improver = &improver_; }; - inline void setMultilevelCoarser(MultilevelCoarser &ml_coarser_) { ml_coarser = &ml_coarser_; }; + inline void setMultilevelCoarser(MultilevelCoarser &ml_coarser_) { + ml_coarser = &ml_coarser_; + }; RETURN_STATUS computeSchedule(BspSchedule &schedule) override; @@ -78,32 +82,29 @@ class MultilevelCoarseAndSchedule : public Scheduler { if (improver == nullptr) { return "C:" + ml_coarser->getCoarserName() + "-S:" + sched->getScheduleName(); } else { - return "C:" + ml_coarser->getCoarserName() + "-S:" + sched->getScheduleName() + "-I:" + improver->getScheduleName(); + return "C:" + ml_coarser->getCoarserName() + "-S:" + sched->getScheduleName() + + "-I:" + improver->getScheduleName(); } }; - }; - - - - template RETURN_STATUS MultilevelCoarseAndSchedule::compute_initial_schedule() { active_graph = static_cast(ml_coarser->dag_history.size()); active_graph--; assert((active_graph >= 0L) && "Must have done at least one coarsening!"); - + RETURN_STATUS status; - active_instance = std::make_unique< BspInstance >( *(ml_coarser->dag_history.at( static_cast(active_graph) )), original_inst->getArchitecture()); - active_schedule = std::make_unique< BspSchedule >( *active_instance ); - status = sched->computeSchedule( *active_schedule ); + active_instance = std::make_unique>( + *(ml_coarser->dag_history.at(static_cast(active_graph))), original_inst->getArchitecture()); + active_schedule = std::make_unique>(*active_instance); + status = sched->computeSchedule(*active_schedule); assert(active_schedule->satisfiesPrecedenceConstraints()); RETURN_STATUS ret = improve_active_schedule(); - status = std::max(ret,status); + status = std::max(ret, status); return status; } @@ -111,96 +112,99 @@ RETURN_STATUS MultilevelCoarseAndSchedule::compute_init template RETURN_STATUS MultilevelCoarseAndSchedule::improve_active_schedule() { if (improver) { - if (active_instance->getComputationalDag().num_vertices() == 0) return RETURN_STATUS::OSP_SUCCESS; - return improver->improveSchedule( *active_schedule ); + if (active_instance->getComputationalDag().num_vertices() == 0) + return RETURN_STATUS::OSP_SUCCESS; + return improver->improveSchedule(*active_schedule); } return RETURN_STATUS::OSP_SUCCESS; } - - - template RETURN_STATUS MultilevelCoarseAndSchedule::expand_active_schedule() { - assert((active_graph > 0L) && ( static_cast(active_graph) < ml_coarser->dag_history.size())); - - std::unique_ptr< BspInstance > expanded_instance = std::make_unique< BspInstance >( *(ml_coarser->dag_history.at( static_cast(active_graph) - 1 )), original_inst->getArchitecture()); - std::unique_ptr< BspSchedule > expanded_schedule = std::make_unique< BspSchedule >( *expanded_instance ); - - for (const auto &node : expanded_instance->getComputationalDag().vertices() ) { - expanded_schedule->setAssignedProcessor(node, active_schedule->assignedProcessor( ml_coarser->contraction_maps.at( static_cast(active_graph) )->at(node) ) ); - expanded_schedule->setAssignedSuperstep(node, active_schedule->assignedSuperstep( ml_coarser->contraction_maps.at( static_cast(active_graph) )->at(node) ) ); + assert((active_graph > 0L) && (static_cast(active_graph) < ml_coarser->dag_history.size())); + + std::unique_ptr> expanded_instance = std::make_unique>( + *(ml_coarser->dag_history.at(static_cast(active_graph) - 1)), original_inst->getArchitecture()); + std::unique_ptr> expanded_schedule = + std::make_unique>(*expanded_instance); + + for (const auto &node : expanded_instance->getComputationalDag().vertices()) { + expanded_schedule->setAssignedProcessor( + node, active_schedule->assignedProcessor( + ml_coarser->contraction_maps.at(static_cast(active_graph))->at(node))); + expanded_schedule->setAssignedSuperstep( + node, active_schedule->assignedSuperstep( + ml_coarser->contraction_maps.at(static_cast(active_graph))->at(node))); } assert(expanded_schedule->satisfiesPrecedenceConstraints()); - // std::cout << "exp_inst: " << expanded_instance.get() << " n: " << expanded_instance->numberOfVertices() << " m: " << expanded_instance->getComputationalDag().num_edges() << std::endl; - // std::cout << "exp_sched: " << &expanded_schedule->getInstance() << " n: " << expanded_schedule->getInstance().numberOfVertices() << " m: " << expanded_schedule->getInstance().getComputationalDag().num_edges() << std::endl; - + // std::cout << "exp_inst: " << expanded_instance.get() << " n: " << expanded_instance->numberOfVertices() << " m: + // " << expanded_instance->getComputationalDag().num_edges() << std::endl; std::cout << "exp_sched: " << + // &expanded_schedule->getInstance() << " n: " << expanded_schedule->getInstance().numberOfVertices() << " m: " << + // expanded_schedule->getInstance().getComputationalDag().num_edges() << std::endl; active_graph--; std::swap(expanded_instance, active_instance); std::swap(expanded_schedule, active_schedule); - // std::cout << "act_inst: " << active_instance.get() << " n: " << active_instance->numberOfVertices() << " m: " << active_instance->getComputationalDag().num_edges() << std::endl; - // std::cout << "act_sched: " << &active_schedule->getInstance() << " n: " << active_schedule->getInstance().numberOfVertices() << " m: " << active_schedule->getInstance().getComputationalDag().num_edges() << std::endl; - - assert(active_schedule->satisfiesPrecedenceConstraints()); + // std::cout << "act_inst: " << active_instance.get() << " n: " << active_instance->numberOfVertices() << " m: " << + // active_instance->getComputationalDag().num_edges() << std::endl; std::cout << "act_sched: " << + // &active_schedule->getInstance() << " n: " << active_schedule->getInstance().numberOfVertices() << " m: " << + // active_schedule->getInstance().getComputationalDag().num_edges() << std::endl; + + assert(active_schedule->satisfiesPrecedenceConstraints()); return RETURN_STATUS::OSP_SUCCESS; } - template -RETURN_STATUS MultilevelCoarseAndSchedule::expand_active_schedule_to_original_schedule(BspSchedule& schedule) { +RETURN_STATUS MultilevelCoarseAndSchedule::expand_active_schedule_to_original_schedule( + BspSchedule &schedule) { assert(active_graph == 0L); - for (const auto &node : getOriginalInstance()->getComputationalDag().vertices() ) { - schedule.setAssignedProcessor(node, active_schedule->assignedProcessor( ml_coarser->contraction_maps.at( static_cast(active_graph) )->at(node)) ); - schedule.setAssignedSuperstep(node, active_schedule->assignedSuperstep( ml_coarser->contraction_maps.at( static_cast(active_graph) )->at(node)) ); + for (const auto &node : getOriginalInstance()->getComputationalDag().vertices()) { + schedule.setAssignedProcessor( + node, active_schedule->assignedProcessor( + ml_coarser->contraction_maps.at(static_cast(active_graph))->at(node))); + schedule.setAssignedSuperstep( + node, active_schedule->assignedSuperstep( + ml_coarser->contraction_maps.at(static_cast(active_graph))->at(node))); } active_graph--; - active_instance = std::unique_ptr< BspInstance >(); - active_schedule = std::unique_ptr< BspSchedule >(); + active_instance = std::unique_ptr>(); + active_schedule = std::unique_ptr>(); assert(schedule.satisfiesPrecedenceConstraints()); - + return RETURN_STATUS::OSP_SUCCESS; } - - - - - template -RETURN_STATUS MultilevelCoarseAndSchedule::run_expansions(BspSchedule& schedule) { +RETURN_STATUS MultilevelCoarseAndSchedule::run_expansions(BspSchedule &schedule) { assert(active_graph >= 0L && static_cast(active_graph) == ml_coarser->dag_history.size() - 1); RETURN_STATUS status = RETURN_STATUS::OSP_SUCCESS; - - while(active_graph > 0L) { + + while (active_graph > 0L) { status = std::max(status, expand_active_schedule()); status = std::max(status, improve_active_schedule()); } status = std::max(status, expand_active_schedule_to_original_schedule(schedule)); - + return status; } - template void MultilevelCoarseAndSchedule::clear_computation_data() { active_graph = -1L; - active_instance = std::unique_ptr< BspInstance >(); - active_schedule = std::unique_ptr< BspSchedule >(); + active_instance = std::unique_ptr>(); + active_schedule = std::unique_ptr>(); } - - template -RETURN_STATUS MultilevelCoarseAndSchedule::computeSchedule(BspSchedule& schedule) { +RETURN_STATUS MultilevelCoarseAndSchedule::computeSchedule(BspSchedule &schedule) { clear_computation_data(); original_inst = &schedule.getInstance(); @@ -210,15 +214,15 @@ RETURN_STATUS MultilevelCoarseAndSchedule::computeSched status = std::max(status, ml_coarser->run(*original_inst)); if constexpr (std::is_same_v) { - if ( ml_coarser->dag_history.size() == 0 ) { + if (ml_coarser->dag_history.size() == 0) { status = std::max(status, sched->computeSchedule(schedule)); } else { status = std::max(status, compute_initial_schedule()); status = std::max(status, run_expansions(schedule)); } - } else { + } else { assert(ml_coarser->dag_history.size() > 0); - + status = std::max(status, compute_initial_schedule()); status = std::max(status, run_expansions(schedule)); } @@ -230,10 +234,4 @@ RETURN_STATUS MultilevelCoarseAndSchedule::computeSched return status; } - - - - - - } // end namespace osp \ No newline at end of file diff --git a/include/osp/bsp/scheduler/Scheduler.hpp b/include/osp/bsp/scheduler/Scheduler.hpp index dd06d187..a57e2e84 100644 --- a/include/osp/bsp/scheduler/Scheduler.hpp +++ b/include/osp/bsp/scheduler/Scheduler.hpp @@ -18,68 +18,38 @@ limitations under the License. #pragma once -#include -#include #include "osp/bsp/model/BspInstance.hpp" #include "osp/bsp/model/BspSchedule.hpp" #include "osp/bsp/model/BspScheduleCS.hpp" #include "osp/concepts/computational_dag_concept.hpp" +#include namespace osp { - - /** * @class Scheduler - * @brief Abstract base class for scheduling scheduler. + * @brief Interface for BSP schedulers. * - * The Scheduler class provides a common interface for scheduling scheduler in the BSP scheduling system. - * It defines methods for setting and getting the time limit, as well as computing schedules. + * The Scheduler class defines the common interface for all scheduling algorithms computing BSP schedules. + * It specifies the contract for computing standard BSP schedules (BspSchedule) and communication-aware schedules + * (BspScheduleCS). */ template class Scheduler { - static_assert(is_computational_dag_v, "BspSchedule can only be used with computational DAGs."); - - protected: - unsigned int timeLimitSeconds; /**< The time limit in seconds for computing a schedule. */ + static_assert(is_computational_dag_v, "Scheduler can only be used with computational DAGs."); public: /** * @brief Constructor for the Scheduler class. - * @param timelimit The time limit in seconds for computing a schedule. Default is 3600 seconds (1 hour). */ - Scheduler(unsigned timelimit = 3600) : timeLimitSeconds(timelimit) {} + Scheduler() = default; /** * @brief Destructor for the Scheduler class. */ virtual ~Scheduler() = default; - /** - * @brief Set the time limit in seconds for computing a schedule. - * @param limit The time limit in seconds. - */ - virtual void setTimeLimitSeconds(unsigned int limit) { timeLimitSeconds = limit; } - - /** - * @brief Set the time limit in hours for computing a schedule. - * @param limit The time limit in hours. - */ - virtual void setTimeLimitHours(unsigned int limit) { timeLimitSeconds = limit * 3600; } - - /** - * @brief Get the time limit in seconds for computing a schedule. - * @return The time limit in seconds. - */ - inline unsigned int getTimeLimitSeconds() const { return timeLimitSeconds; } - - /** - * @brief Get the time limit in hours for computing a schedule. - * @return The time limit in hours. - */ - inline unsigned int getTimeLimitHours() const { return timeLimitSeconds / 3600; } - /** * @brief Get the name of the scheduling algorithm. * @return The name of the scheduling algorithm. @@ -87,12 +57,27 @@ class Scheduler { virtual std::string getScheduleName() const = 0; /** - * @brief Compute a BSP schedule for the given BSP instance. - * @param instance The BSP instance for which to compute the schedule. - * @return A pair containing the return status and the computed schedule. + * @brief Computes a BSP schedule for the given BSP instance. + * + * This pure virtual function must be implemented by derived classes to provide + * the specific scheduling logic. It modifies the passed BspSchedule object. + * + * @param schedule The BspSchedule object to be computed. It contains the BspInstance. + * @return RETURN_STATUS::OSP_SUCCESS if a schedule was successfully computed, + * RETURN_STATUS::ERROR if an error occurred, or other status codes as appropriate. */ virtual RETURN_STATUS computeSchedule(BspSchedule &schedule) = 0; + /** + * @brief Computes a BSP schedule with communication schedule (CS). + * + * This method provides a default implementation that first computes the basic BSP schedule using computeSchedule(). + * If successful, it then calls setAutoCommunicationSchedule() on the schedule to set a communication schedule. + * + * @param schedule The BspScheduleCS object to be computed. It contains the BspInstance. + * @return RETURN_STATUS::OSP_SUCCESS or RETURN_STATUS::BEST_FOUND if a schedule was successfully computed, + * RETURN_STATUS::ERROR if an error occurred, or other status codes as appropriate. + */ virtual RETURN_STATUS computeScheduleCS(BspScheduleCS &schedule) { auto result = computeSchedule(schedule); @@ -103,35 +88,6 @@ class Scheduler { return RETURN_STATUS::ERROR; } } - - // /** - // * @brief Compute a schedule for the given BSP instance within the time limit. - // * @param instance The BSP instance for which to compute the schedule. - // * @return A pair containing the return status and the computed schedule. - // */ - // virtual std::pair> - // computeScheduleWithTimeLimit(const BspInstance &instance) { - - // std::packaged_task>(const BspInstance &)> task( - // [this](const BspInstance &instance) -> std::pair> { - // return computeSchedule(instance); - // }); - // auto future = task.get_future(); - // std::thread thr(std::move(task), std::ref(instance)); - // if (future.wait_for(std::chrono::seconds(getTimeLimitSeconds())) == std::future_status::timeout) { - // thr.detach(); // we leave the thread still running - // std::cerr << "Timeout reached, execution of computeSchedule() aborted" << std::endl; - // return std::make_pair(TIMEOUT, BspSchedule()); - // } - // thr.join(); - // try { - // const auto result = future.get(); - // return result; - // } catch (const std::exception &e) { - // std::cerr << "Exception caught in computeScheduleWithTimeLimit(): " << e.what() << std::endl; - // return std::make_pair(ERROR, BspSchedule()); - // } - // } }; } // namespace osp \ No newline at end of file diff --git a/include/osp/bsp/scheduler/Serial.hpp b/include/osp/bsp/scheduler/Serial.hpp index 2cf2bc58..db2aeef9 100644 --- a/include/osp/bsp/scheduler/Serial.hpp +++ b/include/osp/bsp/scheduler/Serial.hpp @@ -20,16 +20,17 @@ limitations under the License. #include "Scheduler.hpp" #include -#include #include #include +#include namespace osp { /** * @class Serial - * @brief The Serial class represents a scheduler that assigns all tasks to a single processor in a serial manner. - * If the architecture is heterogeneous, it assigns tasks to one processor of each type computing a schedule with the smallest number of supersteps. - * + * @brief The Serial class represents a scheduler that assigns all tasks to a single processor in a serial manner. + * If the architecture is heterogeneous, it assigns tasks to one processor of each type computing a schedule with the + * smallest number of supersteps. + * */ template class Serial : public Scheduler { @@ -40,12 +41,6 @@ class Serial : public Scheduler { */ Serial() : Scheduler() {} - /** - * @brief Constructor for Serial with a time limit. - * @param timelimit The time limit in seconds for computing a schedule. Default is 3600 seconds (1 hour). - */ - Serial(unsigned timelimit) : Scheduler(timelimit) {} - /** * @brief Default destructor for Serial. */ @@ -131,8 +126,8 @@ class Serial : public Scheduler { schedule.setAssignedSuperstep(v, current_superstep); scheduled = true; ++scheduled_nodes_count; - break; - } + break; + } } if (not scheduled) { @@ -150,7 +145,7 @@ class Serial : public Scheduler { current_superstep++; ready_nodes.insert(ready_nodes.end(), deferred_nodes.begin(), deferred_nodes.end()); deferred_nodes.clear(); - } + } } schedule.setNumberOfSupersteps(current_superstep + 1); From 08948dcb4ffc5f837542d56c3c062d2cd44f6628 Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Wed, 26 Nov 2025 14:52:08 +0100 Subject: [PATCH 2/4] removed semicolon --- apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp b/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp index 91898d01..ab6a5d72 100644 --- a/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp +++ b/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp @@ -59,7 +59,6 @@ namespace osp { const std::set get_available_bsp_scheduler_names() { return {"Serial", "GreedyBsp", "GrowLocal", "BspLocking", "Cilk", "Etf", "GreedyRandom", "GreedyChildren", "Variance", "MultiHC", "LocalSearch", "Coarser", "FullILP", "MultiLevel"}; - ; } template From 0ddddc7c43b8760cf7e5daae45247987aa613fef Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Wed, 26 Nov 2025 15:21:41 +0100 Subject: [PATCH 3/4] removed-commented-line --- apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp b/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp index ab6a5d72..97e7e473 100644 --- a/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp +++ b/apps/test_suite_runner/StringToScheduler/run_bsp_scheduler.hpp @@ -156,7 +156,6 @@ std::unique_ptr> get_base_bsp_scheduler_by_name(const ConfigP if (id == "MultiHC") { auto scheduler = std::make_unique>(); const unsigned timeLimit = parser.global_params.get_child("timeLimit").get_value(); - // scheduler->setTimeLimitSeconds(timeLimit); unsigned step = algorithm.get_child("parameters").get_child("hill_climbing_steps").get_value(); scheduler->setNumberOfHcSteps(step); From 46fb2f9d12cd680ae811686f5ab19f7528d8afb9 Mon Sep 17 00:00:00 2001 From: tonibohnlein Date: Wed, 26 Nov 2025 16:22:31 +0100 Subject: [PATCH 4/4] reorder --- .../IlpSchedulers/CoptFullScheduler.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp b/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp index 5695b8b1..79e22c54 100644 --- a/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp +++ b/include/osp/bsp/scheduler/IlpSchedulers/CoptFullScheduler.hpp @@ -65,14 +65,14 @@ class CoptFullScheduler : public Scheduler { bool is_max_bsp = false; bool use_memory_constraint; bool use_initial_schedule = false; - const BspScheduleCS *initial_schedule; - + bool write_solutions_found; bool use_initial_schedule_recomp = false; - const BspScheduleRecomp *initial_schedule_recomp; unsigned timeLimitSeconds = 0; - bool write_solutions_found; + const BspScheduleCS *initial_schedule; + const BspScheduleRecomp *initial_schedule_recomp; + std::string write_solutions_path; std::string solution_file_prefix; @@ -824,8 +824,8 @@ class CoptFullScheduler : public Scheduler { public: CoptFullScheduler(unsigned steps = 5) - : allow_recomputation(false), use_memory_constraint(false), use_initial_schedule(false), initial_schedule(0), - write_solutions_found(false), max_number_supersteps(steps) { + : allow_recomputation(false), use_memory_constraint(false), use_initial_schedule(false), + write_solutions_found(false), initial_schedule(0), max_number_supersteps(steps) { // solution_callback.comm_processor_to_processor_superstep_node_var_ptr = // &comm_processor_to_processor_superstep_node_var; @@ -834,7 +834,7 @@ class CoptFullScheduler : public Scheduler { CoptFullScheduler(const BspScheduleCS &schedule) : allow_recomputation(false), use_memory_constraint(false), use_initial_schedule(true), - initial_schedule(&schedule), write_solutions_found(false), + write_solutions_found(false), initial_schedule(&schedule), max_number_supersteps(schedule.numberOfSupersteps()) { // solution_callback.comm_processor_to_processor_superstep_node_var_ptr = @@ -844,7 +844,7 @@ class CoptFullScheduler : public Scheduler { CoptFullScheduler(const BspScheduleRecomp &schedule) : allow_recomputation(true), use_memory_constraint(false), use_initial_schedule_recomp(true), - initial_schedule_recomp(&schedule), write_solutions_found(false), + write_solutions_found(false), initial_schedule_recomp(&schedule), max_number_supersteps(schedule.numberOfSupersteps()) { }