Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Hope it works better now.
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 13 Oct 2006 09:21:09 +0000 (09:21 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 13 Oct 2006 09:21:09 +0000 (09:21 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2888 48e7efb5-ca39-0410-a469-dd3cf9ba447f

testsuite/simdag/Makefile
testsuite/simdag/sd_test.c

index d1d1b96..484981e 100644 (file)
@@ -5,11 +5,11 @@ CC = gcc
 PEDANTIC_PARANOID_FREAK =       -O0 -Wshadow -Wcast-align \
                                -Waggregate-return -Wmissing-prototypes -Wmissing-declarations \
                                -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
-                               -Wmissing-noreturn -Wredundant-decls -Wnested-externs \
+                               -Wmissing-noreturn -Wnested-externs \
                                -Wpointer-arith -Wwrite-strings -finline-functions
 REASONABLY_CAREFUL_DUDE =      -Wall -Werror
 NO_PRAYER_FOR_THE_WICKED =     -w -O2 
-WARNINGS =                     $(REASONABLY_CAREFUL_DUDE)
+WARNINGS =                     $(PEDANTIC_PARANOID_FREAK)
 CFLAGS = -g $(WARNINGS)
 
 INCLUDES = -I$(INSTALL_PATH)/include
index 9104e61..d42376c 100644 (file)
@@ -33,14 +33,20 @@ int main(int argc, char **argv) {
   const double computation_amount2 = 1000000;
   const double communication_amount12 = 2000000;
   const double communication_amount21 = 3000000;
+  const SD_link_t *route = SD_route_get_list(w1, w2);
+  int route_size = SD_route_get_size(w1, w2);
+  SD_task_t taskA = SD_task_create("Task A", NULL, 10.0);
+  SD_task_t taskB = SD_task_create("Task B", NULL, 40.0);
+  SD_task_t taskC = SD_task_create("Task C", NULL, 30.0);
+  SD_task_t taskD = SD_task_create("Task D", NULL, 60.0);
+  xbt_ex_t ex;
+
   INFO3("Computation time for %f flops on %s: %f", computation_amount1, name1,
        SD_workstation_get_computation_time(w1, computation_amount1));
   INFO3("Computation time for %f flops on %s: %f", computation_amount2, name2,
        SD_workstation_get_computation_time(w2, computation_amount2));
 
   INFO2("Route between %s and %s:", name1, name2);
-  SD_link_t *route = SD_route_get_list(w1, w2);
-  int route_size = SD_route_get_size(w1, w2);
   for (i = 0; i < route_size; i++) {
     INFO3("\tLink %s: latency = %f, bandwidth = %f", SD_link_get_name(route[i]),
          SD_link_get_current_latency(route[i]), SD_link_get_current_bandwidth(route[i]));
@@ -51,14 +57,8 @@ int main(int argc, char **argv) {
        SD_route_get_communication_time(w1, w2, communication_amount12));
   INFO4("Communication time for %f bytes between %s and %s: %f", communication_amount21, name2, name1,
        SD_route_get_communication_time(w2, w1, communication_amount21));
-  xbt_free(route);
 
-  /* creation of the tasks and their dependencies */
-  SD_task_t taskA = SD_task_create("Task A", NULL, 10.0);
-  SD_task_t taskB = SD_task_create("Task B", NULL, 40.0);
-  SD_task_t taskC = SD_task_create("Task C", NULL, 30.0);
-  SD_task_t taskD = SD_task_create("Task D", NULL, 60.0);
-  
+  /* creation of the tasks and their dependencies */  
 
   SD_task_dependency_add(NULL, NULL, taskB, taskA);
   SD_task_dependency_add(NULL, NULL, taskC, taskA);
@@ -66,8 +66,6 @@ int main(int argc, char **argv) {
   SD_task_dependency_add(NULL, NULL, taskD, taskC);
   /*  SD_task_dependency_add(NULL, NULL, taskA, taskD); /\* deadlock */
 
-  xbt_ex_t ex;
-
   TRY {
     SD_task_dependency_add(NULL, NULL, taskA, taskA); /* shouldn't work and must raise an exception */
     xbt_assert0(0, "Hey, I can add a dependency between Task A and Task A!");
@@ -108,45 +106,44 @@ int main(int argc, char **argv) {
 
 
   /* scheduling parameters */
-
-  const int workstation_number = 2;
-  const SD_workstation_t workstation_list[] = {w1, w2};
-  double computation_amount[] = {computation_amount1, computation_amount2};
-  double communication_amount[] =
-    {
-      0, communication_amount12,
-      communication_amount21, 0
-    };
-  double rate = -1.0;
-
-  /* estimated time */
-  SD_task_t task = taskD;
-  INFO2("Estimated time for '%s': %f", SD_task_get_name(task),
-       SD_task_get_execution_time(task, workstation_number, workstation_list,
-                                  computation_amount, communication_amount, rate));
-
-  /* let's launch the simulation! */
-
-  SD_task_schedule(taskA, workstation_number, workstation_list,
-                  computation_amount, communication_amount, rate);
-  SD_task_schedule(taskB, workstation_number, workstation_list,
-                  computation_amount, communication_amount, rate);
-  SD_task_schedule(taskC, workstation_number, workstation_list,
-                  computation_amount, communication_amount, rate);
-  SD_task_schedule(taskD, workstation_number, workstation_list,
-                  computation_amount, communication_amount, rate);
-
-  SD_task_t *changed_tasks;
-
-  changed_tasks = SD_simulate(-1.0);
-  xbt_assert0(changed_tasks[0] == taskD &&
-             changed_tasks[1] == taskB &&
-             changed_tasks[2] == taskC &&
-             changed_tasks[3] == NULL,
-             "Unexpected simulation results");
-  
-  xbt_free(changed_tasks);
-
+  {
+    const int workstation_number = 2;
+    const SD_workstation_t workstation_list[] = {w1, w2};
+    double computation_amount[] = {computation_amount1, computation_amount2};
+    double communication_amount[] =
+      {
+       0, communication_amount12,
+       communication_amount21, 0
+      };
+    SD_task_t *changed_tasks;
+    double rate = -1.0;
+        
+    /* estimated time */
+    SD_task_t task = taskD;
+    INFO2("Estimated time for '%s': %f", SD_task_get_name(task),
+         SD_task_get_execution_time(task, workstation_number, workstation_list,
+                                    computation_amount, communication_amount, rate));
+    
+    /* let's launch the simulation! */
+    
+    SD_task_schedule(taskA, workstation_number, workstation_list,
+                    computation_amount, communication_amount, rate);
+    SD_task_schedule(taskB, workstation_number, workstation_list,
+                    computation_amount, communication_amount, rate);
+    SD_task_schedule(taskC, workstation_number, workstation_list,
+                    computation_amount, communication_amount, rate);
+    SD_task_schedule(taskD, workstation_number, workstation_list,
+                    computation_amount, communication_amount, rate);
+    
+    changed_tasks = SD_simulate(-1.0);
+    xbt_assert0(changed_tasks[0] == taskD &&
+               changed_tasks[1] == taskB &&
+               changed_tasks[2] == taskC &&
+               changed_tasks[3] == NULL,
+               "Unexpected simulation results");
+    
+    xbt_free(changed_tasks);
+  }
   DEBUG0("Destroying tasks...");
 
   SD_task_destroy(taskA);