Skip to content
Snippets Groups Projects

Some cleanup the repo

Merged Ghost User requested to merge cleanup into master
1 file
+ 17
32
Compare changes
  • Side-by-side
  • Inline
+ 17
32
@@ -11,7 +11,6 @@
@@ -11,7 +11,6 @@
#include <loguru.hpp>
#include <loguru.hpp>
#include "scheds/fcfs.hpp"
#include "external/taywee_args.hpp"
#include "external/taywee_args.hpp"
#include "decision.hpp"
#include "decision.hpp"
@@ -20,6 +19,7 @@
@@ -20,6 +19,7 @@
#include "network.hpp"
#include "network.hpp"
#include "pempek_assert.hpp"
#include "pempek_assert.hpp"
 
#include "queue.hpp"
#include "scheds/easy_bf.hpp"
#include "scheds/easy_bf.hpp"
#include "scheds/fcfs.hpp"
#include "scheds/fcfs.hpp"
#include "scheds/bin_packing.hpp"
#include "scheds/bin_packing.hpp"
@@ -50,13 +50,10 @@ int main(int argc, char **argv)
@@ -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> variants_set = { "fcfs", "easy_bf", "multicore_filler", "bin_packing", "bin_packing_energy" };
const set<string> policies_set = { "basic", "contiguous" };
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 set<string> verbosity_levels_set = { "debug", "info", "quiet", "silent" };
const string variants_string = "{" + boost::algorithm::join(variants_set, ", ") + "}";
const string variants_string = "{" + boost::algorithm::join(variants_set, ", ") + "}";
const string policies_string = "{" + boost::algorithm::join(policies_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, ", ") + "}";
const string verbosity_levels_string = "{" + boost::algorithm::join(verbosity_levels_set, ", ") + "}";
ISchedulingAlgorithm *algo = nullptr;
ISchedulingAlgorithm *algo = nullptr;
@@ -81,8 +78,6 @@ int main(int argc, char **argv)
@@ -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 "
"Sets the scheduling variant options as the content of the given filepath. Overrides the variant_options "
"options.",
"options.",
{ "variant_options_filepath" }, "");
{ "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",
args::ValueFlag<string> flag_verbosity_level(parser, "verbosity-level",
"Sets the verbosity level. Available values are " + verbosity_levels_string, { "verbosity" }, "info");
"Sets the verbosity level. Available values are " + verbosity_levels_string, { "verbosity" }, "info");
args::ValueFlag<bool> flag_call_make_decisions_on_single_nop(parser, "flag",
args::ValueFlag<bool> flag_call_make_decisions_on_single_nop(parser, "flag",
@@ -97,10 +92,6 @@ int main(int argc, char **argv)
@@ -97,10 +92,6 @@ int main(int argc, char **argv)
throw args::ValidationError(str(format("Invalid '%1%' parameter value (%2%): Must be non-negative.")
throw args::ValidationError(str(format("Invalid '%1%' parameter value (%2%): Must be non-negative.")
% flag_rjms_delay.Name() % flag_rjms_delay.Get()));
% 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())
if (variants_set.find(flag_scheduling_variant.Get()) == variants_set.end())
throw args::ValidationError(str(format("Invalid '%1%' value (%2%): Not in %3%")
throw args::ValidationError(str(format("Invalid '%1%' value (%2%): Not in %3%")
% flag_scheduling_variant.Name() % flag_scheduling_variant.Get() % variants_string));
% flag_scheduling_variant.Name() % flag_scheduling_variant.Get() % variants_string));
@@ -130,7 +121,6 @@ int main(int argc, char **argv)
@@ -130,7 +121,6 @@ int main(int argc, char **argv)
string socket_endpoint = flag_socket_endpoint.Get();
string socket_endpoint = flag_socket_endpoint.Get();
string scheduling_variant = flag_scheduling_variant.Get();
string scheduling_variant = flag_scheduling_variant.Get();
string selection_policy = flag_selection_policy.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 = flag_variant_options.Get();
string variant_options_filepath = flag_variant_options_filepath.Get();
string variant_options_filepath = flag_variant_options_filepath.Get();
string verbosity_level = flag_verbosity_level.Get();
string verbosity_level = flag_verbosity_level.Get();
@@ -156,26 +146,6 @@ int main(int argc, char **argv)
@@ -156,26 +146,6 @@ int main(int argc, char **argv)
// Scheduling parameters
// Scheduling parameters
SchedulingDecision decision;
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
// Resource selector
if (selection_policy == "basic")
if (selection_policy == "basic")
selector = new BasicResourceSelector;
selector = new BasicResourceSelector;
@@ -219,17 +189,32 @@ int main(int argc, char **argv)
@@ -219,17 +189,32 @@ int main(int argc, char **argv)
}
}
LOG_F(1, "variant_options = '%s'", variant_options.c_str());
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
// Scheduling variant
if (scheduling_variant == "fcfs")
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")
else if (scheduling_variant == "easy_bf")
algo = new EasyBackfilling(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options);
algo = new EasyBackfilling(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options);
 
else if (scheduling_variant == "multicore_filler")
else if (scheduling_variant == "multicore_filler")
algo = new MulticoreFiller(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options);
algo = new MulticoreFiller(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options);
 
else if (scheduling_variant == "bin_packing")
else if (scheduling_variant == "bin_packing")
algo = new BinPacking(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options);
algo = new BinPacking(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options);
 
else if (scheduling_variant == "bin_packing_energy")
else if (scheduling_variant == "bin_packing_energy")
algo = new BinPackingEnergy(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options);
algo = new BinPackingEnergy(&w, &decision, queue, selector, rjms_delay, &json_doc_variant_options);
 
 
// Network
// Network
Network n;
Network n;
n.bind(socket_endpoint);
n.bind(socket_endpoint);
Loading