Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics after integrating #229
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 15 Oct 2017 19:56:27 +0000 (21:56 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 15 Oct 2017 19:58:48 +0000 (21:58 +0200)
examples/s4u/CMakeLists.txt
examples/s4u/README.doc
examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp [new file with mode: 0644]
examples/s4u/actor-lifetime/s4u-actor-lifetime.tesh [new file with mode: 0644]
examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml [new file with mode: 0644]
examples/s4u/actor-startkilltime/s4u-actor-baseline_d.xml [deleted file]
examples/s4u/actor-startkilltime/s4u-actor-kill_d.xml [deleted file]
examples/s4u/actor-startkilltime/s4u-actor-start_d.xml [deleted file]
examples/s4u/actor-startkilltime/s4u-actor-start_kill_d.xml [deleted file]
examples/s4u/actor-startkilltime/s4u-actor-startkilltime.cpp [deleted file]
examples/s4u/actor-startkilltime/s4u-actor-startkilltime.tesh [deleted file]

index 4d14919..669aba8 100644 (file)
@@ -1,7 +1,7 @@
 foreach (example actions-comm actions-storage 
-                 actor-create actor-daemon actor-execute actor-kill actor-migration actor-suspend 
+                 actor-create actor-daemon actor-execute actor-kill actor-lifetime actor-migration actor-suspend 
                  app-masterworker app-pingpong app-token-ring
-                async-wait async-waitany async-waitall actor-startkilltime 
+                async-wait async-waitany async-waitall
                 plugin-hostload io mutex)
   add_executable       (s4u-${example}  ${example}/s4u-${example}.cpp)
   target_link_libraries(s4u-${example}  simgrid)
@@ -32,11 +32,12 @@ endforeach()
 set(examples_src  ${examples_src}                                                                          PARENT_SCOPE)
 set(tesh_files    ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord.tesh
+                                  ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/s4u-async-wait.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-waitany/s4u-async-waitany.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/s4u-async-waitall.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/actor-execute/s4u-actor-execute.tesh       
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/actor-startkilltime/s4u-actor-startkilltime.tesh         PARENT_SCOPE)
+                  PARENT_SCOPE)
 set(xml_files     ${xml_files}    ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm-split_d.xml
                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm_d.xml
                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/s4u-actions-storage_d.xml
@@ -47,10 +48,8 @@ set(xml_files     ${xml_files}    ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-a
                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/s4u-async-waitall_d.xml
                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/s4u-async-wait_d.xml
                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord_d.xml
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/actor-startkilltime/s4u-actor-baseline_d.xml
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/actor-startkilltime/s4u-actor-kill_d.xml
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/actor-startkilltime/s4u-actor-start_d.xml
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/actor-startkilltime/s4u-actor-star_kill_d.xml                PARENT_SCOPE)
+                                  ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
+                 PARENT_SCOPE)
 set(txt_files     ${txt_files}    ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm-split-p0.txt
                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm-split-p1.txt
                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm.txt
@@ -58,9 +57,9 @@ set(txt_files     ${txt_files}    ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-a
                                   ${CMAKE_CURRENT_SOURCE_DIR}/README.doc                                   PARENT_SCOPE)
 
 foreach(example actions-comm actions-storage 
-                actor-create actor-daemon actor-execute actor-kill actor-migration actor-suspend
+                actor-create actor-daemon actor-execute actor-kill actor-lifetime actor-migration actor-suspend
                 app-bittorrent app-masterworker app-pingpong app-token-ring 
-               async-wait async-waitall async-waitany actor-startkilltime
+               async-wait async-waitall async-waitany
                dht-chord plugin-hostload io mutex)
   ADD_TESH_FACTORIES(s4u-${example} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example} s4u-${example}.tesh)
 endforeach()
index 58bcb14..a3763fb 100644 (file)
@@ -86,10 +86,11 @@ documentation, but it should remain readable directly.
     @ref examples/s4u/actor-kill/s4u-actor-kill.cpp \n
     Actors can forcefully stop other actors with the @ref kill method.
 
-  - <b>Controling the actor life cycle</b>.
-    @ref examples/s4u/actor-startkilltime/s4u-actor-startkilltime.cpp \n
-    You can specify a start time and a kill time in the deployment
-    file. See all *_d.xml files in this directory.    
+  - <b>Controling the actor life cycle from the XML</b>.
+    @ref examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp 
+    @ref examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml 
+    \n
+    You can specify a start time and a kill time in the deployment file.
 
   - <b>Migrating Actors</b>.
     @ref examples/s4u/actor-migration/s4u-actor-migration.cpp \n
@@ -138,6 +139,8 @@ also the tesh files in the example directories for details.
 @example examples/s4u/actor-daemon/s4u-actor-daemon.cpp
 @example examples/s4u/actor-execute/s4u-actor-execute.cpp
 @example examples/s4u/actor-kill/s4u-actor-kill.cpp
+@example examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp 
+@example examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml 
 @example examples/s4u/actor-migration/s4u-actor-migration.cpp
 @example examples/s4u/actor-suspend/s4u-actor-suspend.cpp
 @example examples/s4u/app-token-ring/s4u-app-token-ring.cpp
diff --git a/examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp b/examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp
new file mode 100644 (file)
index 0000000..41a62d5
--- /dev/null
@@ -0,0 +1,46 @@
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/s4u.hpp"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Messages specific for this s4u example");
+
+/* Executed on process termination, to display a message helping to understand the output */
+static int my_onexit(void* ignored1, void* ignored2)
+{
+  XBT_INFO("Exiting now (done sleeping or got killed).");
+  return 0;
+}
+
+/* Just sleep until termination */
+class sleeper {
+
+public:
+  explicit sleeper(std::vector<std::string> args)
+  {
+    XBT_INFO("Hello! I go to sleep.");
+    simcall_process_on_exit(SIMIX_process_self(), my_onexit, NULL);
+
+    simgrid::s4u::this_actor::sleep_for(10);
+  }
+  void operator()() { XBT_INFO("Done sleeping."); }
+};
+
+int main(int argc, char* argv[])
+{
+  simgrid::s4u::Engine e(&argc, argv);
+
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                       "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+             argv[0], argv[0]);
+
+  e.loadPlatform(argv[1]); /* - Load the platform description */
+  e.registerFunction<sleeper>("sleeper");
+  e.loadDeployment(argv[2]); /* - Deploy the sleeper processes with explicit start/kill times */
+
+  e.run(); /* - Run the simulation */
+
+  return 0;
+}
diff --git a/examples/s4u/actor-lifetime/s4u-actor-lifetime.tesh b/examples/s4u/actor-lifetime/s4u-actor-lifetime.tesh
new file mode 100644 (file)
index 0000000..9b525ce
--- /dev/null
@@ -0,0 +1,14 @@
+#! ./tesh
+
+$ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-lifetime ${srcdir:=.}/cluster.xml ${srcdir:=.}/../s4u/actor-lifetime/s4u-actor-lifetime_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:sleeper@node-0.acme.org) Hello! I go to sleep.
+> [  0.000000] (2:sleeper@node-1.acme.org) Hello! I go to sleep.
+> [  2.000000] (3:sleeper@node-0.acme.org) Hello! I go to sleep.
+> [  3.000000] (2:sleeper@node-1.acme.org) Exiting now (done sleeping or got killed).
+> [  4.000000] (4:sleeper@node-2.acme.org) Hello! I go to sleep.
+> [  7.000000] (4:sleeper@node-2.acme.org) Exiting now (done sleeping or got killed).
+> [ 10.000000] (1:sleeper@node-0.acme.org) Done sleeping.
+> [ 10.000000] (1:sleeper@node-0.acme.org) Exiting now (done sleeping or got killed).
+> [ 12.000000] (3:sleeper@node-0.acme.org) Done sleeping.
+> [ 12.000000] (3:sleeper@node-0.acme.org) Exiting now (done sleeping or got killed).
+
diff --git a/examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml b/examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml
new file mode 100644 (file)
index 0000000..c69e987
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
+
+<!-- This shows how to use the start_time and kill_time attributes of <actors> -->
+
+<platform version="4.1">
+  <actor host="node-0.acme.org" function="sleeper"                              />
+  <actor host="node-0.acme.org" function="sleeper" start_time="2"               />
+  <actor host="node-1.acme.org" function="sleeper"                kill_time="3" />
+  <actor host="node-2.acme.org" function="sleeper" start_time="4" kill_time="7" />
+</platform>
diff --git a/examples/s4u/actor-startkilltime/s4u-actor-baseline_d.xml b/examples/s4u/actor-startkilltime/s4u-actor-baseline_d.xml
deleted file mode 100644 (file)
index e24cced..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4.1">
-  <!-- Just sleeps for 10 seconds and quits -->
-  <actor host="node-0.acme.org" function="sleeper">  
-    <argument value="10"/>
-  </actor>
-</platform>
diff --git a/examples/s4u/actor-startkilltime/s4u-actor-kill_d.xml b/examples/s4u/actor-startkilltime/s4u-actor-kill_d.xml
deleted file mode 100644 (file)
index 6d7d312..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4.1">
-  <actor host="node-1.acme.org" function="sleeper" kill_time="6">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-2.acme.org" function="sleeper" kill_time="6">
-    <argument value="6"/>
-  </actor>
-  <actor host="node-3.acme.org" function="sleeper" kill_time="10"> 
-    <argument value="6"/>
-  </actor>
-</platform>
diff --git a/examples/s4u/actor-startkilltime/s4u-actor-start_d.xml b/examples/s4u/actor-startkilltime/s4u-actor-start_d.xml
deleted file mode 100644 (file)
index 3d6934b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4.1">
-  <actor host="node-0.acme.org" function="sleeper" start_time="0">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-1.acme.org" function="sleeper" start_time="1">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-2.acme.org" function="sleeper" start_time="2">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-3.acme.org" function="sleeper" start_time="3">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-4.acme.org" function="sleeper" start_time="4">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-5.acme.org" function="sleeper" start_time="5">
-    <argument value="10"/>
-  </actor>
-</platform>
diff --git a/examples/s4u/actor-startkilltime/s4u-actor-start_kill_d.xml b/examples/s4u/actor-startkilltime/s4u-actor-start_kill_d.xml
deleted file mode 100644 (file)
index 7292ca2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4.1">
-  <actor host="node-0.acme.org" function="sleeper" start_time="0" kill_time="5">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-1.acme.org" function="sleeper" start_time="1" kill_time="6">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-2.acme.org" function="sleeper" start_time="2" kill_time="7">
-    <argument value="4" />
-  </actor>
-  <actor host="node-3.acme.org" function="sleeper" start_time="3" kill_time="8">
-    <argument value="4" />
-  </actor>
-  <actor host="node-4.acme.org" function="sleeper" start_time="4" kill_time="9">
-    <argument value="5" />
-  </actor>
-  <actor host="node-5.acme.org" function="sleeper" start_time="5" kill_time="10">
-    <argument value="5"/>
-  </actor>
-</platform>
diff --git a/examples/s4u/actor-startkilltime/s4u-actor-startkilltime.cpp b/examples/s4u/actor-startkilltime/s4u-actor-startkilltime.cpp
deleted file mode 100644 (file)
index f8ba252..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved.          */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
- #include "simgrid/s4u.hpp"
- #include <cstdlib>
- #include <iostream>
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-
-/* Executed on process termination*/
-static int my_onexit(void* ignored1, void *ignored2) {
-  XBT_INFO("Exiting now (done sleeping or got killed)."); /* - Just display an informative message (see tesh file) */
-  return 0;
-}
-
-/* Just sleep until termination */
-class sleeper {
-
-public:
-  explicit sleeper(std::vector<std::string> args)
-{
-  XBT_INFO("Hello! I go to sleep.");
-  simcall_process_on_exit(SIMIX_process_self(), my_onexit, NULL);
-
-  simgrid::s4u::this_actor::sleep_for(std::stoi(args[1]));
-
-}
-void operator()()
-{
-  XBT_INFO("Done sleeping.");
-}
-};
-
-int main(int argc, char *argv[])
-{
-  simgrid::s4u::Engine e(&argc, argv);
-
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-             "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
-
-  e.loadPlatform(argv[1]);            /* - Load the platform description */
-  e.registerFunction<sleeper>("sleeper");
-  e.loadDeployment(argv[2]);   /* - Deploy the sleeper processes with explicit start/kill times */
-
-  e.run();                           /* - Run the simulation */
-
-  XBT_INFO("Simulation time %g", SIMIX_get_clock());
-  return 0;
-}
diff --git a/examples/s4u/actor-startkilltime/s4u-actor-startkilltime.tesh b/examples/s4u/actor-startkilltime/s4u-actor-startkilltime.tesh
deleted file mode 100644 (file)
index f8e7b5c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#! ./tesh
-
-p Test0 actor without time
-
-$ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-startkilltime ${srcdir:=.}/cluster.xml ${srcdir:=.}/../s4u/actor-startkilltime/s4u-actor-baseline_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:sleeper@node-0.acme.org) Hello! I go to sleep.
-> [ 10.000000] (1:sleeper@node-0.acme.org) Done sleeping.
-> [ 10.000000] (1:sleeper@node-0.acme.org) Exiting now (done sleeping or got killed).
-> [ 10.000000] (0:maestro@) Simulation time 10
-
-p Test1 actor with start time
-
-$ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-startkilltime ${srcdir:=.}/cluster.xml ${srcdir:=.}/../s4u/actor-startkilltime/s4u-actor-start_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:sleeper@node-0.acme.org) Hello! I go to sleep.
-> [  1.000000] (2:sleeper@node-1.acme.org) Hello! I go to sleep.
-> [  2.000000] (3:sleeper@node-2.acme.org) Hello! I go to sleep.
-> [  3.000000] (4:sleeper@node-3.acme.org) Hello! I go to sleep.
-> [  4.000000] (5:sleeper@node-4.acme.org) Hello! I go to sleep.
-> [  5.000000] (6:sleeper@node-5.acme.org) Hello! I go to sleep.
-> [ 10.000000] (1:sleeper@node-0.acme.org) Done sleeping.
-> [ 10.000000] (1:sleeper@node-0.acme.org) Exiting now (done sleeping or got killed).
-> [ 11.000000] (2:sleeper@node-1.acme.org) Done sleeping.
-> [ 11.000000] (2:sleeper@node-1.acme.org) Exiting now (done sleeping or got killed).
-> [ 12.000000] (3:sleeper@node-2.acme.org) Done sleeping.
-> [ 12.000000] (3:sleeper@node-2.acme.org) Exiting now (done sleeping or got killed).
-> [ 13.000000] (4:sleeper@node-3.acme.org) Done sleeping.
-> [ 13.000000] (4:sleeper@node-3.acme.org) Exiting now (done sleeping or got killed).
-> [ 14.000000] (5:sleeper@node-4.acme.org) Done sleeping.
-> [ 14.000000] (5:sleeper@node-4.acme.org) Exiting now (done sleeping or got killed).
-> [ 15.000000] (6:sleeper@node-5.acme.org) Done sleeping.
-> [ 15.000000] (6:sleeper@node-5.acme.org) Exiting now (done sleeping or got killed).
-> [ 15.000000] (0:maestro@) Simulation time 15
-
-p Test1 actor with kill time
-
-$ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-startkilltime ${srcdir:=.}/cluster.xml ${srcdir:=.}/../s4u/actor-startkilltime/s4u-actor-kill_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:sleeper@node-1.acme.org) Hello! I go to sleep.
-> [  0.000000] (2:sleeper@node-2.acme.org) Hello! I go to sleep.
-> [  0.000000] (3:sleeper@node-3.acme.org) Hello! I go to sleep.
-> [  6.000000] (1:sleeper@node-1.acme.org) Exiting now (done sleeping or got killed).
-> [  6.000000] (2:sleeper@node-2.acme.org) Exiting now (done sleeping or got killed).
-> [  6.000000] (3:sleeper@node-3.acme.org) Done sleeping.
-> [  6.000000] (3:sleeper@node-3.acme.org) Exiting now (done sleeping or got killed).
-> [  6.000000] (0:maestro@) Simulation time 6
-
-p Test2 actor with start and kill times
-
-$ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-startkilltime ${srcdir:=.}/cluster.xml ${srcdir:=.}/../s4u/actor-startkilltime/s4u-actor-start_kill_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:sleeper@node-0.acme.org) Hello! I go to sleep.
-> [  1.000000] (2:sleeper@node-1.acme.org) Hello! I go to sleep.
-> [  2.000000] (3:sleeper@node-2.acme.org) Hello! I go to sleep.
-> [  3.000000] (4:sleeper@node-3.acme.org) Hello! I go to sleep.
-> [  4.000000] (5:sleeper@node-4.acme.org) Hello! I go to sleep.
-> [  5.000000] (1:sleeper@node-0.acme.org) Exiting now (done sleeping or got killed).
-> [  5.000000] (6:sleeper@node-5.acme.org) Hello! I go to sleep.
-> [  6.000000] (2:sleeper@node-1.acme.org) Exiting now (done sleeping or got killed).
-> [  6.000000] (3:sleeper@node-2.acme.org) Done sleeping.
-> [  6.000000] (3:sleeper@node-2.acme.org) Exiting now (done sleeping or got killed).
-> [  7.000000] (4:sleeper@node-3.acme.org) Done sleeping.
-> [  7.000000] (4:sleeper@node-3.acme.org) Exiting now (done sleeping or got killed).
-> [  9.000000] (5:sleeper@node-4.acme.org) Exiting now (done sleeping or got killed).
-> [ 10.000000] (6:sleeper@node-5.acme.org) Exiting now (done sleeping or got killed).
-> [ 10.000000] (0:maestro@) Simulation time 10