- xbt_assert0(in_file, "Unable to use a null file descriptor\n");
- dag_dot = agread(in_file,NIL(Agdisc_t*));
-
- result = xbt_dynar_new(sizeof(SD_task_t),dot_task_free);
- files=xbt_dict_new();
- jobs=xbt_dict_new();
- root_task = SD_task_create_comp_seq("root",NULL,0);
- /* by design the root task is always SCHEDULABLE */
- __SD_task_set_state(root_task, SD_SCHEDULABLE);
-
- xbt_dynar_push(result,&root_task);
- end_task = SD_task_create_comp_seq("end",NULL,0);
-
- Agnode_t *dag_node = NULL;
- SD_task_t task_node = NULL;
- for (dag_node = agfstnode(dag_dot); dag_node; dag_node = agnxtnode(dag_dot,dag_node)){
- Start_dot_job(dag_node);
- }
- agclose(dag_dot);
- xbt_dict_free(&jobs);
-
- /* And now, post-process the files.
- * We want a file task per pair of computation tasks exchanging the file. Duplicate on need
- * Files not produced in the system are said to be produced by root task (top of DAG).
- * Files not consumed in the system are said to be consumed by end task (bottom of DAG).
- */
- xbt_dict_cursor_t cursor;
- SD_task_t file;
- char *name;
- xbt_dict_foreach(files,cursor,name,file) {
- unsigned int cpt1,cpt2;
- SD_task_t newfile = NULL;
- SD_dependency_t depbefore,depafter;
- if (xbt_dynar_length(file->tasks_before) == 0) {
- xbt_dynar_foreach(file->tasks_after,cpt2,depafter) {
- SD_task_t newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
- SD_task_dependency_add(NULL,NULL,root_task,newfile);
- SD_task_dependency_add(NULL,NULL,newfile,depafter->dst);
- xbt_dynar_push(result,&newfile);
- }
- } else if (xbt_dynar_length(file->tasks_after) == 0) {
- xbt_dynar_foreach(file->tasks_before,cpt2,depbefore) {
- SD_task_t newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
- SD_task_dependency_add(NULL,NULL,depbefore->src,newfile);
- SD_task_dependency_add(NULL,NULL,newfile,end_task);
- xbt_dynar_push(result,&newfile);
- }
- } else {
- xbt_dynar_foreach(file->tasks_before,cpt1,depbefore) {
- xbt_dynar_foreach(file->tasks_after,cpt2,depafter) {
- if (depbefore->src == depafter->dst) {
- WARN2("File %s is produced and consumed by task %s. This loop dependency will prevent the execution of the task.",
- file->name,depbefore->src->name);
- }
- newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
- SD_task_dependency_add(NULL,NULL,depbefore->src,newfile);
- SD_task_dependency_add(NULL,NULL,newfile,depafter->dst);
- xbt_dynar_push(result,&newfile);
+ xbt_assert0(in_file, "Unable to use a null file descriptor\n");
+ dag_dot = agread(in_file,NIL(Agdisc_t*));
+
+ result = xbt_dynar_new(sizeof(SD_task_t),dot_task_free);
+ files=xbt_dict_new();
+ jobs=xbt_dict_new();
+ root_task = SD_task_create_comp_seq("root",NULL,0);
+ /* by design the root task is always SCHEDULABLE */
+ __SD_task_set_state(root_task, SD_SCHEDULABLE);
+
+ xbt_dict_set(jobs,"root",root_task,NULL);
+ xbt_dynar_push(result,&root_task);
+ end_task = SD_task_create_comp_seq("end",NULL,0);
+ xbt_dict_set(jobs,"end",end_task,NULL);
+
+ Agnode_t *dag_node = NULL;
+ for (dag_node = agfstnode(dag_dot); dag_node; dag_node = agnxtnode(dag_dot,dag_node)){
+ dot_add_task(dag_node);
+ }
+ agclose(dag_dot);
+ xbt_dict_free(&jobs);
+
+ /* And now, post-process the files.
+ * We want a file task per pair of computation tasks exchanging the file. Duplicate on need
+ * Files not produced in the system are said to be produced by root task (top of DAG).
+ * Files not consumed in the system are said to be consumed by end task (bottom of DAG).
+ */
+ xbt_dict_cursor_t cursor;
+ SD_task_t file;
+ char *name;
+ xbt_dict_foreach(files,cursor,name,file) {
+ unsigned int cpt1,cpt2;
+ SD_task_t newfile = NULL;
+ SD_dependency_t depbefore,depafter;
+ if (xbt_dynar_length(file->tasks_before) == 0) {
+ xbt_dynar_foreach(file->tasks_after,cpt2,depafter) {
+ SD_task_t newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
+ SD_task_dependency_add(NULL,NULL,root_task,newfile);
+ SD_task_dependency_add(NULL,NULL,newfile,depafter->dst);
+ xbt_dynar_push(result,&newfile);
+ }
+ } else if (xbt_dynar_length(file->tasks_after) == 0) {
+ xbt_dynar_foreach(file->tasks_before,cpt2,depbefore) {
+ SD_task_t newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
+ SD_task_dependency_add(NULL,NULL,depbefore->src,newfile);
+ SD_task_dependency_add(NULL,NULL,newfile,end_task);
+ xbt_dynar_push(result,&newfile);
+ }
+ } else {
+ xbt_dynar_foreach(file->tasks_before,cpt1,depbefore) {
+ xbt_dynar_foreach(file->tasks_after,cpt2,depafter) {
+ if (depbefore->src == depafter->dst) {
+ WARN2("File %s is produced and consumed by task %s. This loop dependency will prevent the execution of the task.",
+ file->name,depbefore->src->name);
+ }
+ newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
+ SD_task_dependency_add(NULL,NULL,depbefore->src,newfile);
+ SD_task_dependency_add(NULL,NULL,newfile,depafter->dst);
+ xbt_dynar_push(result,&newfile);
+ }
+ }