Skip to content

Commit

Permalink
EASY implementation + testing
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Dec 6, 2024
1 parent 4dd2c87 commit 87523d3
Show file tree
Hide file tree
Showing 10 changed files with 1,133 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ set(SOURCE_FILES
include/wrench/services/compute/batch/batch_schedulers/homegrown/conservative_bf/BatchJobSet.h
src/wrench/services/compute/batch/batch_schedulers/homegrown/conservative_bf/ConservativeBackfillingBatchScheduler.cpp
include/wrench/services/compute/batch/batch_schedulers/homegrown/conservative_bf/ConservativeBackfillingBatchScheduler.h
src/wrench/services/compute/batch/batch_schedulers/homegrown/easy_bf/EasyBackfillingBatchScheduler.cpp
include/wrench/services/compute/batch/batch_schedulers/homegrown/easy_bf/EasyBackfillingBatchScheduler.h
src/wrench/services/compute/batch/batch_schedulers/homegrown/conservative_bf/NodeAvailabilityTimeLine.cpp
include/wrench/services/compute/batch/batch_schedulers/homegrown/conservative_bf/NodeAvailabilityTimeLine.h
include/wrench/services/compute/batch/batch_schedulers/homegrown/conservative_bf_core_level/BatchJobSetCoreLevel.h
Expand Down Expand Up @@ -488,6 +490,7 @@ set(TEST_FILES
test/services/compute_services/batch_standard_and_pilot_jobs/HomeGrownTimeLineTest.cpp
test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceTest.cpp
test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceFCFSTest.cpp
test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceEASYBFTest.cpp
test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceCONSERVATIVEBFTest.cpp
test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceTraceFileTest.cpp
test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceOutputCSVFileTest.cpp
Expand Down
3 changes: 2 additions & 1 deletion include/wrench/services/compute/batch/BatchComputeService.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ namespace wrench {
friend class WorkloadTraceFileReplayer;
friend class HomegrownBatchScheduler;
friend class FCFSBatchScheduler;
friend class EasyBackfillingBatchScheduler;
friend class ConservativeBackfillingBatchScheduler;
friend class ConservativeBackfillingBatchSchedulerCoreLevel;

Expand Down Expand Up @@ -216,7 +217,7 @@ namespace wrench {
std::set<std::string> queue_ordering_options = {"fcfs", "lcfs", "desc_bounded_slowdown", "desc_slowdown",
"asc_size", "desc_size", "asc_walltime", "desc_walltime"};
#else
std::set<std::string> scheduling_algorithms = {"fcfs", "conservative_bf", "conservative_bf_core_level"};
std::set<std::string> scheduling_algorithms = {"fcfs", "conservative_bf", "conservative_bf_core_level", "easy_bf_depth0", "easy_bf_depth1"};

//Batch queue ordering options
std::set<std::string> queue_ordering_options = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ namespace wrench {
* @brief The batch scheduling algorithm. Can be:
* - If ENABLE_BATSCHED is set to off / not set:
* - "fcfs": First Come First Serve, which allocates resources at the core level (i.e., two jobs may run on the same node if that node has enough cores to support both jobs) (default)
* - "easy_bf_depth0": a home-grown implementation of EASY (FCFS with backfilling), which only allocates resources at the node level (i.e., two jobs can never run on the same node even if that node has enough cores to support both jobs), and which may postpone the first (oldest) job in the queue via backfilling actions
* - "easy_bf_depth1": a home-grown implementation of EASY (FCFS with backfilling), which only allocates resources at the node level (i.e., two jobs can never run on the same node even if that node has enough cores to support both jobs), and which will never postpone the first (oldest) job in the queue via backfilling actions
* - "conservative_bf": a home-grown implementation of FCFS with conservative backfilling, which only allocates resources at the node level (i.e., two jobs can never run on the same node even if that node has enough cores to support both jobs)
* - "conservative_bf_core_level": a home-grown implementation of FCFS with conservative backfilling, which allocates resources at the core level (i.e., two jobs may run on the same node if that node has enough cores to support both jobs)
*
Expand Down Expand Up @@ -111,7 +113,7 @@ namespace wrench {
DECLARE_PROPERTY_NAME(SUBMIT_TIME_OF_FIRST_JOB_IN_WORKLOAD_TRACE_FILE);

/**
* @brief Path to a to-be-generated Batsim-style CSV trace file (e.g. for b3atch schedule visualization purposes).
* @brief Path to a to-be-generated Batsim-style CSV trace file (e.g. for batch schedule visualization purposes).
* - If ENABLE_BATSCHED is set to off or not set: ignored
* - If ENABLE_BATSCHED is set to on: The trace file is generated in CSV format as follows:
* allocated_processors,consumed_energy,execution_time,finish_time,job_id,metadata,
Expand Down
3 changes: 3 additions & 0 deletions include/wrench/services/compute/batch/BatchJob.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ namespace wrench {
}

private:
friend class EasyBackfillingBatchScheduler;
friend class ConservativeBackfillingBatchScheduler;
friend class ConservativeBackfillingBatchSchedulerCoreLevel;

u_int32_t easy_bf_start_date; // Field used by EASY_BF
u_int32_t easy_bf_expected_end_date; // Field used by EASY_BF
u_int32_t conservative_bf_start_date; // Field used by CONSERVATIVE_BF
u_int32_t conservative_bf_expected_end_date;// Field used by CONSERVATIVE_BF

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (c) 2017-2019. The WRENCH Team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/

#ifndef WRENCH_EASYBACKFILLINGBATCHSCHEDULER_H
#define WRENCH_EASYBACKFILLINGBATCHSCHEDULER_H

#include "wrench/services/compute/batch/BatchComputeService.h"
#include "wrench/services/compute/batch/batch_schedulers/homegrown/HomegrownBatchScheduler.h"
#include <wrench/services/compute/batch/batch_schedulers/homegrown/conservative_bf/NodeAvailabilityTimeLine.h>

namespace wrench {

/***********************/
/** \cond INTERNAL */
/***********************/

/**
* @brief A class that defines a easy backfilling batch scheduler
*/
class EasyBackfillingBatchScheduler : public HomegrownBatchScheduler {

public:
explicit EasyBackfillingBatchScheduler(BatchComputeService *cs, int depth);

void processQueuedJobs() override;

void processJobSubmission(std::shared_ptr<BatchJob> batch_job) override;
void processJobFailure(std::shared_ptr<BatchJob> batch_job) override;
void processJobCompletion(std::shared_ptr<BatchJob> batch_job) override;
void processJobTermination(std::shared_ptr<BatchJob> batch_job) override;

void compactSchedule();

std::map<simgrid::s4u::Host *, std::tuple<unsigned long, sg_size_t>> scheduleOnHosts(unsigned long, unsigned long, sg_size_t) override;

std::map<std::string, double>
getStartTimeEstimates(std::set<std::tuple<std::string, unsigned long, unsigned long, sg_size_t>> set_of_jobs) override;

private:
std::unique_ptr<NodeAvailabilityTimeLine> schedule;
int _depth;
};


/***********************/
/** \endcond */
/***********************/
}// namespace wrench


#endif//WRENCH_EASYBACKFILLINGBATCHSCHEDULER_H
5 changes: 5 additions & 0 deletions src/wrench/services/compute/batch/BatchComputeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "wrench/services/compute/batch/batch_schedulers/homegrown/fcfs/FCFSBatchScheduler.h"
#include "wrench/services/compute/batch/batch_schedulers/homegrown/conservative_bf/ConservativeBackfillingBatchScheduler.h"
#include "wrench/services/compute/batch/batch_schedulers/homegrown/conservative_bf_core_level/ConservativeBackfillingBatchSchedulerCoreLevel.h"
#include "wrench/services/compute/batch/batch_schedulers/homegrown/easy_bf/EasyBackfillingBatchScheduler.h"
#include "wrench/services/compute/batch/batch_schedulers/batsched/BatschedBatchScheduler.h"
#include <wrench/failure_causes/FunctionalityNotAvailable.h>
#include <wrench/failure_causes/JobKilled.h>
Expand Down Expand Up @@ -201,6 +202,10 @@ namespace wrench {
this->scheduler = std::unique_ptr<BatchScheduler>(new FCFSBatchScheduler(this));
} else if (batch_scheduling_alg == "conservative_bf") {
this->scheduler = std::unique_ptr<BatchScheduler>(new ConservativeBackfillingBatchScheduler(this));
} else if (batch_scheduling_alg == "easy_bf_depth0") {
this->scheduler = std::unique_ptr<BatchScheduler>(new EasyBackfillingBatchScheduler(this, 0));
} else if (batch_scheduling_alg == "easy_bf_depth1") {
this->scheduler = std::unique_ptr<BatchScheduler>(new EasyBackfillingBatchScheduler(this, 1));
} else if (batch_scheduling_alg == "conservative_bf_core_level") {
this->scheduler = std::unique_ptr<BatchScheduler>(new ConservativeBackfillingBatchSchedulerCoreLevel(this));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ namespace wrench {
this->schedule->setTimeOrigin((u_int32_t) Simulation::getCurrentSimulatedDate());

// Start all non-started the jobs in the next slot!

std::set<std::shared_ptr<BatchJob>> next_jobs = this->schedule->getJobsInFirstSlot();
if (next_jobs.empty()) {
this->compactSchedule();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace wrench {
for (auto &availability_timeslot: this->availability_timeslots) {
std::cerr << availability_timeslot.first << "(" << availability_timeslot.second.num_nodes_utilized << ") | ";
for (auto const &j: availability_timeslot.second.jobs) {
std::cerr << j->getJobID() << "(" << j->getRequestedNumNodes() << ") ";
std::cerr << j->getCompoundJob()->getName() << "(" << j->getRequestedNumNodes() << ") ";
}
std::cerr << "\n";
}
Expand Down
Loading

0 comments on commit 87523d3

Please sign in to comment.