Skip to content
Snippets Groups Projects
Commit e4c85e93 authored by Maël Madon's avatar Maël Madon
Browse files

Merge branch 'master' into issue#13

parents 6d995d01 26df5637
Branches
Tags
1 merge request!14Submission queue for replay users
......@@ -116,7 +116,7 @@ private:
int _job_number = 0;
};
struct Queue;
class Queue;
/**
* Useful parsers
......
......@@ -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);
......
......@@ -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()
{
......@@ -336,20 +277,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
{
......
......@@ -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:
......@@ -134,7 +109,6 @@ public:
bool is_empty() const;
int nb_jobs() const;
Rational compute_load_estimation() const;
std::string to_string() const;
......
......@@ -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
......
......@@ -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
)
......
......@@ -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
)
......
......@@ -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
)
......
......@@ -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
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment