Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't create dependencies if both root and end are not connected to any task
[simgrid.git] / src / simdag / sd_daxloader.cpp
index c2c1ac1..543cb63 100644 (file)
@@ -101,11 +101,9 @@ bool acyclic_graph_detail(xbt_dynar_t dag){
   if(!all_marked){
     XBT_VERB("there is at least one cycle in your task graph");
     xbt_dynar_foreach(dag,count,task){
-      if(task->kind != SD_TASK_COMM_E2E) {
-        if(task->predecessors->empty() && task->inputs->empty()){
-          task->marked = 1;
-          current.push_back(task);
-        }
+      if(task->kind != SD_TASK_COMM_E2E && task->predecessors->empty() && task->inputs->empty()){
+       task->marked = 1;
+       current.push_back(task);
       }
     }
     //test if something has to be done for the next iteration
@@ -239,12 +237,14 @@ xbt_dynar_t SD_daxload(const char *filename)
       /* If some tasks do not take files as input, connect them to the root
        * if they don't produce files, connect them to the end node.
        */
-      if ((file != root_task) && file->inputs->empty())
-        SD_task_dependency_add(nullptr, nullptr, root_task, file);
-      if ((file != end_task) && file->outputs->empty())
-        SD_task_dependency_add(nullptr, nullptr, file, end_task);
+      if ((file != root_task) && (file != end_task)) {
+        if (file->inputs->empty())
+          SD_task_dependency_add(nullptr, nullptr, root_task, file);
+        if (file->outputs->empty())
+          SD_task_dependency_add(nullptr, nullptr, file, end_task);
+      }
     } else {
-       THROW_IMPOSSIBLE;
+      THROW_IMPOSSIBLE;
     }
   }