Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid
authorsuter <frederic.suter@cc.in2p3.fr>
Wed, 23 May 2012 15:31:03 +0000 (17:31 +0200)
committersuter <frederic.suter@cc.in2p3.fr>
Wed, 23 May 2012 15:31:03 +0000 (17:31 +0200)
ChangeLog
examples/simdag/sd_seq_access.c
examples/simdag/test_simdag_seq_access.tesh
src/simdag/sd_workstation.c

index c8e03e2..110dc5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,19 @@ SimGrid (3.7.1) NOT RELEASED; urgency=low
  SURF:
  * Fix weird behaviors when dealing with parallel tasks.
 
+ SimDag:
+ * New type of typed tasks SD_TASK_COMP_PAR_AMDAHL that represents a
+   parallel task whose initial work is distributed among host according
+   to the Amdahl's law. Such tasks are created with a parameter alpha
+   that corresponds to the non-parallelizable part of the computation.
+
+   Before calling SD_task_schedulel or SD_task_schedulev, the
+   SD_task_distribute_comp_amdahl function has to be called with the
+   desired number of workstations. The filling of computation_amount and
+   communication_amount (actually empty) structures is then done
+   seamlessly.
+ * New function SD_workstation_dump to display various information
+
  Bug fixes, cosmetics and small improvements
  * Fix compilation when using MSG_USE_DEPRECATED.
 
index 01b0433..bc82a3d 100644 (file)
@@ -18,14 +18,8 @@ int main(int argc, char **argv)
   int i;
   const char *platform_file;
   const SD_workstation_t *workstations;
-  int kind;
   SD_task_t task, taskA, taskB, taskC;
   xbt_dynar_t changed_tasks;
-  SD_workstation_t workstation_list[2];
-  double computation_amount[2];
-  double communication_amount[4] = { 0 };
-  double rate = -1.0;
-  SD_workstation_t w1, w2;
 
   /* initialisation of SD */
   SD_init(&argc, argv);
@@ -44,21 +38,21 @@ int main(int argc, char **argv)
 
   /* Change the access mode of the workstations */
   workstations = SD_workstation_get_list();
-  w1 = workstations[0];
-  w2 = workstations[1];
   for (i = 0; i < 2; i++) {
+       SD_workstation_dump(workstations[i]);
+       
     SD_workstation_set_access_mode(workstations[i],
                                    SD_WORKSTATION_SEQUENTIAL_ACCESS);
-    XBT_INFO("Access mode of %s is %s",
+    XBT_INFO(" Change access mode of %s to %s",
           SD_workstation_get_name(workstations[i]),
           (SD_workstation_get_access_mode(workstations[i]) ==
            SD_WORKSTATION_SEQUENTIAL_ACCESS) ? "sequential" : "shared");
   }
 
   /* creation of the tasks and their dependencies */
-  taskA = SD_task_create_comp_seq("Task A", NULL, 2e9);
-  taskB = SD_task_create_comm_e2e("Task B", NULL, 2e9);
-  taskC = SD_task_create_comp_seq("Task C", NULL, 1e9);
+  taskA = SD_task_create_comp_seq("Task A", NULL, 2e10);
+  taskB = SD_task_create_comm_e2e("Task B", NULL, 2e8);
+  taskC = SD_task_create_comp_seq("Task C", NULL, 1e10);
 
   /* if everything is ok, no exception is forwarded or rethrown by main() */
 
@@ -70,51 +64,15 @@ int main(int argc, char **argv)
 
 
   /* scheduling parameters */
-  workstation_list[0] = w1;
-  workstation_list[1] = w2;
-  computation_amount[0] = SD_task_get_amount(taskA);
-  computation_amount[1] = SD_task_get_amount(taskB);
-
-  communication_amount[1] = SD_task_get_amount(taskC);
-  communication_amount[2] = 0.0;
-
-  SD_task_schedule(taskA, 1, &w1,
-                   &(computation_amount[0]), SD_SCHED_NO_COST, rate);
-  SD_task_schedule(taskB, 2, workstation_list,
-                   SD_SCHED_NO_COST, communication_amount, rate);
-  SD_task_schedule(taskC, 1, &w1,
-                   &(computation_amount[1]), SD_SCHED_NO_COST, rate);
+  SD_task_schedulel(taskA, 1, workstations[0]);
+  SD_task_schedulel(taskB, 2, workstations[0], workstations[1]);
+  SD_task_schedulel(taskC, 1, workstations[1]);
 
   /* let's launch the simulation! */
   while (!xbt_dynar_is_empty(changed_tasks = SD_simulate(-1.0))) {
+       XBT_INFO(" Simulation was suspended, check workstation states"); 
     for (i = 0; i < 2; i++) {
-      task = SD_workstation_get_current_task(workstations[i]);
-      if (task)
-        kind = SD_task_get_kind(task);
-      else {
-        XBT_INFO("There is no task running on %s",
-              SD_workstation_get_name(workstations[i]));
-        continue;
-      }
-
-      switch (kind) {
-      case SD_TASK_COMP_SEQ:
-        XBT_INFO("%s is currently running on %s (SD_TASK_COMP_SEQ)",
-              SD_task_get_name(task),
-              SD_workstation_get_name(workstations[i]));
-        break;
-      case SD_TASK_COMM_E2E:
-        XBT_INFO("%s is currently running on %s (SD_TASK_COMM_E2E)",
-              SD_task_get_name(task),
-              SD_workstation_get_name(workstations[i]));
-        break;
-      case SD_TASK_NOT_TYPED:
-        XBT_INFO("Task running on %s has no type",
-              SD_workstation_get_name(workstations[i]));
-        break;
-      default:
-        XBT_ERROR("Shouldn't be here");
-      }
+         SD_workstation_dump(workstations[i]);
     }
     xbt_dynar_free(&changed_tasks);
   }
index d1c6d52..de9bbac 100644 (file)
@@ -4,13 +4,57 @@ p Simple test of simdag
 
 $ $SG_TEST_EXENV ./sd_seq_access ${srcdir:=.}/2clusters.xml
 > [0.000000] [surf_workstation/INFO] surf_workstation_model_init_ptask_L07
-> [0.000000] [sd_seq_access/INFO] Access mode of C2-05 is sequential
-> [0.000000] [sd_seq_access/INFO] Access mode of C2-06 is sequential
-> [0.000000] [sd_seq_access/INFO] Task A is currently running on C2-05 (SD_TASK_COMP_SEQ)
-> [0.000000] [sd_seq_access/INFO] There is no task running on C2-06
-> [0.400000] [sd_seq_access/INFO] Task B is currently running on C2-05 (SD_TASK_COMM_E2E)
-> [0.400000] [sd_seq_access/INFO] Task B is currently running on C2-06 (SD_TASK_COMM_E2E)
-> [30.400300] [sd_seq_access/INFO] Task C is currently running on C2-05 (SD_TASK_COMP_SEQ)
-> [30.400300] [sd_seq_access/INFO] There is no task running on C2-06
-> [30.800300] [sd_seq_access/INFO] There is no task running on C2-05
-> [30.800300] [sd_seq_access/INFO] There is no task running on C2-06
+> [0.000000] [sd_workstation/INFO] Displaying workstation C2-05
+> [0.000000] [sd_workstation/INFO]   - power: 5000000000
+> [0.000000] [sd_workstation/INFO]   - available power: 1.00
+> [0.000000] [sd_workstation/INFO]   - access mode: Space shared
+> [0.000000] [sd_seq_access/INFO]  Change access mode of C2-05 to sequential
+> [0.000000] [sd_workstation/INFO] Displaying workstation C2-06
+> [0.000000] [sd_workstation/INFO]   - power: 5000000000
+> [0.000000] [sd_workstation/INFO]   - available power: 1.00
+> [0.000000] [sd_workstation/INFO]   - access mode: Space shared
+> [0.000000] [sd_seq_access/INFO]  Change access mode of C2-06 to sequential
+> [0.000000] [sd_seq_access/INFO]  Simulation was suspended, check workstation states
+> [0.000000] [sd_workstation/INFO] Displaying workstation C2-05
+> [0.000000] [sd_workstation/INFO]   - power: 5000000000
+> [0.000000] [sd_workstation/INFO]   - available power: 1.00
+> [0.000000] [sd_workstation/INFO]   - access mode: Exclusive
+> [0.000000] [sd_workstation/INFO]     current running task: Task A
+> [0.000000] [sd_workstation/INFO] Displaying workstation C2-06
+> [0.000000] [sd_workstation/INFO]   - power: 5000000000
+> [0.000000] [sd_workstation/INFO]   - available power: 1.00
+> [0.000000] [sd_workstation/INFO]   - access mode: Exclusive
+> [0.000000] [sd_workstation/INFO]     no task running
+> [4.000000] [sd_seq_access/INFO]  Simulation was suspended, check workstation states
+> [4.000000] [sd_workstation/INFO] Displaying workstation C2-05
+> [4.000000] [sd_workstation/INFO]   - power: 5000000000
+> [4.000000] [sd_workstation/INFO]   - available power: 1.00
+> [4.000000] [sd_workstation/INFO]   - access mode: Exclusive
+> [4.000000] [sd_workstation/INFO]     current running task: Task B
+> [4.000000] [sd_workstation/INFO] Displaying workstation C2-06
+> [4.000000] [sd_workstation/INFO]   - power: 5000000000
+> [4.000000] [sd_workstation/INFO]   - available power: 1.00
+> [4.000000] [sd_workstation/INFO]   - access mode: Exclusive
+> [4.000000] [sd_workstation/INFO]     current running task: Task B
+> [10.000300] [sd_seq_access/INFO]  Simulation was suspended, check workstation states
+> [10.000300] [sd_workstation/INFO] Displaying workstation C2-05
+> [10.000300] [sd_workstation/INFO]   - power: 5000000000
+> [10.000300] [sd_workstation/INFO]   - available power: 1.00
+> [10.000300] [sd_workstation/INFO]   - access mode: Exclusive
+> [10.000300] [sd_workstation/INFO]     no task running
+> [10.000300] [sd_workstation/INFO] Displaying workstation C2-06
+> [10.000300] [sd_workstation/INFO]   - power: 5000000000
+> [10.000300] [sd_workstation/INFO]   - available power: 1.00
+> [10.000300] [sd_workstation/INFO]   - access mode: Exclusive
+> [10.000300] [sd_workstation/INFO]     current running task: Task C
+> [12.000300] [sd_seq_access/INFO]  Simulation was suspended, check workstation states
+> [12.000300] [sd_workstation/INFO] Displaying workstation C2-05
+> [12.000300] [sd_workstation/INFO]   - power: 5000000000
+> [12.000300] [sd_workstation/INFO]   - available power: 1.00
+> [12.000300] [sd_workstation/INFO]   - access mode: Exclusive
+> [12.000300] [sd_workstation/INFO]     no task running
+> [12.000300] [sd_workstation/INFO] Displaying workstation C2-06
+> [12.000300] [sd_workstation/INFO]   - power: 5000000000
+> [12.000300] [sd_workstation/INFO]   - available power: 1.00
+> [12.000300] [sd_workstation/INFO]   - access mode: Exclusive
+> [12.000300] [sd_workstation/INFO]     no task running
index 74fe314..79a7099 100644 (file)
@@ -167,7 +167,7 @@ void SD_workstation_dump(SD_workstation_t ws)
   
   XBT_INFO("Displaying workstation %s", SD_workstation_get_name(ws));
   XBT_INFO("  - power: %.0f", SD_workstation_get_power(ws));
-  XBT_INFO("  - available power: %.0f", SD_workstation_get_available_power(ws));
+  XBT_INFO("  - available power: %.2f", SD_workstation_get_available_power(ws));
   switch (ws->access_mode){
   case SD_WORKSTATION_SHARED_ACCESS:
       XBT_INFO("  - access mode: Space shared");
@@ -176,8 +176,10 @@ void SD_workstation_dump(SD_workstation_t ws)
       XBT_INFO("  - access mode: Exclusive");
          task = SD_workstation_get_current_task(ws);
          if(task)
-         XBT_INFO("    current running task: %s",
-               SD_task_get_name(task));        
+           XBT_INFO("    current running task: %s",
+                        SD_task_get_name(task));
+         else
+           XBT_INFO("    no task running");
       break;
   default:
          XBT_INFO("  - (unknown access mode)");