Commit aa7740fd authored by Millian Poquet's avatar Millian Poquet

[code] fix doxygen comments + cleanup

parent 3372ca7d
...@@ -348,6 +348,13 @@ int execute_task_cleanup(void * unknown, void * data) ...@@ -348,6 +348,13 @@ int execute_task_cleanup(void * unknown, void * data)
return 0; return 0;
} }
/**
* @brief Initializes logging structures associated with a task (job execution)
* @param[in] job The job that is about to be executed
* @param[in] profile The profile that is about to be executed
* @param[in] io_profile The IO profile that may also be executed
* @return The BatTask* associated with the sequential task
*/
BatTask * initialize_sequential_tasks(Job * job, Profile * profile, Profile * io_profile) BatTask * initialize_sequential_tasks(Job * job, Profile * profile, Profile * io_profile)
{ {
BatTask * task = new BatTask(job, profile); BatTask * task = new BatTask(job, profile);
......
...@@ -189,7 +189,7 @@ public: ...@@ -189,7 +189,7 @@ public:
* @param[in] other The other MachineRange * @param[in] other The other MachineRange
* @return The current MachineRange after the intersection. * @return The current MachineRange after the intersection.
*/ */
MachineRange & operator&=(const MachineRange & other); MachineRange & operator &=(const MachineRange & other);
/** /**
* @brief In-place set difference operation. * @brief In-place set difference operation.
......
...@@ -47,7 +47,7 @@ Machines::~Machines() ...@@ -47,7 +47,7 @@ Machines::~Machines()
void Machines::create_machines(xbt_dynar_t hosts, void Machines::create_machines(xbt_dynar_t hosts,
const BatsimContext *context, const BatsimContext *context,
map<string, string> role_map, const std::map<string, string> & role_map,
int limit_machine_count) int limit_machine_count)
{ {
xbt_assert(_machines.size() == 0, "Bad call to Machines::createMachines(): machines already created"); xbt_assert(_machines.size() == 0, "Bad call to Machines::createMachines(): machines already created");
...@@ -81,11 +81,11 @@ void Machines::create_machines(xbt_dynar_t hosts, ...@@ -81,11 +81,11 @@ void Machines::create_machines(xbt_dynar_t hosts,
if (machine->properties.count("role")) if (machine->properties.count("role"))
{ {
// there is an existing role property // there is an existing role property
machine->properties["role"] = machine->properties["role"] + "," + role_map[machine->name]; machine->properties["role"] = machine->properties["role"] + "," + role_map.at(machine->name);
} }
else else
{ {
machine->properties["role"] = role_map[machine->name]; machine->properties["role"] = role_map.at(machine->name);
} }
} }
......
...@@ -69,7 +69,9 @@ struct Machine ...@@ -69,7 +69,9 @@ struct Machine
std::map<std::string, std::string> properties; //!< Properties defined in the platform file std::map<std::string, std::string> properties; //!< Properties defined in the platform file
/** /**
* @brief Returns wether the Machine has the given role * @brief Returns whether the Machine has the given role
* @param[in] role The role whose presence is to be checked
* @return Whether the Machine has the given role
*/ */
bool has_role(roles::Permissions role); bool has_role(roles::Permissions role);
...@@ -142,11 +144,12 @@ public: ...@@ -142,11 +144,12 @@ public:
* @brief Fill the Machines with SimGrid hosts * @brief Fill the Machines with SimGrid hosts
* @param[in] hosts The SimGrid hosts * @param[in] hosts The SimGrid hosts
* @param[in] context The Batsim Context * @param[in] context The Batsim Context
* @param[in] roles The roles of each machine
* @param[in] limit_machine_count If set to -1, all the machines are used. If set to a strictly positive number N, only the first machines N will be used to compute jobs * @param[in] limit_machine_count If set to -1, all the machines are used. If set to a strictly positive number N, only the first machines N will be used to compute jobs
*/ */
void create_machines(xbt_dynar_t hosts, void create_machines(xbt_dynar_t hosts,
const BatsimContext * context, const BatsimContext * context,
std::map<std::string, std::string> roles, const std::map<std::string, std::string> & roles,
int limit_machine_count = -1); int limit_machine_count = -1);
/** /**
...@@ -211,11 +214,13 @@ public: ...@@ -211,11 +214,13 @@ public:
/** /**
* @brief Returns a const reference to the vector of computing Machine * @brief Returns a const reference to the vector of computing Machine
* @return A const reference to the vector of computing Machine
*/ */
const std::vector<Machine *> & compute_machines() const; const std::vector<Machine *> & compute_machines() const;
/** /**
* @brief Returns a const reference to the vector of storage Machine * @brief Returns a const reference to the vector of storage Machine
* @return A const reference to the vector of storage Machine
*/ */
const std::vector<Machine *> & storage_machines() const; const std::vector<Machine *> & storage_machines() const;
...@@ -241,16 +246,19 @@ public: ...@@ -241,16 +246,19 @@ public:
/** /**
* @brief Returns the total number of machines * @brief Returns the total number of machines
* @return The total number of machines
*/ */
int nb_machines() const; int nb_machines() const;
/** /**
* @brief Returns the number of computing machines * @brief Returns the number of computing machines
* @return The nubmer of computing machines
*/ */
int nb_compute_machines() const; int nb_compute_machines() const;
/** /**
* @brief Returns the number of storage machines * @brief Returns the number of storage machines
* @return The number of storage machines
*/ */
int nb_storage_machines() const; int nb_storage_machines() const;
...@@ -303,7 +311,8 @@ long double consumed_energy_on_machines(BatsimContext * context, ...@@ -303,7 +311,8 @@ long double consumed_energy_on_machines(BatsimContext * context,
/** /**
* @brief Sorts the given vector of machines by ascending name (lexicographically speaking) * @brief Sorts the given vector of machines by ascending name (lexicographically speaking)
* @param[in,out] machines_vect The vector of machines to sort
*/ */
void sort_machines_by_ascending_name(std::vector<Machine *>); void sort_machines_by_ascending_name(std::vector<Machine *> machines_vect);
...@@ -302,7 +302,15 @@ void generate_msg_data_staginig_task(double *& computation_amount, ...@@ -302,7 +302,15 @@ void generate_msg_data_staginig_task(double *& computation_amount,
} }
} }
void print_matrices(double * computation_vector, double * communication_matrix, unsigned int nb_res) /**
* @brief Debug print of a parallel task (via XBT_DEBUG)
* @param[in] computation_vector The ptask computation vector
* @param[in] communication_matrix The ptask communication matrix
* @param[in] nb_res The number of hosts involved in the parallel task
*/
void debug_print_ptask(const double * computation_vector,
const double * communication_matrix,
unsigned int nb_res)
{ {
string comp = ""; string comp = "";
string comm = ""; string comm = "";
...@@ -326,16 +334,15 @@ void print_matrices(double * computation_vector, double * communication_matrix, ...@@ -326,16 +334,15 @@ void print_matrices(double * computation_vector, double * communication_matrix,
XBT_DEBUG("Generated matrices: \nCompute: \n%s\nComm:\n%s", comp.c_str(), comm.c_str()); XBT_DEBUG("Generated matrices: \nCompute: \n%s\nComm:\n%s", comp.c_str(), comm.c_str());
} }
/** /**
* } * @brief
* @brief Generate communication and computation matrix depending on the profile * @param[out] computation_vector The computation vector to be simulated by the msg task
* * @param[out] communication_matrix The communication matrix to be simulated by the msg task
* @param[out] computation_amount the computation matrix to be simulated by the msg task * @param[in,out] hosts_to_use The list of host to be used by the task
* @param[out] communication_amount the communication matrix to be simulated by the msg task * @param[in] profile The profile to be converted to a compute/comm matrix
* @param[in,out] hosts_to_use the list of host to be used by the task * @param[in] storage_mapping The storage mapping
* @param[in] the profile to be converted to compute/comm matrix * @param[in] context The BatsimContext
* @param[in] context the batsim context
*/ */
void generate_matices_from_profile(double *& computation_matrix, void generate_matices_from_profile(double *& computation_vector,
double *& communication_matrix, double *& communication_matrix,
std::vector<msg_host_t> & hosts_to_use, std::vector<msg_host_t> & hosts_to_use,
Profile * profile, Profile * profile,
...@@ -350,25 +357,25 @@ void generate_matices_from_profile(double *& computation_matrix, ...@@ -350,25 +357,25 @@ void generate_matices_from_profile(double *& computation_matrix,
switch(profile->type) switch(profile->type)
{ {
case ProfileType::MSG_PARALLEL: case ProfileType::MSG_PARALLEL:
generate_msg_parallel_task(computation_matrix, generate_msg_parallel_task(computation_vector,
communication_matrix, communication_matrix,
nb_res, nb_res,
profile->data); profile->data);
break; break;
case ProfileType::MSG_PARALLEL_HOMOGENEOUS: case ProfileType::MSG_PARALLEL_HOMOGENEOUS:
generate_msg_parallel_homogeneous(computation_matrix, generate_msg_parallel_homogeneous(computation_vector,
communication_matrix, communication_matrix,
nb_res, nb_res,
profile->data); profile->data);
break; break;
case ProfileType::MSG_PARALLEL_HOMOGENEOUS_TOTAL_AMOUNT: case ProfileType::MSG_PARALLEL_HOMOGENEOUS_TOTAL_AMOUNT:
generate_msg_parallel_homogeneous_total_amount(computation_matrix, generate_msg_parallel_homogeneous_total_amount(computation_vector,
communication_matrix, communication_matrix,
nb_res, nb_res,
profile->data); profile->data);
break; break;
case ProfileType::MSG_PARALLEL_HOMOGENEOUS_PFS: case ProfileType::MSG_PARALLEL_HOMOGENEOUS_PFS:
generate_msg_parallel_homogeneous_with_pfs(computation_matrix, generate_msg_parallel_homogeneous_with_pfs(computation_vector,
communication_matrix, communication_matrix,
hosts_to_use, hosts_to_use,
*storage_mapping, *storage_mapping,
...@@ -376,7 +383,7 @@ void generate_matices_from_profile(double *& computation_matrix, ...@@ -376,7 +383,7 @@ void generate_matices_from_profile(double *& computation_matrix,
context); context);
break; break;
case ProfileType::MSG_DATA_STAGING: case ProfileType::MSG_DATA_STAGING:
generate_msg_data_staginig_task(computation_matrix, generate_msg_data_staginig_task(computation_vector,
communication_matrix, communication_matrix,
hosts_to_use, hosts_to_use,
*storage_mapping, *storage_mapping,
...@@ -386,16 +393,24 @@ void generate_matices_from_profile(double *& computation_matrix, ...@@ -386,16 +393,24 @@ void generate_matices_from_profile(double *& computation_matrix,
default: default:
xbt_die("Should not be reached."); xbt_die("Should not be reached.");
} }
print_matrices(computation_matrix, communication_matrix, hosts_to_use.size()); debug_print_ptask(computation_vector, communication_matrix, hosts_to_use.size());
} }
void enforce_role_permission(MachineRange alloc, /**
double * computation_matrix, * @brief Checks if the machines allocated to a ptask can execute it
* @param[in] alloc The machines on which the ptask should run
* @param[in] computation_matrix The ptask communication matrix
* @param[in] context The BatsimContext
*/
void check_ptask_execution_permission(const MachineRange & alloc,
const double * computation_matrix,
BatsimContext * context) BatsimContext * context)
{ {
// TODO: simplify the roles because it is very simple in the end // TODO: simplify the roles because it is very simple in the end
// Enforce role permission // Enforce role permission
// TODO: handle mapping (ptasks can be executed with non-unique hosts)
for (unsigned int i = 0; i < alloc.size(); i++) for (unsigned int i = 0; i < alloc.size(); i++)
{ {
int machine_id = alloc[i]; int machine_id = alloc[i];
...@@ -435,7 +450,7 @@ int execute_msg_task(BatTask * btask, ...@@ -435,7 +450,7 @@ int execute_msg_task(BatTask * btask,
& allocation->storage_mapping, & allocation->storage_mapping,
context); context);
enforce_role_permission(allocation->machine_ids, computation_vector, context); check_ptask_execution_permission(allocation->machine_ids, computation_vector, context);
//FIXME: This will not work for the PFS profiles //FIXME: This will not work for the PFS profiles
// Manage additional io job // Manage additional io job
...@@ -578,9 +593,9 @@ int execute_msg_task(BatTask * btask, ...@@ -578,9 +593,9 @@ int execute_msg_task(BatTask * btask,
hosts_to_use = new_hosts_to_use; hosts_to_use = new_hosts_to_use;
// TODO Free old job and io structures // TODO Free old job and io structures
XBT_DEBUG("Merged Job+IO matrices"); XBT_DEBUG("Merged Job+IO matrices");
print_matrices(computation_vector, communication_matrix, hosts_to_use.size()); debug_print_ptask(computation_vector, communication_matrix, hosts_to_use.size());
enforce_role_permission(new_alloc, computation_vector, context); check_ptask_execution_permission(new_alloc, computation_vector, context);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment