Commit 18721848 authored by Millian Poquet's avatar Millian Poquet

Documentation

parent f23e8717
...@@ -242,7 +242,7 @@ TCL_SUBST = ...@@ -242,7 +242,7 @@ TCL_SUBST =
# members will be omitted, etc. # members will be omitted, etc.
# The default value is: NO. # The default value is: NO.
OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
# Python sources only. Doxygen will then generate output that is more tailored # Python sources only. Doxygen will then generate output that is more tailored
...@@ -409,7 +409,7 @@ LOOKUP_CACHE_SIZE = 0 ...@@ -409,7 +409,7 @@ LOOKUP_CACHE_SIZE = 0
# normally produced when WARNINGS is set to YES. # normally produced when WARNINGS is set to YES.
# The default value is: NO. # The default value is: NO.
EXTRACT_ALL = YES EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
# be included in the documentation. # be included in the documentation.
...@@ -730,7 +730,7 @@ WARN_IF_DOC_ERROR = YES ...@@ -730,7 +730,7 @@ WARN_IF_DOC_ERROR = YES
# parameter documentation, but not about the absence of documentation. # parameter documentation, but not about the absence of documentation.
# The default value is: NO. # The default value is: NO.
WARN_NO_PARAMDOC = NO WARN_NO_PARAMDOC = YES
# The WARN_FORMAT tag determines the format of the warning messages that doxygen # The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which # can produce. The string should contain the $file, $line, and $text tags, which
...@@ -793,7 +793,7 @@ RECURSIVE = NO ...@@ -793,7 +793,7 @@ RECURSIVE = NO
# Note that relative paths are relative to the directory from which doxygen is # Note that relative paths are relative to the directory from which doxygen is
# run. # run.
EXCLUDE = EXCLUDE = cmake old schedulers repeater.py
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded # directories that are symbolic links (a Unix file system feature) are excluded
......
/**
* @file batsim.cpp
* @brief Batsim's entry point
*/
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
...@@ -24,14 +29,17 @@ ...@@ -24,14 +29,17 @@
using namespace std; using namespace std;
XBT_LOG_NEW_DEFAULT_CATEGORY(batsim, "batsim"); XBT_LOG_NEW_DEFAULT_CATEGORY(batsim, "batsim"); //!< Logging
/**
* @brief Batsim verbosity level
*/
enum class VerbosityLevel enum class VerbosityLevel
{ {
QUIET, QUIET //!< Almost nothing should be displayed
NETWORK_ONLY, ,NETWORK_ONLY //!< Only network messages should be displayed
INFORMATION, ,INFORMATION //!< Informations should be displayed (default)
DEBUG ,DEBUG //!< Debug informations should be displayed too
}; };
/** /**
...@@ -39,22 +47,22 @@ enum class VerbosityLevel ...@@ -39,22 +47,22 @@ enum class VerbosityLevel
*/ */
struct MainArguments struct MainArguments
{ {
std::string platformFilename; //! The SimGrid platform filename std::string platformFilename; //!< The SimGrid platform filename
std::string workloadFilename; //! The JSON workload filename std::string workloadFilename; //!< The JSON workload filename
std::string socketFilename = "/tmp/bat_socket"; //! The Unix Domain Socket filename std::string socketFilename = "/tmp/bat_socket"; //!< The Unix Domain Socket filename
std::string masterHostName = "master_host"; //! The name of the SimGrid host which runs scheduler processes and not user tasks std::string masterHostName = "master_host"; //!< The name of the SimGrid host which runs scheduler processes and not user tasks
std::string exportPrefix = "out"; //! The filename prefix used to export simulation information std::string exportPrefix = "out"; //!< The filename prefix used to export simulation information
bool energy_used = false; //! True if and only if the SimGrid energy plugin should be used. bool energy_used = false; //!< True if and only if the SimGrid energy plugin should be used.
VerbosityLevel verbosity = VerbosityLevel::INFORMATION; //! Sets the Batsim verbosity VerbosityLevel verbosity = VerbosityLevel::INFORMATION; //!< Sets the Batsim verbosity
bool allow_space_sharing = false; //! Allows/forbids space sharing. Two jobs can run on the same machine if and only if space sharing is allowed. bool allow_space_sharing = false; //!< Allows/forbids space sharing. Two jobs can run on the same machine if and only if space sharing is allowed.
bool enable_simgrid_process_tracing = false; //! If set to true, this options enables the tracing of SimGrid processes bool enable_simgrid_process_tracing = false; //!< If set to true, this options enables the tracing of SimGrid processes
bool enable_schedule_tracing = true; //! If set to true, the schedule is exported to a Pajé trace file bool enable_schedule_tracing = true; //!< If set to true, the schedule is exported to a Pajé trace file
bool abort = false; //! A boolean value. If set to yet, the launching should be aborted for reason abortReason bool abort = false; //!< A boolean value. If set to yet, the launching should be aborted for reason abortReason
std::string abortReason; //! Human readable reasons which explains why the launch should be aborted std::string abortReason; //!< Human readable reasons which explains why the launch should be aborted
}; };
/** /**
...@@ -146,6 +154,12 @@ int parse_opt (int key, char *arg, struct argp_state *state) ...@@ -146,6 +154,12 @@ int parse_opt (int key, char *arg, struct argp_state *state)
return 0; return 0;
} }
/**
* @brief Main function
* @param[in] argc The number of arguments
* @param[in] argv The arguments' values
* @return 0 on success, something else otherwise
*/
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
MainArguments mainArgs; MainArguments mainArgs;
......
/** /**
* @file context.hpp The Batsim context * @file context.hpp
* @brief The Batsim context
*/ */
#pragma once #pragma once
...@@ -11,22 +12,25 @@ ...@@ -11,22 +12,25 @@
#include "export.hpp" #include "export.hpp"
#include "pstate.hpp" #include "pstate.hpp"
/**
* @brief The Batsim context
*/
struct BatsimContext struct BatsimContext
{ {
UnixDomainSocket socket; UnixDomainSocket socket; //!< The UnixDomainSocket
Machines machines; Machines machines; //!< The machines
Jobs jobs; Jobs jobs; //!< The jobs
Profiles profiles; Profiles profiles; //!< The profiles
PajeTracer paje_tracer; PajeTracer paje_tracer; //!< The PajeTracer
PStateChangeTracer pstate_tracer; PStateChangeTracer pstate_tracer; //!< The PStateChangeTracer
CurrentSwitches current_switches; CurrentSwitches current_switches; //!< The current switches
long long microseconds_used_by_scheduler = 0; long long microseconds_used_by_scheduler = 0; //!< The number of microseconds used by the scheduler
bool energy_used; bool energy_used; //!< Stores whether the energy part of Batsim should be used
bool smpi_used; bool smpi_used; //!< Stores whether SMPI should be used
bool allow_space_sharing; bool allow_space_sharing; //!< Stores whether space sharing (using the same machines to compute different jobs) should be allowed
bool trace_schedule; bool trace_schedule; //!< Stores whether the resulting schedule should be outputted
std::string platform_filename; std::string platform_filename; //!< The name of the platform file
std::string workload_filename; std::string workload_filename; //!< The name of the workload file
std::string export_prefix; std::string export_prefix; //!< The output export prefix
}; };
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
using namespace std; using namespace std;
XBT_LOG_NEW_DEFAULT_CATEGORY(export, "export"); XBT_LOG_NEW_DEFAULT_CATEGORY(export, "export"); //!< Logging
WriteBuffer::WriteBuffer(const std::string & filename, int bufferSize) WriteBuffer::WriteBuffer(const std::string & filename, int bufferSize)
: bufferSize(bufferSize) : bufferSize(bufferSize)
...@@ -481,7 +481,8 @@ void PajeTracer::hsvToRgb(double h, double s, double v, double & r, double & g, ...@@ -481,7 +481,8 @@ void PajeTracer::hsvToRgb(double h, double s, double v, double & r, double & g,
} }
} }
void exportJobsToCSV(const string &filename, const BatsimContext *context)
void exportJobsToCSV(const std::string &filename, const BatsimContext *context)
{ {
ofstream f(filename, ios_base::trunc); ofstream f(filename, ios_base::trunc);
xbt_assert(f.is_open(), "Cannot write file '%s'", filename.c_str()); xbt_assert(f.is_open(), "Cannot write file '%s'", filename.c_str());
...@@ -528,7 +529,7 @@ void exportJobsToCSV(const string &filename, const BatsimContext *context) ...@@ -528,7 +529,7 @@ void exportJobsToCSV(const string &filename, const BatsimContext *context)
} }
void exportScheduleToCSV(const string &filename, double scheduling_time, const BatsimContext *context) void exportScheduleToCSV(const std::string &filename, double scheduling_time, const BatsimContext *context)
{ {
ofstream f(filename, ios_base::trunc); ofstream f(filename, ios_base::trunc);
xbt_assert(f.is_open(), "Cannot write file '%s'", filename.c_str()); xbt_assert(f.is_open(), "Cannot write file '%s'", filename.c_str());
......
...@@ -50,10 +50,10 @@ public: ...@@ -50,10 +50,10 @@ public:
void flushBuffer(); void flushBuffer();
private: private:
std::ofstream f; //! The file stream on which the buffer is outputted std::ofstream f; //!< The file stream on which the buffer is outputted
const int bufferSize; //! The buffer maximum size const int bufferSize; //!< The buffer maximum size
char * buffer = nullptr;//! The buffer char * buffer = nullptr; //!< The buffer
int bufferPos = 0; //! The current position of the buffer (previous positions are already written) int bufferPos = 0; //!< The current position of the buffer (previous positions are already written)
}; };
/** /**
...@@ -214,37 +214,35 @@ private: ...@@ -214,37 +214,35 @@ private:
void shuffleColors(); void shuffleColors();
private: private:
const char * rootType = "root_ct"; const char * rootType = "root_ct"; //!< The root type output name
const char * machineType = "machine_ct"; const char * machineType = "machine_ct"; //!< The machine type output name
const char * machineState = "machine_state"; const char * machineState = "machine_state"; //!< The machine state output name
const char * schedulerType = "scheduler_ct"; const char * schedulerType = "scheduler_ct"; //!< The scheduler type output name
const char * killerType = "killer_ct"; const char * killerType = "killer_ct"; //!< The killer type output name
const char * killEventKiller = "kk"; const char * killEventKiller = "kk"; //!< The kill event (on the Killer) output name
const char * killEventMachine = "km"; const char * killEventMachine = "km"; //!< The kill event (on machines) output name
const char * utilizationVarType = "vu_vt"; const char * utilizationVarType = "vu_vt"; //!< The utilization variable type output name
const char * mstateWaiting = "w"; const char * mstateWaiting = "w"; //!< The waiting state output name
const char * mstateLaunching = "l"; const char * mstateLaunching = "l"; //!< The launching state output name
//const char * varGlobalUtilization = "vgu"; const char * root = "root"; //!< The Pajé root output name
const char * scheduler = "sc"; //!< The scheduler output name
const char * root = "root"; const char * killer = "k"; //!< The killer output name
const char * scheduler = "sc"; const char * machinePrefix = "m"; //!< The machine output prefix
const char * killer = "k"; const char * jobPrefix = "j"; //!< The job output prefix
const char * machinePrefix = "m"; const char * waitingColor= "\"0.0 0.0 0.0\""; //!< The color used for idle machines
const char * jobPrefix = "j"; const char * launchingColor = "\"0.3 0.3 0.3\""; //!< The color used for machines launching a job
const char * waitingColor= "\"0.0 0.0 0.0\""; const char * utilizationColor = "\"0.0 0.5 0.0\""; //!< The color used for the utilization graph
const char * launchingColor = "\"0.3 0.3 0.3\"";
const char * utilizationColor = "\"0.0 0.5 0.0\""; const bool _logLaunchings; //!< If set to true, job launchings should be outputted (in addition to starting decisions)
const bool _logLaunchings; WriteBuffer * _wbuf = nullptr; //!< The buffer class used to handle the output file
WriteBuffer * _wbuf = nullptr; std::map<int, std::string> _jobs; //!< Maps job numbers to their Pajé representation
std::vector<std::string> _colors; //!< Strings associated with colors, used for the jobs
std::map<int, std::string> _jobs;
std::vector<std::string> _colors; PajeTracerState state = UNINITIALIZED; //!< The state of the PajeTracer
PajeTracerState state = UNINITIALIZED;
}; };
...@@ -279,5 +277,5 @@ public: ...@@ -279,5 +277,5 @@ public:
void add_pstate_change(double time, int machine_id, int pstate_after); void add_pstate_change(double time, int machine_id, int pstate_after);
private: private:
WriteBuffer * _wbuf = nullptr; WriteBuffer * _wbuf = nullptr; //!< The buffer used to handle the output file
}; };
/** /**
* @file ipp.cpp * @file ipp.cpp
* @brief Inter-Process Protocol * @brief Inter-Process Protocol (within Batsim, not with the Decision real process)
*/ */
#include "ipp.hpp" #include "ipp.hpp"
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
using namespace std; using namespace std;
XBT_LOG_NEW_DEFAULT_CATEGORY(ipp, "ipp"); XBT_LOG_NEW_DEFAULT_CATEGORY(ipp, "ipp"); //!< Logging
void send_message(const std::string & destination_mailbox, IPMessageType type, void * data) void send_message(const std::string & destination_mailbox, IPMessageType type, void * data)
{ {
......
/** /**
* @file ipp.hpp * @file ipp.hpp
* @brief Inter-Process Protocol * @brief Inter-Process Protocol (within Batsim, not with the Decision real process)
*/ */
#pragma once #pragma once
...@@ -40,7 +40,7 @@ enum class IPMessageType ...@@ -40,7 +40,7 @@ enum class IPMessageType
*/ */
struct JobSubmittedMessage struct JobSubmittedMessage
{ {
int job_id; //! The job ID int job_id; //!< The job ID
}; };
/** /**
...@@ -48,7 +48,7 @@ struct JobSubmittedMessage ...@@ -48,7 +48,7 @@ struct JobSubmittedMessage
*/ */
struct JobCompletedMessage struct JobCompletedMessage
{ {
int job_id; //! The job ID int job_id; //!< The job ID
}; };
/** /**
...@@ -56,7 +56,7 @@ struct JobCompletedMessage ...@@ -56,7 +56,7 @@ struct JobCompletedMessage
*/ */
struct JobRejectedMessage struct JobRejectedMessage
{ {
int job_id; //! The job ID int job_id; //!< The job ID
}; };
/** /**
...@@ -64,9 +64,9 @@ struct JobRejectedMessage ...@@ -64,9 +64,9 @@ struct JobRejectedMessage
*/ */
struct SchedulingAllocation struct SchedulingAllocation
{ {
int job_id; //! The job unique number int job_id; //!< The job unique number
MachineRange machine_ids; //! The IDs of the machines on which the job should be allocated MachineRange machine_ids; //!< The IDs of the machines on which the job should be allocated
std::vector<msg_host_t> hosts; //! The corresponding SimGrid hosts std::vector<msg_host_t> hosts; //!< The corresponding SimGrid hosts
}; };
/** /**
...@@ -74,7 +74,7 @@ struct SchedulingAllocation ...@@ -74,7 +74,7 @@ struct SchedulingAllocation
*/ */
struct SchedulingAllocationMessage struct SchedulingAllocationMessage
{ {
std::vector<SchedulingAllocation *> allocations; //! Possibly several allocations std::vector<SchedulingAllocation *> allocations; //!< Possibly several allocations
}; };
/** /**
...@@ -82,8 +82,8 @@ struct SchedulingAllocationMessage ...@@ -82,8 +82,8 @@ struct SchedulingAllocationMessage
*/ */
struct PStateModificationMessage struct PStateModificationMessage
{ {
MachineRange machine_ids; //! The IDs of the machines on which the pstate should be changed MachineRange machine_ids; //!< The IDs of the machines on which the pstate should be changed
int new_pstate; //! The power state into which the machines should be put int new_pstate; //!< The power state into which the machines should be put
}; };
/** /**
...@@ -91,7 +91,7 @@ struct PStateModificationMessage ...@@ -91,7 +91,7 @@ struct PStateModificationMessage
*/ */
struct NOPMeLaterMessage struct NOPMeLaterMessage
{ {
double target_time; double target_time; //!< The time at which Batsim should send a NOP message to the decision real process
}; };
/** /**
...@@ -99,8 +99,8 @@ struct NOPMeLaterMessage ...@@ -99,8 +99,8 @@ struct NOPMeLaterMessage
*/ */
struct SwitchONMessage struct SwitchONMessage
{ {
int machine_id; int machine_id; //!< The unique number of the machine which should be switched ON
int new_pstate; int new_pstate; //!< The power state the machine should be put into
}; };
/** /**
...@@ -108,8 +108,8 @@ struct SwitchONMessage ...@@ -108,8 +108,8 @@ struct SwitchONMessage
*/ */
struct SwitchOFFMessage struct SwitchOFFMessage
{ {
int machine_id; int machine_id; //!< The unique number of the machine which should be switched OFF
int new_pstate; int new_pstate; //!< The power state the machine should be put into
}; };
/** /**
...@@ -117,9 +117,13 @@ struct SwitchOFFMessage ...@@ -117,9 +117,13 @@ struct SwitchOFFMessage
*/ */
struct IPMessage struct IPMessage
{ {
/**
* @brief Destroys a IPMessage
* @details This method deletes the message data according to its type
*/
~IPMessage(); ~IPMessage();
IPMessageType type; //! The message type IPMessageType type; //!< The message type
void * data; //! The message data (can be NULL if type is in [SCHED_NOP, SUBMITTER_HELLO, SUBMITTER_BYE, SUBMITTER_READY]). Otherwise, it is either a JobSubmittedMessage*, a JobCompletedMessage* or a SchedulingAllocationMessage* according to type. void * data; //!< The message data (can be NULL if type is in [SCHED_NOP, SUBMITTER_HELLO, SUBMITTER_BYE, SUBMITTER_READY]). Otherwise, it is either a JobSubmittedMessage*, a JobCompletedMessage* or a SchedulingAllocationMessage* according to type.
}; };
/** /**
...@@ -127,8 +131,8 @@ struct IPMessage ...@@ -127,8 +131,8 @@ struct IPMessage
*/ */
struct RequestReplyProcessArguments struct RequestReplyProcessArguments
{ {
BatsimContext * context; BatsimContext * context; //!< The BatsimContext
std::string send_buffer; std::string send_buffer; //!< The message to send to the Decision real process
}; };
/** /**
...@@ -136,7 +140,7 @@ struct RequestReplyProcessArguments ...@@ -136,7 +140,7 @@ struct RequestReplyProcessArguments
*/ */
struct ServerProcessArguments struct ServerProcessArguments
{ {
BatsimContext * context; BatsimContext * context; //!< The BatsimContext
}; };
/** /**
...@@ -144,8 +148,8 @@ struct ServerProcessArguments ...@@ -144,8 +148,8 @@ struct ServerProcessArguments
*/ */
struct ExecuteJobProcessArguments struct ExecuteJobProcessArguments
{ {
BatsimContext * context; BatsimContext * context; //!< The BatsimContext
SchedulingAllocation * allocation; SchedulingAllocation * allocation; //!< The SchedulingAllocation
}; };
/** /**
...@@ -153,8 +157,8 @@ struct ExecuteJobProcessArguments ...@@ -153,8 +157,8 @@ struct ExecuteJobProcessArguments
*/ */
struct KillerProcessArguments struct KillerProcessArguments
{ {
msg_task_t task; //! The task that will be cancelled if the walltime is reached msg_task_t task; //!< The task that will be cancelled if the walltime is reached
double walltime; //! The number of seconds to wait before cancelling the task double walltime; //!< The number of seconds to wait before cancelling the task
}; };
/** /**
...@@ -162,9 +166,9 @@ struct KillerProcessArguments ...@@ -162,9 +166,9 @@ struct KillerProcessArguments
*/ */
struct SwitchPStateProcessArguments struct SwitchPStateProcessArguments
{ {
BatsimContext * context; BatsimContext * context; //!< The BatsimContext
int machine_id; int machine_id; //!< The unique number of the machine whose power state should be switched
int new_pstate; int new_pstate; //!< The power state into which the machine should be put
}; };
/** /**
...@@ -172,7 +176,7 @@ struct SwitchPStateProcessArguments ...@@ -172,7 +176,7 @@ struct SwitchPStateProcessArguments
*/ */
struct JobSubmitterProcessArguments struct JobSubmitterProcessArguments
{ {
BatsimContext * context; BatsimContext * context; //!< The BatsimContext
}; };
/** /**
...@@ -180,7 +184,7 @@ struct JobSubmitterProcessArguments ...@@ -180,7 +184,7 @@ struct JobSubmitterProcessArguments
*/ */
struct WaiterProcessArguments struct WaiterProcessArguments
{ {
double target_time; double target_time; //!< The time at which the waiter should stop waiting
}; };
/** /**
......
/** /**
* @file job_submitter.hpp * @file job_submitter.cpp
* @brief Job submitter * @brief Contains functions related to job submission
*/ */
#include "job_submitter.hpp" #include "job_submitter.hpp"
......
/** /**
* @file job_submitter.hpp * @file job_submitter.hpp
* @brief Job submitter * @brief Contains functions related to job submission
*/ */
#pragma once #pragma once
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
using namespace std; using namespace std;
using namespace rapidjson; using namespace rapidjson;
XBT_LOG_NEW_DEFAULT_CATEGORY(jobs, "jobs"); XBT_LOG_NEW_DEFAULT_CATEGORY(jobs, "jobs"); //!< Logging
Jobs::Jobs() Jobs::Jobs()
{ {
......
...@@ -32,18 +32,18 @@ enum class JobState ...@@ -32,18 +32,18 @@ enum class JobState
*/ */
struct Job struct Job