Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add stuff to make transfer task names unique.
authorsuter <suter@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 12 Jul 2010 07:26:53 +0000 (07:26 +0000)
committersuter <suter@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 12 Jul 2010 07:26:53 +0000 (07:26 +0000)
Problem was that if task A sends file F to tasks B and C, there were
two tasks named F.
With this commit, tranfers are named A_F_B and A_F_C respectively.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8009 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/simdag/sd_daxloader.c

index 6eee634..07b5294 100644 (file)
@@ -40,6 +40,33 @@ static int dax_parse_int(const char *string) {
   return value;
 }
 
   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;
 static YY_BUFFER_STATE input_buffer;
 
 static xbt_dynar_t result;
@@ -137,6 +164,12 @@ xbt_dynar_t SD_daxload(const char*filename) {
 
   /* Free previous copy of the files */
   xbt_dict_free(&files);
 
   /* 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;
 }
 
   return result;
 }