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

doc: cosmetics in bin_backing_energy

parent d06890e5
No related branches found
No related tags found
1 merge request!16Merge request multibehavior
Pipeline #5825 passed
......@@ -258,20 +258,18 @@ void BinPackingEnergy::make_decisions(double date,
}
}
}
/**********************************************************************
* Binpacking scheduling decision:
* Sort jobs in decreasing number of requested cores
* (DescendingSizeOrder) and hosts in our custom order (~ increasing
* available core)
**********************************************************************/
LOG_F(1, "makedecisions, queue of job has size %d", _queue->nb_jobs());
if (sort_queue)
{
_queue->sort_queue(update_info, compare_info);
}
/**********************************************************************
* Binpacking scheduling decision:
* Go through the job queue and try to schedule the jobs
**********************************************************************/
if (_queue->nb_jobs()>0)
{
/* Go through the job queue and try to schedule the jobs */
bin_packing_algo(date);
}
......@@ -319,24 +317,21 @@ void BinPackingEnergy::make_decisions(double date,
void BinPackingEnergy::bin_packing_algo(double date)
{
/**********************************************************************
* Binpacking scheduling decision:
* Sort jobs in decreasing number of requested cores
* (DescendingSizeOrder) and hosts in our custom order (~ increasing
* available core)
**********************************************************************/
/* Binpacking main algo:
* Go through jobs in decreasing number of requested cores (DescendingSizeOrder)
* and hosts in our custom order (~ increasing available core) */
listofHosts.sort(HostComparator());
bool host_found = true;
int previous_job_requested_resources = ((*(_queue->begin()))->job)->nb_requested_resources;
for (auto job_it = _queue->begin(); job_it != _queue->end();)
{
const Job *job = (*job_it)->job;
/* Optimization part, can be removed if it created bugs
* If the previous job had the same size as the considered job
* and didn't find a host we skip the bin-packing step for this job
* If the previous job was of size 1 then that means that all host are full so
* we end the algorithm */
if(!(host_found) && (previous_job_requested_resources == job->nb_requested_resources)){
if(previous_job_requested_resources==1){
return;
......@@ -447,4 +442,4 @@ void BinPackingEnergy::update_machine_states(double date)
mit = states_to_switch.erase(mit);
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment