diff --git a/src/json_workload.hpp b/src/json_workload.hpp index 3d339ba66af057b83cc9cef19e8370ead5900bd9..8032eb9a1a9e57f4d4c06a572f4bfa09e9a3b3f1 100644 --- a/src/json_workload.hpp +++ b/src/json_workload.hpp @@ -116,7 +116,7 @@ private: int _job_number = 0; }; -struct Queue; +class Queue; /** * Useful parsers diff --git a/src/main.cpp b/src/main.cpp index f2ff092802021a19e8aa23aff7d974f20830ff34..032a559730a1849f40e283d7a568bcc6adbcf97e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,7 +11,6 @@ #include <loguru.hpp> -#include "scheds/fcfs.hpp" #include "external/taywee_args.hpp" #include "decision.hpp" @@ -20,6 +19,7 @@ #include "network.hpp" #include "pempek_assert.hpp" +#include "queue.hpp" #include "scheds/easy_bf.hpp" #include "scheds/fcfs.hpp" #include "scheds/bin_packing.hpp" @@ -50,13 +50,10 @@ int main(int argc, char **argv) { const set<string> variants_set = { "fcfs", "easy_bf", "multicore_filler", "bin_packing", "bin_packing_energy" }; const set<string> policies_set = { "basic", "contiguous" }; - const set<string> queue_orders_set = { "fcfs", "lcfs", "desc_bounded_slowdown", "desc_slowdown", "asc_size", - "desc_size", "asc_walltime", "desc_walltime" }; const set<string> verbosity_levels_set = { "debug", "info", "quiet", "silent" }; const string variants_string = "{" + boost::algorithm::join(variants_set, ", ") + "}"; const string policies_string = "{" + boost::algorithm::join(policies_set, ", ") + "}"; - const string queue_orders_string = "{" + boost::algorithm::join(queue_orders_set, ", ") + "}"; const string verbosity_levels_string = "{" + boost::algorithm::join(verbosity_levels_set, ", ") + "}"; ISchedulingAlgorithm *algo = nullptr; @@ -81,8 +78,6 @@ int main(int argc, char **argv) "Sets the scheduling variant options as the content of the given filepath. Overrides the variant_options " "options.", { "variant_options_filepath" }, ""); - args::ValueFlag<string> flag_queue_order(parser, "order", - "Sets the queue order. Available values are " + queue_orders_string, { 'o', "queue_order" }, "fcfs"); args::ValueFlag<string> flag_verbosity_level(parser, "verbosity-level", "Sets the verbosity level. Available values are " + verbosity_levels_string, { "verbosity" }, "info"); args::ValueFlag<bool> flag_call_make_decisions_on_single_nop(parser, "flag", @@ -97,10 +92,6 @@ int main(int argc, char **argv) throw args::ValidationError(str(format("Invalid '%1%' parameter value (%2%): Must be non-negative.") % flag_rjms_delay.Name() % flag_rjms_delay.Get())); - if (queue_orders_set.find(flag_queue_order.Get()) == queue_orders_set.end()) - throw args::ValidationError(str(format("Invalid '%1%' value (%2%): Not in %3%") % flag_queue_order.Name() - % flag_queue_order.Get() % queue_orders_string)); - if (variants_set.find(flag_scheduling_variant.Get()) == variants_set.end()) throw args::ValidationError(str(format("Invalid '%1%' value (%2%): Not in %3%") % flag_scheduling_variant.Name() % flag_scheduling_variant.Get() % variants_string)); @@ -130,7 +121,6 @@ int main(int argc, char **argv) string socket_endpoint = flag_socket_endpoint.Get(); string scheduling_variant = flag_scheduling_variant.Get(); string selection_policy = flag_selection_policy.Get(); - string queue_order = flag_queue_order.Get(); string variant_options = flag_variant_options.Get(); string variant_options_filepath = flag_variant_options_filepath.Get(); string verbosity_level = flag_verbosity_level.Get(); @@ -156,26 +146,6 @@ int main(int argc, char **argv) // Scheduling parameters SchedulingDecision decision; - // Queue order - if (queue_order == "fcfs") - order = new FCFSOrder; - else if (queue_order == "lcfs") - order = new LCFSOrder; - else if (queue_order == "desc_bounded_slowdown") - order = new DescendingBoundedSlowdownOrder(1); - else if (queue_order == "desc_slowdown") - order = new DescendingSlowdownOrder; - else if (queue_order == "asc_size") - order = new AscendingSizeOrder; - else if (queue_order == "desc_size") - order = new DescendingSizeOrder; - else if (queue_order == "asc_walltime") - order = new AscendingWalltimeOrder; - else if (queue_order == "desc_walltime") - order = new DescendingWalltimeOrder; - - queue = new Queue(order); - // Resource selector if (selection_policy == "basic") selector = new BasicResourceSelector; @@ -219,17 +189,32 @@ int main(int argc, char **argv) } LOG_F(1, "variant_options = '%s'", variant_options.c_str()); + // Job order + if (scheduling_variant == "easy_bf" || scheduling_variant == "multicore_filler"){ + order = new FCFSOrder; + queue = new Queue(order); + } + if (scheduling_variant == "bin_packing" || scheduling_variant == "bin_packing_energy"){ + order = new DescendingSizeOrder; + queue = new Queue(order); + } + // Scheduling variant if (scheduling_variant == "fcfs") - algo = new FCFS(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options); + algo = new FCFS(&w, &decision, nullptr, selector, rjms_delay, &json_doc_variant_options); else if (scheduling_variant == "easy_bf") algo = new EasyBackfilling(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options); + else if (scheduling_variant == "multicore_filler") algo = new MulticoreFiller(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options); + else if (scheduling_variant == "bin_packing") algo = new BinPacking(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options); + else if (scheduling_variant == "bin_packing_energy") algo = new BinPackingEnergy(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options); + + // Network Network n; n.bind(socket_endpoint); diff --git a/src/queue.cpp b/src/queue.cpp index 4b25b42afc85c3eddee5e85495945775ae64b4df..c86b0f728875dd70d3fcc42f92a8ebe81ea65c1f 100644 --- a/src/queue.cpp +++ b/src/queue.cpp @@ -24,16 +24,6 @@ SortableJobOrder::~SortableJobOrder() } -void SortableJob::update_slowdown(Rational current_date) -{ - slowdown = current_date - release_date; -} - -void SortableJob::update_bounded_slowdown(Rational current_date, Rational execution_time_lower_bound) -{ - bounded_slowdown = (current_date - release_date) / execution_time_lower_bound; -} - FCFSOrder::~FCFSOrder() { @@ -78,55 +68,6 @@ void LCFSOrder::updateJob(SortableJob *job, const SortableJobOrder::UpdateInform (void) info; } - -DescendingBoundedSlowdownOrder::DescendingBoundedSlowdownOrder(Rational min_job_length) : - _min_job_length(min_job_length) -{ - -} - -DescendingBoundedSlowdownOrder::~DescendingBoundedSlowdownOrder() -{ - -} - -bool DescendingBoundedSlowdownOrder::compare(const SortableJob *j1, const SortableJob *j2, const SortableJobOrder::CompareInformation *info) const -{ - (void) info; - - if (j1->bounded_slowdown == j2->bounded_slowdown) - return jobcmp(j1->job, j2->job); - else - return j1->bounded_slowdown > j2->bounded_slowdown; -} - -void DescendingBoundedSlowdownOrder::updateJob(SortableJob *job, const SortableJobOrder::UpdateInformation *info) const -{ - job->update_bounded_slowdown(info->current_date, _min_job_length); -} - - -DescendingSlowdownOrder::~DescendingSlowdownOrder() -{ - -} - -bool DescendingSlowdownOrder::compare(const SortableJob *j1, const SortableJob *j2, const SortableJobOrder::CompareInformation *info) const -{ - (void) info; - - if (j1->slowdown == j2->slowdown) - return jobcmp(j1->job, j2->job); - else - return j1->slowdown > j2->slowdown; -} - -void DescendingSlowdownOrder::updateJob(SortableJob *job, const SortableJobOrder::UpdateInformation *info) const -{ - job->update_slowdown(info->current_date); -} - - AscendingSizeOrder::~AscendingSizeOrder() { @@ -323,20 +264,6 @@ int Queue::nb_jobs() const return _jobs.size(); } -Rational Queue::compute_load_estimation() const -{ - Rational load = 0; - - for (auto queue_it = _jobs.begin(); queue_it != _jobs.end(); ++queue_it) - { - const SortableJob * sjob = *queue_it; - const Job * job = sjob->job; - - load += job->nb_requested_resources * job->walltime; - } - - return load; -} std::string Queue::to_string() const { diff --git a/src/queue.hpp b/src/queue.hpp index 2c17c1ac1464ce6d7c9ebaf1f227f9bf93f5f238..9b090a04e9e70fe3f05d2cf4c701f1c9ea9bbeab 100644 --- a/src/queue.hpp +++ b/src/queue.hpp @@ -10,11 +10,6 @@ struct SortableJob { const Job * job; Rational release_date; - Rational slowdown; - Rational bounded_slowdown; - - void update_slowdown(Rational current_date); - void update_bounded_slowdown(Rational current_date, Rational execution_time_lower_bound); }; class SortableJobOrder @@ -58,26 +53,6 @@ public: void updateJob(SortableJob * job, const UpdateInformation * info = nullptr) const; }; -class DescendingBoundedSlowdownOrder : public SortableJobOrder -{ -public: - DescendingBoundedSlowdownOrder(Rational min_job_length); - ~DescendingBoundedSlowdownOrder(); - bool compare(const SortableJob * j1, const SortableJob * j2, const CompareInformation * info = nullptr) const; - void updateJob(SortableJob * job, const UpdateInformation * info = nullptr) const; - -private: - Rational _min_job_length; -}; - -class DescendingSlowdownOrder : public SortableJobOrder -{ -public: - ~DescendingSlowdownOrder(); - bool compare(const SortableJob * j1, const SortableJob * j2, const CompareInformation * info = nullptr) const; - void updateJob(SortableJob * job, const UpdateInformation * info = nullptr) const; -}; - class AscendingSizeOrder : public SortableJobOrder { public: @@ -128,7 +103,6 @@ public: bool is_empty() const; int nb_jobs() const; - Rational compute_load_estimation() const; std::string to_string() const; diff --git a/src/scheds/bin_packing_energy.cpp b/src/scheds/bin_packing_energy.cpp index e98405c279a8e936b558865be5a0c1eefe436f89..978a333dcbf837eca0dddde785357e7b54ac2f71 100644 --- a/src/scheds/bin_packing_energy.cpp +++ b/src/scheds/bin_packing_energy.cpp @@ -113,7 +113,6 @@ void BinPackingEnergy::on_simulation_start( // PPK_ASSERT_ERROR( // batsim_config["dynamic-jobs-enabled"].GetBool(), "This algorithm only // works if dynamic job are enabled!"); - // TODO: send an error if the order asked in not DescendingSizeOrder /* TODO (wait for batsim5.0): * - retrieve the nb of cores per machine from the platform file and diff --git a/test/test_assertion_error.py b/test/test_assertion_error.py index 7dcfdebbd14fd5869f8504a8dbe05c7bca1ffcb3..46ead0d4c28a7f0398b82de876bea552d03722c9 100644 --- a/test/test_assertion_error.py +++ b/test/test_assertion_error.py @@ -41,7 +41,7 @@ def error_user(user_name, platform_multiC, expected_error="", test_name=None, sc "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse") instance = RobinInstance(output_dir=output_dir, batcmd=batcmd, - schedcmd=f"batmen -v bin_packing --queue_order=desc_size --variant_options_filepath {schedconf}", + schedcmd=f"batmen -v bin_packing --variant_options_filepath {schedconf}", simulation_timeout=30, ready_timeout=5, success_timeout=10, failure_timeout=0 ) diff --git a/test/test_broker.py b/test/test_broker.py index fc72749af6b1b06fc99c68183505d7f11d470b03..2effe5f4d376aba507da9b7d125347c03fe4d953 100644 --- a/test/test_broker.py +++ b/test/test_broker.py @@ -36,7 +36,7 @@ def test_broker_multi(platform_multiC, workload_static, sched_multi): batcmd = gen_batsim_cmd(platform_multiC.filename, workload_static.filename, output_dir, "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse") instance = RobinInstance(output_dir=output_dir, batcmd=batcmd, - schedcmd=f"batmen -v {sched_multi.name} --queue_order=desc_size --variant_options_filepath test/schedconf/user_description_file.json", + schedcmd=f"batmen -v {sched_multi.name} --variant_options_filepath test/schedconf/user_description_file.json", simulation_timeout=30, ready_timeout=5, success_timeout=10, failure_timeout=0 ) diff --git a/test/test_schedulers_multi.py b/test/test_schedulers_multi.py index ce0f4b029ee3cd217d674b7169025d48c26683ec..73b6e7f6d0529834f7ad9d0a7e8c6efe245a87fe 100644 --- a/test/test_schedulers_multi.py +++ b/test/test_schedulers_multi.py @@ -34,7 +34,7 @@ def test_bin_packing(platform_multiC, workload_static): batcmd = gen_batsim_cmd(platform_multiC.filename, workload_static.filename, output_dir, "--energy --enable-compute-sharing") instance = RobinInstance(output_dir=output_dir, batcmd=batcmd, - schedcmd=f"batmen -v {sched} --queue_order=desc_size", + schedcmd=f"batmen -v {sched}", simulation_timeout=30, ready_timeout=5, success_timeout=10, failure_timeout=0 ) @@ -57,7 +57,7 @@ def test_bin_packing_energy(platform_multiC, workload_static): batcmd = gen_batsim_cmd(platform_multiC.filename, workload_static.filename, output_dir, "--energy --enable-compute-sharing") instance = RobinInstance(output_dir=output_dir, batcmd=batcmd, - schedcmd=f"batmen -v {sched} --queue_order=desc_size", + schedcmd=f"batmen -v {sched}", simulation_timeout=30, ready_timeout=5, success_timeout=10, failure_timeout=0 ) diff --git a/test/test_users.py b/test/test_users.py index 65a5542c132e8485095c268f6691808502d15068..5be9550062f07985b66db36a775914e5b652f5bf 100644 --- a/test/test_users.py +++ b/test/test_users.py @@ -50,7 +50,7 @@ def run_user(user_name, platform_multiC, test_name=None, schedconf=None): "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse") instance = RobinInstance(output_dir=output_dir, batcmd=batcmd, - schedcmd=f"batmen -v bin_packing --queue_order=desc_size --variant_options_filepath {schedconf}", + schedcmd=f"batmen -v bin_packing --variant_options_filepath {schedconf}", simulation_timeout=30, ready_timeout=5, success_timeout=10, failure_timeout=0 )