Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a tag cabinet to write new kind of cluster. See meta_cluster.xml
[simgrid.git] / src / simdag / sd_daxloader.c
index c44a719..45137ff 100644 (file)
@@ -8,6 +8,7 @@
 #include "simdag/simdag.h"
 #include "xbt/misc.h"
 #include "xbt/log.h"
+#include <libgen.h>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd, "Parsing DAX files");
 
@@ -324,7 +325,7 @@ xbt_dynar_t SD_daxload(const char *filename)
           const char *category = depafter->src->category;
           if (category){
             TRACE_category (category);
-            TRACE_sd_set_task_category (newfile, category);
+            SD_task_set_category (newfile, category);
           }
         }
 #endif
@@ -340,7 +341,7 @@ xbt_dynar_t SD_daxload(const char *filename)
           const char *category = depbefore->src->category;
           if (category){
             TRACE_category (category);
-            TRACE_sd_set_task_category (newfile, category);
+            SD_task_set_category (newfile, category);
           }
         }
 #endif
@@ -362,7 +363,7 @@ xbt_dynar_t SD_daxload(const char *filename)
             const char *category = depbefore->src->category;
             if (category){
               TRACE_category (category);
-              TRACE_sd_set_task_category (newfile, category);
+              SD_task_set_category (newfile, category);
             }
           }
 #endif
@@ -384,8 +385,16 @@ xbt_dynar_t SD_daxload(const char *filename)
     }
   }
 
-  acyclic_graph_detail(result);
-  return result;
+  if (!acyclic_graph_detail(result)){
+    XBT_ERROR("The DAX described in %s is not a DAG. It contains a cycle.",
+              basename((char*)filename));
+    xbt_dynar_foreach(result, cpt, file)
+      SD_task_destroy(file);
+     xbt_dynar_free_container(&result);
+    return NULL;
+  } else {
+    return result;
+  }
 }
 
 void STag_dax__adag(void)
@@ -409,7 +418,7 @@ void STag_dax__job(void)
   char *category = A_dax__job_name;
   if (category){
     TRACE_category (category);
-    TRACE_sd_set_task_category(current_job, category);
+    SD_task_set_category(current_job, category);
   }
 #endif
   xbt_dict_set(jobs, A_dax__job_id, current_job, NULL);