Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #228 from Takishipp/actor-execute
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 15 Oct 2017 14:37:30 +0000 (16:37 +0200)
committerGitHub <noreply@github.com>
Sun, 15 Oct 2017 14:37:30 +0000 (16:37 +0200)
Convert actor-execute to s4u API

examples/s4u/CMakeLists.txt
examples/s4u/README.doc
examples/s4u/actor-execute/BuilSimGrid.sh.log* [new file with mode: 0644]
examples/s4u/actor-execute/s4u-actor-execute.cpp [new file with mode: 0644]
examples/s4u/actor-execute/s4u-actor-execute.tesh [new file with mode: 0644]

index 0ee6b1e..933e55d 100644 (file)
@@ -2,6 +2,7 @@ foreach (example actions-comm actions-storage
                  actor-create actor-daemon actor-kill actor-migration actor-suspend 
                  app-masterworker app-pingpong app-token-ring
                 async-wait async-waitany async-waitall
+     actor-execute 
                 plugin-hostload io mutex)
   add_executable       (s4u-${example}  ${example}/s4u-${example}.cpp)
   target_link_libraries(s4u-${example}  simgrid)
@@ -34,7 +35,8 @@ set(tesh_files    ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u
                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord.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         PARENT_SCOPE)
+                                  ${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/s4u-async-waitall.tesh
+                                  ${CMAKE_CURRENT_SOURCE_DIR}/process-create/s4u-actor-execute.tesh         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
@@ -55,6 +57,7 @@ foreach(example actions-comm actions-storage
                 actor-create actor-daemon actor-kill actor-migration actor-suspend
                 app-bittorrent app-masterworker app-pingpong app-token-ring 
                async-wait async-waitall async-waitany
+    actor-execute 
                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 97be9a1..9766f81 100644 (file)
@@ -25,6 +25,10 @@ documentation, but it should remain readable directly.
     @ref examples/s4u/actor-create/s4u-actor-create_d.xml \n
     Shows how to start your actors to populate your simulation.
 
+  - <b>Excute actors</b>. 
+    @ref examples/s4u/process-create/s4u-process-create.cpp \n
+    Most processes are started from the deployment XML file.     
+
   - <b>Ping Pong</b>: @ref examples/s4u/app-pingpong/s4u-app-pingpong.c\n
    It's hard to think of a simpler example: it is just sending one message back and forth.
    The tesh file laying in the directory show how to start the simulator binary, highlighting how to pass options to 
@@ -57,7 +61,7 @@ documentation, but it should remain readable directly.
    @ref examples/s4u/async-waitany/s4u-async-waitany.cpp\n
    The @ref simgrid::s4u::Comm::wait_any() function is useful when you want to block
    until one activity of the set completes, no matter which terminates
-   first.   
+   first.    
 
 @section s4u_ex_actors Acting on Actors
 
diff --git a/examples/s4u/actor-execute/BuilSimGrid.sh.log* b/examples/s4u/actor-execute/BuilSimGrid.sh.log*
new file mode 100644 (file)
index 0000000..d6109fa
--- /dev/null
@@ -0,0 +1,3 @@
+make: *** No targets specified and no makefile found.  Stop.
+make: *** No targets specified and no makefile found.  Stop.
+vendredi 6 octobre 2017, 16:34:15 (UTC+0200)
diff --git a/examples/s4u/actor-execute/s4u-actor-execute.cpp b/examples/s4u/actor-execute/s4u-actor-execute.cpp
new file mode 100644 (file)
index 0000000..26fc7d1
--- /dev/null
@@ -0,0 +1,30 @@
+/* Copyright (c) 2010-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"
+ #include <cstdlib>
+ #include <iostream>
+
+/* Main function of the actor I want to start manually */
+static int actor_function(std::vector<std::string> args)
+{
+  simgrid::s4u::this_actor::execute(100);
+  return 0;
+}
+
+int main(int argc, char *argv[])
+{
+  simgrid::s4u::Engine e(&argc, argv);
+  std::vector<std::string> args;
+  xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+
+  e.loadPlatform(argv[1]); 
+  
+  simgrid::s4u::Actor::createActor("simple_func", simgrid::s4u::Host::by_name("Tremblay"), actor_function, args);
+
+  e.run();
+
+  return 0;
+}
diff --git a/examples/s4u/actor-execute/s4u-actor-execute.tesh b/examples/s4u/actor-execute/s4u-actor-execute.tesh
new file mode 100644 (file)
index 0000000..e4575eb
--- /dev/null
@@ -0,0 +1,4 @@
+#! ./tesh
+
+p Start remote processes 
+$ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-execute$EXEEXT ${srcdir:=.}/small_platform.xml