return value;
}
+/* Ensure that transfer tasks have unique names even though a file is used
+ * several times */
+
+void uniq_transfer_task_name(SD_task_t task){
+ SD_task_t child, parent;
+ xbt_dynar_t children, parents;
+ char *new_name;
+
+ children = SD_task_get_children(task);
+ parents = SD_task_get_parents(task);
+
+ xbt_dynar_get_cpy(children,0,&child);
+ xbt_dynar_get_cpy(parents,0,&parent);
+
+ new_name = bprintf("%s_%s_%s",
+ SD_task_get_name(parent),
+ SD_task_get_name(task),
+ SD_task_get_name(child));
+
+ SD_task_set_name (task, new_name);
+
+ xbt_dynar_free_container(&children);
+ xbt_dynar_free_container(&parents);
+ free(new_name);
+}
+
+
static YY_BUFFER_STATE input_buffer;
static xbt_dynar_t result;
* for more details.
*/
xbt_dynar_t SD_daxload(const char*filename) {
+ xbt_dict_cursor_t cursor;
+ SD_task_t file;
+ char *name;
FILE* in_file = fopen(filename,"r");
xbt_assert1(in_file, "Unable to open \"%s\"\n", filename);
input_buffer = dax__create_buffer(in_file, 10);
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);
* 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) {
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);
}
- SD_task_t newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
+ 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);
/* Free previous copy of the files */
xbt_dict_free(&files);
+ unsigned int cpt;
+ xbt_dynar_foreach(result,cpt,file) {
+ if (SD_task_get_kind(file)==SD_TASK_COMM_E2E){
+ uniq_transfer_task_name(file);
+ }
+ }
return result;
}