/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include "simdag_private.hpp"
#include "src/surf/HostImpl.hpp"
#include "src/surf/surf_interface.hpp"
-#include "src/simdag/simdag_private.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_task, sd, "Logging specific to SimDag (task)");
/** @brief create a complex data redistribution task that can then be auto-scheduled
*
- * Auto-scheduling mean that the task can be used with SD_task_schedulev().
+ * Auto-scheduling mean that the task can be used with SD_task_schedulev().
* This allows to specify the task costs at creation, and decouple them from the scheduling process where you just
* specify which resource should communicate.
*
XBT_DEBUG("Destroying task %s...", SD_task_get_name(task));
/* First Remove all dependencies associated with the task. */
- while (!task->predecessors->empty())
+ while (not task->predecessors->empty())
SD_task_dependency_remove(*(task->predecessors->begin()), task);
- while (!task->inputs->empty())
+ while (not task->inputs->empty())
SD_task_dependency_remove(*(task->inputs->begin()), task);
- while (!task->successors->empty())
+ while (not task->successors->empty())
SD_task_dependency_remove(task, *(task->successors->begin()));
- while (!task->outputs->empty())
- SD_task_dependency_remove(task, *(task->outputs->begin()));
+ while (not task->outputs->empty())
+ SD_task_dependency_remove(task, *(task->outputs->begin()));
if (task->state == SD_SCHEDULED || task->state == SD_RUNNABLE)
__SD_task_destroy_scheduling_data(task);
task->start_time = task->surf_action->getStartTime();
if (new_state == SD_DONE){
task->finish_time = task->surf_action->getFinishTime();
-#if HAVE_JEDULE
+#if SIMGRID_HAVE_JEDULE
jedule_log_sd_event(task);
#endif
} else
{
xbt_dynar_t parents = xbt_dynar_new(sizeof(SD_task_t), nullptr);
- for (auto it : *task->predecessors)
+ for (auto const& it : *task->predecessors)
xbt_dynar_push(parents, &it);
- for (auto it : *task->inputs)
+ for (auto const& it : *task->inputs)
xbt_dynar_push(parents, &it);
return parents;
{
xbt_dynar_t children = xbt_dynar_new(sizeof(SD_task_t), nullptr);
- for (auto it : *task->successors)
+ for (auto const& it : *task->successors)
xbt_dynar_push(children, &it);
- for (auto it : *task->outputs)
+ for (auto const& it : *task->outputs)
xbt_dynar_push(children, &it);
return children;
*/
sg_host_t *SD_task_get_workstation_list(SD_task_t task)
{
- return &(*(task->allocation))[0];
+ return task->allocation->data();
}
/**
XBT_INFO(" - Dependencies to satisfy: %zu", task->inputs->size()+ task->predecessors->size());
if ((task->inputs->size()+ task->predecessors->size()) > 0) {
XBT_INFO(" - pre-dependencies:");
- for (auto it : *task->predecessors)
+ for (auto const& it : *task->predecessors)
XBT_INFO(" %s", it->name);
- for (auto it: *task->inputs)
+ for (auto const& it : *task->inputs)
XBT_INFO(" %s", it->name);
}
if ((task->outputs->size() + task->successors->size()) > 0) {
XBT_INFO(" - post-dependencies:");
- for (auto it : *task->successors)
+ for (auto const& it : *task->successors)
XBT_INFO(" %s", it->name);
- for (auto it : *task->outputs)
+ for (auto const& it : *task->outputs)
XBT_INFO(" %s", it->name);
}
}
xbt_die("Unknown task type!");
}
fprintf(fout, "];\n");
- for (auto it : *task->predecessors)
+ for (auto const& it : *task->predecessors)
fprintf(fout, " T%p -> T%p;\n", it, task);
- for (auto it : *task->inputs)
+ for (auto const& it : *task->inputs)
fprintf(fout, " T%p -> T%p;\n", it, task);
}
for (int i = 0; i < host_count; i++) {
double time = 0.0;
if (flops_amount != nullptr)
- time = flops_amount[i] / host_list[i]->speed();
+ time = flops_amount[i] / host_list[i]->getSpeed();
if (bytes_amount != nullptr)
for (int j = 0; j < host_count; j++)
if (bytes_amount[i * host_count + j] != 0)
- time += (SD_route_get_latency(host_list[i], host_list[j]) +
- bytes_amount[i * host_count + j] / SD_route_get_bandwidth(host_list[i], host_list[j]));
+ time += (sg_host_route_latency(host_list[i], host_list[j]) +
+ bytes_amount[i * host_count + j] / sg_host_route_bandwidth(host_list[i], host_list[j]));
if (time > max_time)
max_time = time;
*
* \param task the task you want to schedule
* \param host_count number of hosts on which the task will be executed
- * \param workstation_list the hosts on which the task will be executed
+ * \param host_list the hosts on which the task will be executed
* \param flops_amount computation amount for each hosts (i.e., an array of host_count doubles)
* \param bytes_amount communication amount between each pair of hosts (i.e., a matrix of host_count*host_count doubles)
* \param rate task execution speed rate
int host_nb = task->allocation->size();
sg_host_t *hosts = xbt_new(sg_host_t, host_nb);
int i =0;
- for (auto host: *task->allocation)
- hosts[i++] = host;
+ for (auto const& host : *task->allocation) {
+ hosts[i] = host;
+ i++;
+ }
double *flops_amount = xbt_new0(double, host_nb);
double *bytes_amount = xbt_new0(double, host_nb * host_nb);
__SD_task_destroy_scheduling_data(task); /* now the scheduling data are not useful anymore */
SD_task_set_state(task, SD_RUNNING);
- xbt_dynar_push(sd_global->return_set, &task);
+ sd_global->return_set->insert(task);
}
/**
XBT_VERB("Schedule computation task %s on %zu host(s)", task->name, task->allocation->size());
if (task->kind == SD_TASK_COMP_SEQ) {
- if (!task->flops_amount){ /*This task has failed and is rescheduled. Reset the flops_amount*/
+ if (not task->flops_amount) { /*This task has failed and is rescheduled. Reset the flops_amount*/
task->flops_amount = xbt_new0(double, 1);
task->flops_amount[0] = task->amount;
}
SD_task_do_schedule(task);
/* Iterate over all inputs and outputs to say where I am located (and start them if runnable) */
- for (auto input : *task->inputs){
+ for (auto const& input : *task->inputs) {
int src_nb = input->allocation->size();
int dst_nb = count;
if (input->allocation->empty())
}
}
- for (auto output : *task->outputs){
+ for (auto const& output : *task->outputs) {
int src_nb = count;
int dst_nb = output->allocation->size();
if (output->allocation->empty())