- if(schedule == false){
- WARN0("No scheduling provided");
- }else{
- xbt_dynar_t computer = NULL;
- xbt_dict_cursor_t dict_cursor;
- char *computer_name;
- const SD_workstation_t *workstations = SD_workstation_get_list ();
- xbt_dict_foreach(computers,dict_cursor,computer_name,computer){
- int count_computer = dot_parse_int(computer_name);
- int count=0;
- SD_task_t task;
- SD_task_t task_previous = NULL;
- xbt_dynar_foreach(computer,count,task){
- // add dependency between the previous and the task to avoid
- // parallel execution
- if(task != NULL ){
- if(task_previous != NULL &&
- !SD_task_dependency_exists(task_previous, task))
- SD_task_dependency_add(NULL, NULL, task_previous, task);
- SD_task_schedulel(task, 1, workstations[count_computer]);
- task_previous = task;
- }
- }
- xbt_dynar_free(&computer);
+ xbt_dict_free(&computers);
+ fclose(in_file);
+ if (!acyclic_graph_detail(result)) {
+ XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.",
+ basename((char*)filename));
+ xbt_dynar_free(&result);
+ /* (result == NULL) here */
+ }
+ return result;
+}
+
+
+xbt_dynar_t SD_dotload_generic(const char * filename)
+{
+ xbt_assert(filename, "Unable to use a null file descriptor\n");
+ //dag_dot = agopen((char*)filename,Agstrictdirected,0);
+ FILE *in_file = fopen(filename, "r");
+ dag_dot = agread(in_file, NIL(Agdisc_t *));
+
+ result = xbt_dynar_new(sizeof(SD_task_t), dot_task_p_free);
+ files = xbt_dict_new_homogeneous(NULL);
+ jobs = xbt_dict_new_homogeneous(NULL);
+ computers = xbt_dict_new_homogeneous(NULL);
+ 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) {
+ XBT_DEBUG("Considering file '%s' stored in the dictionnary",
+ file->name);
+ if (xbt_dynar_is_empty(file->tasks_before)) {
+ XBT_DEBUG("file '%s' has no source. Add dependency from 'root'",
+ file->name);
+ SD_task_dependency_add(NULL, NULL, root_task, file);
+ } else if (xbt_dynar_is_empty(file->tasks_after)) {
+ XBT_DEBUG("file '%s' has no destination. Add dependency to 'end'",
+ file->name);
+ SD_task_dependency_add(NULL, NULL, file, end_task);