Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
plug a bunch of memleaks in SD examples and testsuites
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 15 Aug 2016 12:13:03 +0000 (14:13 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 15 Aug 2016 12:32:15 +0000 (14:32 +0200)
19 files changed:
examples/simdag/dag-dotload/sd_dag-dotload.c
teshsuite/simdag/availability/availability.c
teshsuite/simdag/basic0/basic0.c
teshsuite/simdag/basic1/basic1.c
teshsuite/simdag/basic2/basic2.c
teshsuite/simdag/basic3/basic3.c
teshsuite/simdag/basic4/basic4.c
teshsuite/simdag/basic5/basic5.c
teshsuite/simdag/basic6/basic6.c
teshsuite/simdag/comm-mxn-all2all/comm-mxn-all2all.c
teshsuite/simdag/comm-mxn-independent/comm-mxn-independent.c
teshsuite/simdag/comm-mxn-scatter/comm-mxn-scatter.c
teshsuite/simdag/comm-p2p-latency-1/comm-p2p-latency-1.c
teshsuite/simdag/comm-p2p-latency-2/comm-p2p-latency-2.c
teshsuite/simdag/comm-p2p-latency-3/comm-p2p-latency-3.c
teshsuite/simdag/comm-p2p-latency-bound/comm-p2p-latency-bound.c
teshsuite/simdag/comp-only-par/comp-only-par.c
teshsuite/simdag/comp-only-seq/comp-only-seq.c
teshsuite/simdag/incomplete/incomplete.c

index 2f88d5e..3155441 100644 (file)
@@ -60,18 +60,18 @@ int main(int argc, char **argv)
 
   /* Schedule them all on the first workstation */
   XBT_INFO("------------------- Schedule tasks ---------------------------");
 
   /* Schedule them all on the first workstation */
   XBT_INFO("------------------- Schedule tasks ---------------------------");
-  sg_host_t *ws_list = sg_host_list();
+  sg_host_t *hosts = sg_host_list();
 
   int count = sg_host_count();
   xbt_dynar_foreach(dot, cursor, task) {
     if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
       if (!strcmp(SD_task_get_name(task), "end"))
 
   int count = sg_host_count();
   xbt_dynar_foreach(dot, cursor, task) {
     if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
       if (!strcmp(SD_task_get_name(task), "end"))
-        SD_task_schedulel(task, 1, ws_list[0]);
+        SD_task_schedulel(task, 1, hosts[0]);
       else
       else
-        SD_task_schedulel(task, 1, ws_list[cursor % count]);
+        SD_task_schedulel(task, 1, hosts[cursor % count]);
     }
   }
     }
   }
-  xbt_free(ws_list);
+  xbt_free(hosts);
 
   XBT_INFO("------------------- Run the schedule ---------------------------");
   SD_simulate(-1);
 
   XBT_INFO("------------------- Run the schedule ---------------------------");
   SD_simulate(-1);
index a0f3c73..1a0bfaf 100644 (file)
@@ -20,21 +20,22 @@ static void scheduleDAX(xbt_dynar_t dax)
   unsigned int cursor;
   SD_task_t task;
 
   unsigned int cursor;
   SD_task_t task;
 
-  const sg_host_t *ws_list = sg_host_list();
+  sg_host_t *hosts = sg_host_list();
   int totalHosts = sg_host_count();
   int totalHosts = sg_host_count();
-  qsort((void *) ws_list, totalHosts, sizeof(sg_host_t), name_compare_hosts);
+  qsort((void *) hosts, totalHosts, sizeof(sg_host_t), name_compare_hosts);
 
   xbt_dynar_foreach(dax, cursor, task) {
     if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
       if (!strcmp(SD_task_get_name(task), "end") || !strcmp(SD_task_get_name(task), "root")) {
 
   xbt_dynar_foreach(dax, cursor, task) {
     if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
       if (!strcmp(SD_task_get_name(task), "end") || !strcmp(SD_task_get_name(task), "root")) {
-        XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), sg_host_get_name(ws_list[0]));
-        SD_task_schedulel(task, 1, ws_list[0]);
+        XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), sg_host_get_name(hosts[0]));
+        SD_task_schedulel(task, 1, hosts[0]);
       } else {
       } else {
-        XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), sg_host_get_name(ws_list[(cursor) % totalHosts]));
-        SD_task_schedulel(task, 1, ws_list[(cursor) % totalHosts]);
+        XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), sg_host_get_name(hosts[(cursor) % totalHosts]));
+        SD_task_schedulel(task, 1, hosts[(cursor) % totalHosts]);
       }
     }
   }
       }
     }
   }
+  xbt_free(hosts);
 }
 
 int main(int argc, char *argv[])
 }
 
 int main(int argc, char *argv[])
index 4b472c3..04c1e09 100644 (file)
@@ -40,9 +40,11 @@ int main(int argc, char **argv)
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
-  SD_task_schedule(taskInit, 1, sg_host_list(), no_cost, no_cost, -1.0);
-  SD_task_schedule(taskA, 2, sg_host_list(), no_cost, communication_amount1, -1.0);
-  SD_task_schedule(taskB, 2, sg_host_list(), no_cost, communication_amount2, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(taskInit, 1, hosts, no_cost, no_cost, -1.0);
+  SD_task_schedule(taskA, 2, hosts, no_cost, communication_amount1, -1.0);
+  SD_task_schedule(taskB, 2, hosts, no_cost, communication_amount2, -1.0);
+  xbt_free(hosts);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
index 1d0b508..c296bcb 100644 (file)
@@ -40,11 +40,11 @@ int main(int argc, char **argv)
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
-  const sg_host_t *hosts = sg_host_list();
-
-  SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost, &no_cost, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(taskInit, 1, hosts, &no_cost, &no_cost, -1.0);
   SD_task_schedule(taskA, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
   SD_task_schedule(taskB, 1, &hosts[1], &no_cost, &communication_amount2, -1.0);
   SD_task_schedule(taskA, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
   SD_task_schedule(taskB, 1, &hosts[1], &no_cost, &communication_amount2, -1.0);
+  xbt_free(hosts);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
index 96b8408..5e308c4 100644 (file)
@@ -40,11 +40,11 @@ int main(int argc, char **argv)
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
-  const sg_host_t *workstation = sg_host_list();
-
-  SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost, &no_cost, -1.0);
-  SD_task_schedule(taskA, 1, &workstation[0], &no_cost, &communication_amount1, -1.0);
-  SD_task_schedule(taskB, 1, &workstation[1], &no_cost, &communication_amount2, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(taskInit, 1, hosts, &no_cost, &no_cost, -1.0);
+  SD_task_schedule(taskA, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
+  SD_task_schedule(taskB, 1, &hosts[1], &no_cost, &communication_amount2, -1.0);
+  xbt_free(hosts);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
index 6c2e431..ab44e3e 100644 (file)
@@ -33,9 +33,11 @@ int main(int argc, char **argv)
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskA, taskFin);
 
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskA, taskFin);
 
-  SD_task_schedule(taskInit, 1, sg_host_list(), no_cost, no_cost, -1.0);
-  SD_task_schedule(taskA, 2, sg_host_list(), no_cost, no_cost, -1.0);
-  SD_task_schedule(taskFin, 1, sg_host_list(), no_cost, no_cost, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(taskInit, 1, hosts, no_cost, no_cost, -1.0);
+  SD_task_schedule(taskA, 2, hosts, no_cost, no_cost, -1.0);
+  SD_task_schedule(taskFin, 1, hosts, no_cost, no_cost, -1.0);
+  xbt_free(hosts);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
index c1c36f9..c061e6a 100644 (file)
@@ -36,9 +36,11 @@ int main(int argc, char **argv)
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskA, taskFin);
 
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskA, taskFin);
 
-  SD_task_schedule(taskInit, 1, sg_host_list(), no_cost, no_cost, -1.0);
-  SD_task_schedule(taskA, 2, sg_host_list(), no_cost, amount, -1.0);
-  SD_task_schedule(taskFin, 1, sg_host_list(), no_cost, no_cost, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(taskInit, 1, hosts, no_cost, no_cost, -1.0);
+  SD_task_schedule(taskA, 2, hosts, no_cost, amount, -1.0);
+  SD_task_schedule(taskFin, 1, hosts, no_cost, no_cost, -1.0);
+  xbt_free(hosts);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
index 59e0bf6..485cdcb 100644 (file)
@@ -39,9 +39,11 @@ int main(int argc, char **argv)
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
-  SD_task_schedule(taskInit, 1, sg_host_list(), no_cost, no_cost, -1.0);
-  SD_task_schedule(taskA, 2, sg_host_list(), no_cost, amount, -1.0);
-  SD_task_schedule(taskB, 1, sg_host_list(), comput, no_cost, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(taskInit, 1, hosts, no_cost, no_cost, -1.0);
+  SD_task_schedule(taskA, 2, hosts, no_cost, amount, -1.0);
+  SD_task_schedule(taskB, 1, hosts, comput, no_cost, -1.0);
+  xbt_free(hosts);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
 
   /* let's launch the simulation! */
   SD_simulate(-1.0);
index 5a2b3d5..204e55a 100644 (file)
@@ -32,8 +32,10 @@ int main(int argc, char **argv)
   SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
   SD_task_t taskB = SD_task_create("Task B", NULL, 1.0);
 
   SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
   SD_task_t taskB = SD_task_create("Task B", NULL, 1.0);
 
-  SD_task_schedule(taskA, 1, sg_host_list(), comp_cost, comm_cost, -1.0);
-  SD_task_schedule(taskB, 1, sg_host_list(), comp_cost, comm_cost, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(taskA, 1, hosts, comp_cost, comm_cost, -1.0);
+  SD_task_schedule(taskB, 1, hosts, comp_cost, comm_cost, -1.0);
+  xbt_free(hosts);
 
   ret = SD_simulate(-1.0);
   xbt_assert(xbt_dynar_length(ret) == 2, "I was expecting the completion of 2 tasks, but I got %lu instead",
 
   ret = SD_simulate(-1.0);
   xbt_assert(xbt_dynar_length(ret) == 2, "I was expecting the completion of 2 tasks, but I got %lu instead",
index 9aeb6b0..5ba3320 100644 (file)
@@ -30,7 +30,9 @@ int main(int argc, char **argv)
 
   SD_task_t task = SD_task_create("All2all task", NULL, 1.0);
 
 
   SD_task_t task = SD_task_create("All2all task", NULL, 1.0);
 
-  SD_task_schedule(task, 4, sg_host_list(), SD_SCHED_NO_COST, communication_amount, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(task, 4, hosts, SD_SCHED_NO_COST, communication_amount, -1.0);
+  xbt_free(hosts);
 
   SD_simulate(-1.0);
 
 
   SD_simulate(-1.0);
 
index 59cbb8d..07a79ac 100644 (file)
@@ -31,7 +31,9 @@ int main(int argc, char **argv)
 
   SD_task_t task = SD_task_create("Comm 1", NULL, 1.0);
 
 
   SD_task_t task = SD_task_create("Comm 1", NULL, 1.0);
 
-  SD_task_schedule(task, 4, sg_host_list(), SD_SCHED_NO_COST, communication_amount, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(task, 4, hosts, SD_SCHED_NO_COST, communication_amount, -1.0);
+  xbt_free(hosts);
 
   SD_simulate(-1.0);
 
 
   SD_simulate(-1.0);
 
index e26c44a..e55fadf 100644 (file)
@@ -32,7 +32,9 @@ int main(int argc, char **argv)
 
   SD_task_t task = SD_task_create("Scatter task", NULL, 1.0);
 
 
   SD_task_t task = SD_task_create("Scatter task", NULL, 1.0);
 
-  SD_task_schedule(task, 4, sg_host_list(), SD_SCHED_NO_COST, communication_amount, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(task, 4, hosts, SD_SCHED_NO_COST, communication_amount, -1.0);
+  xbt_free(hosts);
 
   SD_simulate(-1.0);
 
 
   SD_simulate(-1.0);
 
index 4896951..ed3557a 100644 (file)
@@ -26,7 +26,9 @@ int main(int argc, char **argv)
 
   SD_task_t task = SD_task_create("Comm 1", NULL, 1.0);
 
 
   SD_task_t task = SD_task_create("Comm 1", NULL, 1.0);
 
-  SD_task_schedule(task, 2, sg_host_list(), no_cost, communication_amount, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(task, 2, hosts, no_cost, communication_amount, -1.0);
+  xbt_free(hosts);
 
   SD_simulate(-1.0);
 
 
   SD_simulate(-1.0);
 
index ceafd26..dd845e1 100644 (file)
@@ -28,9 +28,11 @@ int main(int argc, char **argv)
   SD_task_t task1 = SD_task_create("Comm 1", NULL, 1.0);
   SD_task_t task2 = SD_task_create("Comm 2", NULL, 1.0);
 
   SD_task_t task1 = SD_task_create("Comm 1", NULL, 1.0);
   SD_task_t task2 = SD_task_create("Comm 2", NULL, 1.0);
 
-  SD_task_schedule(root, 1, sg_host_list(), no_cost1, no_cost1, -1.0);
-  SD_task_schedule(task1, 2, sg_host_list(), no_cost, communication_amount1, -1.0);
-  SD_task_schedule(task2, 2, sg_host_list(), no_cost, communication_amount2, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(root, 1, hosts, no_cost1, no_cost1, -1.0);
+  SD_task_schedule(task1, 2, hosts, no_cost, communication_amount1, -1.0);
+  SD_task_schedule(task2, 2, hosts, no_cost, communication_amount2, -1.0);
+  xbt_free(hosts);
 
   SD_task_dependency_add(NULL, NULL, root, task1);
   SD_task_dependency_add(NULL, NULL, root, task2);
 
   SD_task_dependency_add(NULL, NULL, root, task1);
   SD_task_dependency_add(NULL, NULL, root, task2);
index c7ba9e4..74aaca0 100644 (file)
@@ -30,9 +30,11 @@ int main(int argc, char **argv)
   SD_task_t task1 = SD_task_create("Comm 1", NULL, 1.0);
   SD_task_t task2 = SD_task_create("Comm 2", NULL, 1.0);
 
   SD_task_t task1 = SD_task_create("Comm 1", NULL, 1.0);
   SD_task_t task2 = SD_task_create("Comm 2", NULL, 1.0);
 
-  SD_task_schedule(root, 1, sg_host_list(), no_cost1, no_cost1, -1.0);
-  SD_task_schedule(task1, 2, sg_host_list(), no_cost, communication_amount1, -1.0);
-  SD_task_schedule(task2, 2, sg_host_list(), no_cost, communication_amount2, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(root, 1, hosts, no_cost1, no_cost1, -1.0);
+  SD_task_schedule(task1, 2, hosts, no_cost, communication_amount1, -1.0);
+  SD_task_schedule(task2, 2, hosts, no_cost, communication_amount2, -1.0);
+  xbt_free(hosts);
 
   SD_task_dependency_add(NULL, NULL, root, task1);
   SD_task_dependency_add(NULL, NULL, root, task2);
 
   SD_task_dependency_add(NULL, NULL, root, task1);
   SD_task_dependency_add(NULL, NULL, root, task2);
index 357c4cc..f29bdd9 100644 (file)
@@ -29,13 +29,16 @@ int main(int argc, char **argv)
   SD_create_environment(argv[1]);
 
   SD_task_t root = SD_task_create("Root", NULL, 1.0);
   SD_create_environment(argv[1]);
 
   SD_task_t root = SD_task_create("Root", NULL, 1.0);
-  SD_task_schedule(root, 1, sg_host_list(), no_cost, no_cost, -1.0);
+
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(root, 1, hosts, no_cost, no_cost, -1.0);
 
   for (int i = 0; i < TASK_NUM; i++) {
     task[i] = SD_task_create("Comm", NULL, 1.0);
 
   for (int i = 0; i < TASK_NUM; i++) {
     task[i] = SD_task_create("Comm", NULL, 1.0);
-    SD_task_schedule(task[i], 2, sg_host_list(), no_cost, communication_amount, -1.0);
+    SD_task_schedule(task[i], 2, hosts, no_cost, communication_amount, -1.0);
     SD_task_dependency_add(NULL, NULL, root, task[i]);
   }
     SD_task_dependency_add(NULL, NULL, root, task[i]);
   }
+  xbt_free(hosts);
 
   SD_simulate(-1.0);
 
 
   SD_simulate(-1.0);
 
index 7d20631..6ce8ddb 100644 (file)
@@ -16,7 +16,9 @@ int main(int argc, char **argv)
   SD_create_environment(argv[1]);
 
   SD_task_t task = SD_task_create("partask", NULL, 1.0);
   SD_create_environment(argv[1]);
 
   SD_task_t task = SD_task_create("partask", NULL, 1.0);
-  SD_task_schedule(task, 2, sg_host_list(), comp_cost, comm_amount, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(task, 2, hosts, comp_cost, comm_amount, -1.0);
+  xbt_free(hosts);
 
   SD_simulate(-1.0);
 
 
   SD_simulate(-1.0);
 
index 8bc1c66..a0908e2 100644 (file)
@@ -19,7 +19,9 @@ int main(int argc, char **argv)
   SD_create_environment(argv[1]);
 
   SD_task_t task = SD_task_create("seqtask", NULL, 1.0);
   SD_create_environment(argv[1]);
 
   SD_task_t task = SD_task_create("seqtask", NULL, 1.0);
-  SD_task_schedule(task, 1, sg_host_list(), comp_cost, comm_amount, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(task, 1, hosts, comp_cost, comm_amount, -1.0);
+  xbt_free(hosts);
 
   SD_simulate(-1.0);
 
 
   SD_simulate(-1.0);
 
index 68238f0..593b934 100644 (file)
@@ -42,11 +42,11 @@ int main(int argc, char **argv)
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
   SD_task_dependency_add(NULL, NULL, taskC, taskD);
 
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
   SD_task_dependency_add(NULL, NULL, taskC, taskD);
 
-  const sg_host_t *hosts = sg_host_list();
-
-  SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost, &no_cost, -1.0);
+  sg_host_t *hosts = sg_host_list();
+  SD_task_schedule(taskInit, 1, hosts, &no_cost, &no_cost, -1.0);
   SD_task_schedule(taskA, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
   SD_task_schedule(taskD, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
   SD_task_schedule(taskA, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
   SD_task_schedule(taskD, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
+  xbt_free(hosts);
 
   /* let's launch the simulation! */
   SD_simulate(-1.);
 
   /* let's launch the simulation! */
   SD_simulate(-1.);