A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cleaning a bit
[simgrid.git]
/
src
/
simdag
/
sd_daxloader.cpp
diff --git
a/src/simdag/sd_daxloader.cpp
b/src/simdag/sd_daxloader.cpp
index
df81674
..
31f7e79
100644
(file)
--- a/
src/simdag/sd_daxloader.cpp
+++ b/
src/simdag/sd_daxloader.cpp
@@
-36,21
+36,21
@@
void uniq_transfer_task_name(SD_task_t task)
}
static bool children_are_marked(SD_task_t task){
}
static bool children_are_marked(SD_task_t task){
- for (
std::set<SD_task_t>::iterator it=task->successors->begin(); it!=task->successors->end(); ++it
)
- if (
(*it)
->marked == 0)
+ for (
SD_task_t it : *task->successors
)
+ if (
it
->marked == 0)
return false;
return false;
- for (
std::set<SD_task_t>::iterator it=task->outputs->begin(); it!=task->outputs->end(); ++it
)
- if (
(*it)
->marked == 0)
+ for (
SD_task_t it : *task->outputs
)
+ if (
it
->marked == 0)
return false;
return true;
}
static bool parents_are_marked(SD_task_t task){
return false;
return true;
}
static bool parents_are_marked(SD_task_t task){
- for (
std::set<SD_task_t>::iterator it=task->predecessors->begin(); it!=task->predecessors->end(); ++it
)
- if (
(*it)
->marked == 0)
+ for (
SD_task_t it : *task->predecessors
)
+ if (
it
->marked == 0)
return false;
return false;
- for (
std::set<SD_task_t>::iterator it=task->inputs->begin(); it!=task->inputs->end(); ++it
)
- if (
(*it)
->marked == 0)
+ for (
SD_task_t it : *task->inputs
)
+ if (
it
->marked == 0)
return false;
return true;
}
return false;
return true;
}
@@
-62,7
+62,8
@@
bool acyclic_graph_detail(xbt_dynar_t dag){
xbt_dynar_t next = nullptr, current = xbt_dynar_new(sizeof(SD_task_t),nullptr);
xbt_dynar_foreach(dag,count,task){
xbt_dynar_t next = nullptr, current = xbt_dynar_new(sizeof(SD_task_t),nullptr);
xbt_dynar_foreach(dag,count,task){
- if(task->kind == SD_TASK_COMM_E2E) continue;
+ if(task->kind == SD_TASK_COMM_E2E)
+ continue;
task->marked = 0;
if(task->successors->empty() && task->outputs->empty())
xbt_dynar_push(current, &task);
task->marked = 0;
if(task->successors->empty() && task->outputs->empty())
xbt_dynar_push(current, &task);
@@
-76,16
+77,16
@@
bool acyclic_graph_detail(xbt_dynar_t dag){
continue;
//push task in next
task->marked = 1;
continue;
//push task in next
task->marked = 1;
- for (
std::set<SD_task_t>::iterator it=task->inputs->begin(); it!=task->inputs->end(); ++it
){
-
(*it)
->marked = 1;
+ for (
SD_task_t it : *task->inputs
){
+
it
->marked = 1;
// Inputs are communication, hence they can have only one predecessor
// Inputs are communication, hence they can have only one predecessor
- SD_task_t input_pred = *(
(*it)
->predecessors->begin());
+ SD_task_t input_pred = *(
it
->predecessors->begin());
if (children_are_marked(input_pred))
xbt_dynar_push(next, &input_pred);
}
if (children_are_marked(input_pred))
xbt_dynar_push(next, &input_pred);
}
- for (
std::set<SD_task_t>::iterator it=task->predecessors->begin(); it!=task->predecessors->end(); ++it)
{
- if (children_are_marked(
*
it))
- xbt_dynar_push(next, &
(*it)
);
+ for (
SD_task_t it : *task->predecessors)
{
+ if (children_are_marked(it))
+ xbt_dynar_push(next, &
it
);
}
}
xbt_dynar_free(¤t);
}
}
xbt_dynar_free(¤t);
@@
-133,16
+134,16
@@
bool acyclic_graph_detail(xbt_dynar_t dag){
continue;
//push task in next
task->marked = 1;
continue;
//push task in next
task->marked = 1;
- for (
std::set<SD_task_t>::iterator it=task->outputs->begin(); it!=task->outputs->end(); ++it)
{
-
(*it)
->marked = 1;
+ for (
SD_task_t it : *task->outputs)
{
+
it
->marked = 1;
// outputs are communication, hence they can have only one successor
// outputs are communication, hence they can have only one successor
- SD_task_t output_succ = *(
(*it)
->successors->begin());
+ SD_task_t output_succ = *(
it
->successors->begin());
if (parents_are_marked(output_succ))
xbt_dynar_push(next, &output_succ);
}
if (parents_are_marked(output_succ))
xbt_dynar_push(next, &output_succ);
}
- for (
std::set<SD_task_t>::iterator it=task->predecessors->begin(); it!=task->predecessors->end(); ++it)
{
- if (parents_are_marked(
*
it))
- xbt_dynar_push(next, &
(*it)
);
+ for (
SD_task_t it : *task->predecessors)
{
+ if (parents_are_marked(it))
+ xbt_dynar_push(next, &
it
);
}
xbt_dynar_free(¤t);
current = next;
}
xbt_dynar_free(¤t);
current = next;
@@
-170,7
+171,8
@@
static xbt_dynar_t result;
static xbt_dict_t jobs;
static xbt_dict_t files;
static SD_task_t current_job;
static xbt_dict_t jobs;
static xbt_dict_t files;
static SD_task_t current_job;
-static SD_task_t root_task, end_task;
+static SD_task_t root_task;
+static SD_task_t end_task;
static void dax_task_free(void *task)
{
static void dax_task_free(void *task)
{
@@
-219,29
+221,29
@@
xbt_dynar_t SD_daxload(const char *filename)
xbt_dict_foreach(files, cursor, name, file) {
SD_task_t newfile;
if (file->predecessors->empty()) {
xbt_dict_foreach(files, cursor, name, file) {
SD_task_t newfile;
if (file->predecessors->empty()) {
- for (
std::set<SD_task_t>::iterator it=file->successors->begin(); it!=file->successors->end(); ++it)
{
+ for (
SD_task_t it : *file->successors)
{
newfile = SD_task_create_comm_e2e(file->name, nullptr, file->amount);
SD_task_dependency_add(nullptr, nullptr, root_task, newfile);
newfile = SD_task_create_comm_e2e(file->name, nullptr, file->amount);
SD_task_dependency_add(nullptr, nullptr, root_task, newfile);
- SD_task_dependency_add(nullptr, nullptr, newfile,
(*it)
);
+ SD_task_dependency_add(nullptr, nullptr, newfile,
it
);
xbt_dynar_push(result, &newfile);
}
} else if (file->successors->empty()) {
xbt_dynar_push(result, &newfile);
}
} else if (file->successors->empty()) {
- for (
std::set<SD_task_t>::iterator it=file->predecessors->begin(); it!=file->predecessors->end(); ++it
){
+ for (
SD_task_t it : *file->predecessors
){
newfile = SD_task_create_comm_e2e(file->name, nullptr, file->amount);
newfile = SD_task_create_comm_e2e(file->name, nullptr, file->amount);
- SD_task_dependency_add(nullptr, nullptr,
(*it)
, newfile);
+ SD_task_dependency_add(nullptr, nullptr,
it
, newfile);
SD_task_dependency_add(nullptr, nullptr, newfile, end_task);
xbt_dynar_push(result, &newfile);
}
} else {
SD_task_dependency_add(nullptr, nullptr, newfile, end_task);
xbt_dynar_push(result, &newfile);
}
} else {
- for (
std::set<SD_task_t>::iterator it=file->predecessors->begin(); it!=file->predecessors->end(); ++it)
{
- for (
std::set<SD_task_t>::iterator it2=file->successors->begin(); it2!=file->successors->end(); ++it2)
{
- if (
*it == *
it2) {
+ for (
SD_task_t it : *file->predecessors)
{
+ for (
SD_task_t it2 : *file->successors)
{
+ if (
it ==
it2) {
XBT_WARN ("File %s is produced and consumed by task %s."
XBT_WARN ("File %s is produced and consumed by task %s."
- "This loop dependency will prevent the execution of the task.", file->name,
(*it)
->name);
+ "This loop dependency will prevent the execution of the task.", file->name,
it
->name);
}
newfile = SD_task_create_comm_e2e(file->name, nullptr, file->amount);
}
newfile = SD_task_create_comm_e2e(file->name, nullptr, file->amount);
- SD_task_dependency_add(nullptr, nullptr,
(*it)
, newfile);
- SD_task_dependency_add(nullptr, nullptr, newfile,
(*it2)
);
+ SD_task_dependency_add(nullptr, nullptr,
it
, newfile);
+ SD_task_dependency_add(nullptr, nullptr, newfile,
it2
);
xbt_dynar_push(result, &newfile);
}
}
xbt_dynar_push(result, &newfile);
}
}
@@
-303,7
+305,7
@@
void STag_dax__job()
xbt_dynar_push(result, ¤t_job);
}
xbt_dynar_push(result, ¤t_job);
}
-void STag_dax__uses(
void
)
+void STag_dax__uses()
{
double size = xbt_str_parse_double(A_dax__uses_size, "Parse error: %s is not a double");
int is_input = (A_dax__uses_link == A_dax__uses_link_input);
{
double size = xbt_str_parse_double(A_dax__uses_size, "Parse error: %s is not a double");
int is_input = (A_dax__uses_link == A_dax__uses_link_input);
@@
-315,7
+317,7
@@
void STag_dax__uses(void)
sd_global->initial_tasks->erase(file);
xbt_dict_set(files, A_dax__uses_file, file, nullptr);
} else {
sd_global->initial_tasks->erase(file);
xbt_dict_set(files, A_dax__uses_file, file, nullptr);
} else {
- if (
SD_task_get_amount(file) !=
size) {
+ if (
file->amount < size || file->amount >
size) {
XBT_WARN("Ignore file %s size redefinition from %.0f to %.0f", A_dax__uses_file, SD_task_get_amount(file), size);
}
}
XBT_WARN("Ignore file %s size redefinition from %.0f to %.0f", A_dax__uses_file, SD_task_get_amount(file), size);
}
}