Skip to content
Snippets Groups Projects
Commit a37bfb3d authored by jgatt's avatar jgatt
Browse files

added degrad_space_job and degrad_time_job function + yellow behavior split monocore + multicore

parent 5c4aab16
No related branches found
No related tags found
1 merge request!20merge requested multibehavor_mono_multi_core
Pipeline #5892 passed
......@@ -138,7 +138,26 @@ bool DMUserMultiBehavior::rigid_job(shared_ptr<Job> job, Profile *profile)
+= job->nb_requested_resources * std::stol(job->profile);
return true;
}
bool DMUserMultiBehavior::degrad_space_job(
shared_ptr<Job> & job, Profile *profile)
{
return degrad_job(job,profile);
}
bool DMUserMultiBehavior::degrad_time_job(shared_ptr<Job> & job, Profile *profile)
{
/* Log... */
dm_stat[2 * DEGRADED]++;
dm_stat[2 * DEGRADED + 1] += (job->nb_requested_resources) * std::stol(job->profile);
/* time degrad: divide by two the execution time */
long original_time = std::stol(job->profile);
long new_time = original_time/2;
Parser::profile_from_duration(
profile, std::to_string(new_time), user_name, platform_computing_speed);
job->profile = profile->name = 'd' + std::to_string(original_time);
return true;
}
bool DMUserMultiBehavior::red_window_behavior_mono_core(double date, shared_ptr<Job> job, Profile *profile)
{
double behavior = distribution(random_gen)*red_prob_total;
......@@ -161,7 +180,7 @@ bool DMUserMultiBehavior::red_window_behavior_mono_core(double date, shared_ptr<
if (behavior < total_probability){
log_behavior(job,"consider_degrad",0);
log_behavior(job,"rigid",0);
return degrad_job(job,profile);
return degrad_space_job(job,profile);
}
/* Reconfig */
total_probability += red_prob[R_RECONFIG];
......@@ -196,7 +215,7 @@ bool DMUserMultiBehavior::red_window_behavior_multi_core(double date, shared_ptr
if (behavior < total_probability){
log_behavior(job,"consider_degrad",0);
log_behavior(job, "degrad", 0);
return degrad_job(job,profile);
return degrad_space_job(job,profile);
}
/* Reconfig */
total_probability += red_prob[R_RECONFIG];
......@@ -210,7 +229,7 @@ bool DMUserMultiBehavior::red_window_behavior_multi_core(double date, shared_ptr
return rigid_job(job,profile);
}
bool DMUserMultiBehavior::red_window_behavior(double date,shared_ptr<Job> job,Profile *profile)
bool DMUserMultiBehavior::red_window_behavior(double date,shared_ptr<Job> & job,Profile *profile)
{
/*
* We decide at random the behavior
......@@ -226,37 +245,55 @@ bool DMUserMultiBehavior::red_window_behavior(double date,shared_ptr<Job> job,Pr
}
}
bool DMUserMultiBehavior::yellow_window_behavior(shared_ptr<Job> job,Profile *profile){
/*
* We decide at random the behavior (rigid, degrad, reconfig)
* that will be done on this job
*/
bool DMUserMultiBehavior::yellow_window_behavior_mono_core(shared_ptr<Job> job, Profile *profile)
{
double behavior = distribution(random_gen)*yellow_prob_total;
double total_probability = 0.0;
total_probability+= yellow_prob[Y_RECONFIG];
if (behavior < total_probability){
log_behavior(job,"consider_reconfig",0);
if (job->nb_requested_resources == 1){
log_behavior(job,"rigid",0);
}
else{
log_behavior(job, "reconfig", 0);
}
log_behavior(job,"rigid",0);
return reconfig_job(job,profile);
}
total_probability += yellow_prob[Y_DEGRAD];
if (behavior < total_probability){
log_behavior(job,"consider_degrad",0);
if (job->nb_requested_resources== 1){
log_behavior(job,"rigid",0);
}
else{
log_behavior(job, "degrad", 0);
}
log_behavior(job,"rigid",0);
return degrad_job(job,profile);
}
// if none of the above we launch the job without i.e. rigid strategy
return rigid_job(job,profile);
}
bool DMUserMultiBehavior::yellow_window_behavior_multi_core(shared_ptr<Job> job, Profile *profile)
{
double behavior = distribution(random_gen)*yellow_prob_total;
double total_probability = 0.0;
total_probability+= yellow_prob[Y_RECONFIG];
if (behavior < total_probability){
log_behavior(job,"consider_reconfig",0);
log_behavior(job, "reconfig", 0);
return reconfig_job(job,profile);
}
total_probability += yellow_prob[Y_DEGRAD];
if (behavior < total_probability){
log_behavior(job,"consider_degrad",0);
log_behavior(job, "degrad", 0);
return degrad_job(job,profile);
}
// if none of the above we launch the job without i.e. rigid strategy
return rigid_job(job,profile);
}
bool DMUserMultiBehavior::yellow_window_behavior(shared_ptr<Job> & job,Profile *profile){
/*
* We decide at random the behavior (rigid, degrad, reconfig)
* that will be done on this job
*/
if(job->nb_requested_resources == 1 ){
return yellow_window_behavior_mono_core(job,profile);
}
else{
return yellow_window_behavior_multi_core(job,profile);
}
}
......
......@@ -64,6 +64,8 @@ protected:
bool is_in_red_window(double date);
void log_behavior(shared_ptr<Job> & job, std::string behavior_name, long delay_time);
bool rigid_job(shared_ptr<Job> job,Profile* profile);
bool degrad_space_job(shared_ptr<Job> & job,Profile* profile);
bool degrad_time_job(shared_ptr<Job> & job,Profile* profile);
bool C_you_later_job(double date, double next_time,shared_ptr<Job> job);
/**
......@@ -83,7 +85,7 @@ protected:
* (degrad,reconfig,renonce,rigid,see_you_later)
* following the provided probabilities given at the creation of the class
*/
bool red_window_behavior(double date,shared_ptr<Job> job, Profile *profile);
bool red_window_behavior(double date,shared_ptr<Job> & job, Profile *profile);
bool red_window_behavior_mono_core(double date,shared_ptr<Job> job,Profile *profile);
bool red_window_behavior_multi_core(double date,shared_ptr<Job> job, Profile *profile);
/**
......@@ -91,7 +93,9 @@ protected:
* @details This function do the 3 behaviors for yellow windows (degrad,reconfig, rigid)
* following the provided probabilities given at the creation of the class
*/
bool yellow_window_behavior(shared_ptr<Job> job, Profile *profile);
bool yellow_window_behavior(shared_ptr<Job> & job, Profile *profile);
bool yellow_window_behavior_mono_core(shared_ptr<Job>job,Profile *profile);
bool yellow_window_behavior_multi_core(shared_ptr<Job> job,Profile *profile);
std::vector<double> red_prob;
double red_prob_total;
std::vector<double> yellow_prob;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment