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

dev: made fcfs into a dynamic scheduler and write related test

parent 6b08bbd9
No related branches found
No related tags found
1 merge request!5New dynamic schedulers: fcfs and easy-bf
Pipeline #4602 passed
......@@ -6,7 +6,7 @@
FCFS::FCFS(Workload *workload,
SchedulingDecision *decision, Queue *queue, ResourceSelector *selector,
double rjms_delay, rapidjson::Document *variant_options) :
ISchedulingAlgorithm(workload, decision, queue, selector, rjms_delay,
DynScheduler(workload, decision, queue, selector, rjms_delay,
variant_options)
{}
......@@ -16,8 +16,8 @@ FCFS::~FCFS()
void FCFS::on_simulation_start(double date,
const rapidjson::Value &batsim_config)
{
(void) date;
(void) batsim_config;
/* Call superclass. If broker enabled, submit jobs date=0. */
DynScheduler::on_simulation_start(date, batsim_config);
_available_machines.insert(IntervalSet::ClosedInterval(0, _nb_machines - 1));
_nb_available_machines = _nb_machines;
......@@ -132,4 +132,8 @@ void FCFS::make_decisions(double date,
}
}
}
/* make_decisions from superclass, will in particular take care of sending
* feedback about job status to the users, if broker enabled */
DynScheduler::make_decisions(date, update_info, compare_info);
}
......@@ -3,11 +3,10 @@
#include <unordered_map>
#include <list>
#include "../isalgorithm.hpp"
#include "../json_workload.hpp"
#include "../broker/dynscheduler.hpp"
#include "../locality.hpp"
class FCFS : public ISchedulingAlgorithm
class FCFS : public DynScheduler
{
public:
FCFS(Workload * workload, SchedulingDecision * decision,
......
......@@ -3,8 +3,8 @@
#include "../broker/dynscheduler.hpp"
#include <list>
#include <vector>
#include <map>
#include <vector>
#include "../locality.hpp"
#include <intervalset.hpp>
......@@ -35,31 +35,34 @@ struct HostComparator
};
/**
* In this scheduling algorithm, each job is scheduled on only one multicore
* host. The scheduler tries to have as few hosts as possible that are powered
* In this scheduling algorithm, each job is scheduled on only one multicore
* host. The scheduler tries to have as few hosts as possible that are powered
* on by packing all the jobs on the least number of hosts and switching off the
* others.
*/
class BinPacking : public DynScheduler
{
public:
BinPacking(Workload *workload, SchedulingDecision *decision, Queue *queue, ResourceSelector *selector,
double rjms_delay, rapidjson::Document *variant_options);
BinPacking(Workload *workload, SchedulingDecision *decision, Queue *queue,
ResourceSelector *selector, double rjms_delay,
rapidjson::Document *variant_options);
virtual ~BinPacking();
virtual void on_simulation_start(double date, const rapidjson::Value &batsim_config);
virtual void on_simulation_start(
double date, const rapidjson::Value &batsim_config);
virtual void on_simulation_end(double date);
virtual void make_decisions(double date, SortableJobOrder::UpdateInformation *update_info,
virtual void make_decisions(double date,
SortableJobOrder::UpdateInformation *update_info,
SortableJobOrder::CompareInformation *compare_info);
private:
int max_nb_core;
// list of hosts, to be sorted with listofHosts.sort(HostComparator())
std::list<SortableHost *> listofHosts;
std::map<std::string, SortableHost*> current_allocations;
std::map<std::string, SortableHost *> current_allocations;
bool _debug = true;
// to_string fonction, for debugging
......
......@@ -7,6 +7,8 @@ from os.path import abspath, basename
Workload = namedtuple('Workload', ['name', 'filename'])
Platform = namedtuple('Platform', ['name', 'filename'])
Scheduler = namedtuple('Scheduler', ['name', 'short_name'])
def pytest_generate_tests(metafunc):
if 'platform_monoC' in metafunc.fixturenames:
......@@ -30,8 +32,22 @@ def pytest_generate_tests(metafunc):
filename=abspath(platform_file)) for platform_file in platform_files]
metafunc.parametrize('platform_multiC', platforms)
if 'sched_mono' in metafunc.fixturenames:
scheds = [
Scheduler('easy_bf', 'easy'),
Scheduler('fcfs', 'fcfs')
]
metafunc.parametrize('sched_mono', scheds)
if 'sched_multi' in metafunc.fixturenames:
scheds = [
Scheduler('multicore_filler', 'filler'),
Scheduler('bin_packing', 'bp'),
Scheduler('bin_packing_energy', 'bpNRJ')
]
metafunc.parametrize('sched_multi', scheds)
# def pytest_cmdline_preparse(config, args):
# html_file = "test-out/testreport.html"
# print('HTML report file:', html_file)
# args.extend(['--html', html_file, '--self-contained-html'])
\ No newline at end of file
# args.extend(['--html', html_file, '--self-contained-html'])
from helper import *
def test_broker_filler(platform_multiC, workload_static):
test_name = f'broker_multicore_filler-{platform_multiC.name}-{workload_static.name}'
output_dir, robin_filename, _ = init_instance(test_name)
batcmd = gen_batsim_cmd(platform_multiC.filename, workload_static.filename, output_dir, "--energy --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse")
instance = RobinInstance(output_dir=output_dir,
batcmd=batcmd,
schedcmd=f"batmen -v multicore_filler --variant_options_filepath test/schedconf/user_description_file.json",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
instance.to_file(robin_filename)
ret = run_robin(robin_filename)
assert ret.returncode == 0
def test_broker_mono(platform_monoC, workload_static, sched_mono):
"""Test the broker mode with monocore platform files and schedulers"""
def test_broker_binpacking(platform_multiC, workload_static):
test_name = f'broker_binpacking-{platform_multiC.name}-{workload_static.name}'
test_name = f'broker-{sched_mono.short_name}-{platform_monoC.name}-{workload_static.name}'
output_dir, robin_filename, _ = init_instance(test_name)
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")
batcmd = gen_batsim_cmd(platform_monoC.filename, workload_static.filename, output_dir, "--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 test/schedconf/user_description_file.json",
schedcmd=f"batmen -v {sched_mono.name} --variant_options_filepath test/schedconf/user_description_file.json",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
......@@ -32,18 +19,21 @@ def test_broker_binpacking(platform_multiC, workload_static):
ret = run_robin(robin_filename)
assert ret.returncode == 0
def test_broker_binpackingNRJ(platform_multiC, workload_static):
test_name = f'broker_binpackingNRJ-{platform_multiC.name}-{workload_static.name}'
def test_broker_multi(platform_multiC, workload_static, sched_multi):
"""Test the broker mode with multicore platform files and schedulers"""
test_name = f'broker-{sched_multi.short_name}-{platform_multiC.name}-{workload_static.name}'
output_dir, robin_filename, _ = init_instance(test_name)
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 bin_packing_energy --queue_order=desc_size --variant_options_filepath test/schedconf/user_description_file.json",
schedcmd=f"batmen -v {sched_multi.name} --queue_order=desc_size --variant_options_filepath test/schedconf/user_description_file.json",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
instance.to_file(robin_filename)
ret = run_robin(robin_filename)
assert ret.returncode == 0
\ No newline at end of file
assert ret.returncode == 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment