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

dev: delete ReplayUserReconfig (not very relevent anymore)

parent af6f3542
Branches
Tags
1 merge request!21issue17,18,21_new
......@@ -127,9 +127,6 @@ Broker::Broker(rapidjson::Document *user_description_file)
else if (category == "replay_user_rigid")
user = new ReplayUserRigid(name, param, dm_window);
else if (category == "replay_user_reconfig")
user = new ReplayUserReconfig(name, param, seed_generator());
/* DM user */
else if (category == "dm_user_reconfig"
|| category == "dm_user_degrad" || category == "dm_user_renonce"
......
......@@ -36,14 +36,6 @@
"input_json": "charly.json"
}
},
{
"name": "donella",
"category": "replay_user_reconfig",
"param": {
"input_json": "donella.json",
"big_medium_little": [0.4, 0.4, 0.2]
}
},
{
"name": "elias",
"category": "dm_user_reconfig",
......
......@@ -81,11 +81,6 @@ void ReplayUser::jobs_to_submit(double date, std::list<shared_ptr<Job>> &jobs,
= lround(original_trace->top()->submission_time);
}
int *ReplayUser::get_dm_stat()
{
return dm_stat;
}
/* ReplayUserRigid */
ReplayUserRigid::ReplayUserRigid(
std::string name, const rapidjson::Value &param, DMWindow *window)
......@@ -120,96 +115,6 @@ bool ReplayUserRigid::handle_job(
return true;
}
/* ReplayUserReconfig */
bool ReplayUserReconfig::handle_job(
double date, shared_ptr<Job> job, Profile *profile)
{
int orig_nb_core = job->nb_requested_resources;
double drawing = distribution(random_gen);
std::string flavor;
if (drawing < big)
// no reconfig
flavor = "b";
else if (drawing < big + medium)
{
// divide by 2 rounded up
job->nb_requested_resources = (orig_nb_core + 1) / 2;
flavor = "m";
}
else
{
// divide by 4 rounded up
job->nb_requested_resources = (orig_nb_core + 3) / 4;
flavor = "l";
}
build_profile(profile, job->profile, orig_nb_core, flavor);
job->profile = profile->name;
return true;
}
Profile *ReplayUserReconfig::build_profile(
Profile *profile, std::string duration, int nb_core, std::string flavor)
{
profile->workload_name = user_name;
if (nb_core == 1)
profile->name = "1_" + duration;
else
profile->name = flavor + "_" + duration;
double compute_load
= std::stod(duration) * nb_core * PLATFORM_COMPUTING_SPEED;
profile->description
= "{\"com\": 0.0, \"cpu\": " + std::to_string(compute_load)
+ ", \"type\": \"parallel_homogeneous_total\"}";
return profile;
}
ReplayUserReconfig::ReplayUserReconfig(
std::string name, const rapidjson::Value &param, uint_fast32_t random_seed)
{
PPK_ASSERT_ERROR(param.HasMember("big_medium_little"),
"Invalid user_description file: wrong 'param' for user %s, there "
"should be an 'big_medium_little' field",
name.c_str());
PPK_ASSERT_ERROR(param["big_medium_little"].IsArray()
&& param["big_medium_little"].GetArray().Size() == 3,
"Invalid user_description file for user %s: 'big_medium_little' "
"should "
"be an array of size 3",
name.c_str());
auto bml = param["big_medium_little"].GetArray().begin();
big = (bml++)->GetDouble();
medium = (bml++)->GetDouble();
little = bml->GetDouble();
PPK_ASSERT_ERROR(big + medium + little == 1.0,
"Invalid user_description file for user %s: the sum of "
"'big_medium_little' should be 1.0.",
name.c_str());
/* Initialize name and input json */
init_ReplayUser(name, param);
/* Initialize random generator with seed for reproductible experiments
*/
random_gen = std::mt19937(random_seed);
}
ReplayUserReconfig::~ReplayUserReconfig()
{
delete original_trace;
}
void ReplayUserReconfig::jobs_to_submit(double date,
std::list<shared_ptr<Job>> &jobs, std::list<const Profile *> &profiles)
{
ReplayUser::jobs_to_submit(date, jobs, profiles);
}
/******************************************************************************
*********************** Users "demand response" ******************************
*****************************************************************************/
......
......@@ -42,7 +42,6 @@ protected:
* behavior and returns if it should still be executed now.
*/
virtual bool handle_job(double date, shared_ptr<Job>job, Profile *profile) = 0;
virtual int *get_dm_stat();
protected:
std::string input_json;
......@@ -73,39 +72,6 @@ protected:
bool handle_job(double date, shared_ptr<Job>job, Profile *profile);
};
/**
* @brief The user follows the same submission times as in the input trace but
* sometimes resizing the jobs (ie changing the number of cores allocated).
* @details The user is given as input a tuple big_medium_little representing
* the proportion of jobs to run with original size (big), with half (medium)
* and a quarter (little) of the original size. Achieved by random drawing.
*/
class ReplayUserReconfig : public ReplayUser
{
public:
ReplayUserReconfig(std::string name, const rapidjson::Value &param,
uint_fast32_t random_seed);
~ReplayUserReconfig();
long next_submission();
void jobs_to_submit(
double date, std::list<shared_ptr<Job>> &jobs, std::list<const Profile *> &profiles);
protected:
/** Draw a random variable according to the proportions given by
* big_medium_little and reconfigure the number of cores requested
* accordingly. */
bool handle_job(double date, shared_ptr<Job>job, Profile *profile);
private:
double big, medium, little;
std::mt19937 random_gen;
std::uniform_real_distribution<double> distribution
= std::uniform_real_distribution<double>(0.0, 1.0);
Profile *build_profile(Profile *profile, std::string duration, int nb_core,
std::string flavor);
};
/******************************************************************************
*********************** Users "demand response" ******************************
......
{
"users": [
{
"name": "user14",
"category": "replay_user_reconfig",
"param": {
"input_json": "test/workloads/dyn/user14.json",
"big_medium_little": [0.4, 0.4, 0.2]
}
},
{
"name": "user15",
"category": "replay_user_reconfig",
"param": {
"input_json": "test/workloads/dyn/user15.json",
"big_medium_little": [0.4, 0.4, 0.2]
}
},
{
"name": "user16",
"category": "replay_user_reconfig",
"param": {
"input_json": "test/workloads/dyn/user16.json",
"big_medium_little": [0.4, 0.4, 0.2]
}
},
{
"name": "user18",
"category": "replay_user_reconfig",
"param": {
"input_json": "test/workloads/dyn/user18.json",
"big_medium_little": [0.4, 0.4, 0.2]
}
}
]
}
\ No newline at end of file
......@@ -6,7 +6,6 @@ users = [
"dicho_intersubmission_time",
"routine_greedy",
"replay_user_rigid",
"replay_user_reconfig"
]
#### User models ####
......@@ -35,10 +34,6 @@ def test_replay_user_rigid(platform_multiC):
assert_exec_time_equals_profile(out_dir)
def test_replay_user_reconfig(platform_multiC):
run_user('replay_user_reconfig', platform_multiC)
def run_user(user_name, platform_multiC, test_name=None, schedconf=None):
if test_name == None:
test_name = f'{user_name}-{platform_multiC.name}'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment