xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool schedule);
static void dot_task_p_free(void *task) {
- SD_task_destroy(*(SD_task_t *)task);
+ (*(SD_task_t*)task)->destroy();
}
/** @brief loads a DOT file describing a DAG
if (jobs.find(name) == jobs.end()) {
if (sequential) {
XBT_DEBUG("See <job id=%s amount =%.0f>", name, amount);
- task = SD_task_create_comp_seq(name, nullptr , amount);
+ task = simgrid::sd::Task::create_comp_seq(name, amount, nullptr);
} else {
double alpha = atof(agget(node, (char *) "alpha"));
XBT_DEBUG("See <job id=%s amount =%.0f alpha = %.3f>", name, amount, alpha);
- task = SD_task_create_comp_par_amdahl(name, nullptr , amount, alpha);
+ task = simgrid::sd::Task::create_comp_par_amdahl(name, amount, nullptr, alpha);
}
jobs.insert({std::string(name), task});
if ((performer != -1 && order != -1) && performer < static_cast<int>(sg_host_count())) {
/* required parameters are given and less performers than hosts are required */
- XBT_DEBUG ("Task '%s' is scheduled on workstation '%d' in position '%d'", task->name, performer, order);
+ XBT_DEBUG("Task '%s' is scheduled on workstation '%d' in position '%d'", task->get_cname(), performer, order);
auto comp = computers.find(char_performer);
if (comp != computers.end()) {
computer = comp->second;
computers.insert({char_performer, computer});
}
if (static_cast<unsigned int>(order) < computer->size()) {
- const s_SD_task_t* task_test = computer->at(order);
+ const_SD_task_t task_test = computer->at(order);
if (task_test && task_test != task) {
/* the user gave the same order to several tasks */
schedule_success = false;
XBT_VERB("Task '%s' wants to start on performer '%s' at the same position '%s' as task '%s'",
- task_test->name, char_performer, char_order, task->name);
+ task_test->get_cname(), char_performer, char_order, task->get_cname());
continue;
}
} else
} else {
/* one of required parameters is not given */
schedule_success = false;
- XBT_VERB("The schedule is ignored, task '%s' can not be scheduled on %d hosts", task->name, performer);
+ XBT_VERB("The schedule is ignored, task '%s' can not be scheduled on %d hosts", task->get_cname(), performer);
}
}
} else {
/*Check if 'root' and 'end' nodes have been explicitly declared. If not, create them. */
if (jobs.find("root") == jobs.end())
- root = (sequential ? SD_task_create_comp_seq("root", nullptr, 0)
- : SD_task_create_comp_par_amdahl("root", nullptr, 0, 0));
+ root = (sequential ? simgrid::sd::Task::create_comp_seq("root", 0, nullptr)
+ : simgrid::sd::Task::create_comp_par_amdahl("root", 0, nullptr, 0));
else
root = jobs.at("root");
- SD_task_set_state(root, SD_SCHEDULABLE); /* by design the root task is always SCHEDULABLE */
+ root->set_state(SD_SCHEDULABLE); /* by design the root task is always SCHEDULABLE */
xbt_dynar_insert_at(result, 0, &root); /* Put it at the beginning of the dynar */
if (jobs.find("end") == jobs.end())
- end = (sequential ? SD_task_create_comp_seq("end", nullptr, 0)
- : SD_task_create_comp_par_amdahl("end", nullptr, 0, 0));
+ end = (sequential ? simgrid::sd::Task::create_comp_seq("end", 0, nullptr)
+ : simgrid::sd::Task::create_comp_par_amdahl("end", 0, nullptr, 0));
else
end = jobs.at("end");
XBT_DEBUG("See <transfer id=%s amount = %.0f>", name.c_str(), size);
if (jobs.find(name) == jobs.end()) {
if (sequential)
- task = SD_task_create_comm_e2e(name.c_str(), nullptr, size);
+ task = simgrid::sd::Task::create_comm_e2e(name.c_str(), size, nullptr);
else
- task = SD_task_create_comm_par_mxn_1d_block(name.c_str(), nullptr, size);
+ task = simgrid::sd::Task::create_comm_par_mxn_1d_block(name.c_str(), size, nullptr);
SD_task_dependency_add(src, task);
SD_task_dependency_add(task, dst);
jobs.insert({name, task});
}
}
- XBT_DEBUG("All tasks have been created, put %s at the end of the dynar", end->name);
+ XBT_DEBUG("All tasks have been created, put %s at the end of the dynar", end->get_cname());
xbt_dynar_push(result, &end);
/* Connect entry tasks to 'root', and exit tasks to 'end'*/
unsigned i;
xbt_dynar_foreach (result, i, task){
- if (task->predecessors->empty() && task->inputs->empty() && task != root) {
- XBT_DEBUG("Task '%s' has no source. Add dependency from 'root'", task->name);
+ if (task->has_unsolved_dependencies() == 0 && task != root) {
+ XBT_DEBUG("Task '%s' has no source. Add dependency from 'root'", task->get_cname());
SD_task_dependency_add(root, task);
}
- if (task->successors->empty() && task->outputs->empty() && task != end) {
- XBT_DEBUG("Task '%s' has no destination. Add dependency to 'end'", task->name);
+ if (task->is_waited_by() == 0 && task != end) {
+ XBT_DEBUG("Task '%s' has no destination. Add dependency to 'end'", task->get_cname());
SD_task_dependency_add(task, end);
}
}
if (previous_task && not SD_task_dependency_exists(previous_task, cur_task))
SD_task_dependency_add(previous_task, cur_task);
- SD_task_schedulel(cur_task, 1, hosts[std::stoi(elm.first)]);
+ cur_task->schedulev({hosts[std::stoi(elm.first)]});
previous_task = cur_task;
}
}