Deploying your Application¶
There is several ways to deploy the application you want to study on your simulated platform, i.e. to specify which actor should be started on which host. You can do so directly in your program (as shown in these examples), or using an XML deployment file. Unless you have a good reason, you should keep your application apart from the deployment as it will ease your experimental campaign afterward.
Deploying actors from XML is easy: it only involves 3 tags: <actor>,
<argument>, and <prop>. They must be placed in an
encompassing <platform>. Here is a first example (search in the
archive for files named ???_d.xml
for more):
<?xml version='1.0'?>
<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
<platform version="4.1">
<!-- The following starts an actor that runs the function `alice()` on the given host.
-- It is not given any parameter, so its args is empty.
-->
<actor host="host1" function="alice" />
<!-- The following starts another actor that runs `bob()` on host2.
-- The args of this actor contains "3" and "3000" on creation.
-->
<actor host="host2" function="bob" />
<argument value="3"/>
<argument value="3000"/>
</actor>
<!-- Carole runs on 'host3', has 1 parameter "42" in its argv and one property.
-- Use simgrid::s4u::Actor::get_property() to retrieve it.-->
<actor host="host3" function="carol">
<argument value="42"/>
<prop id="SomeProp" value="SomeValue"/>
</actor>
</platform>
<actor>¶
This tag starts a new actor executing the given function on a given host.
Parent tags: <platform> (only in deployment files)
Children tags: <argument>, <prop>
Attributes:
host
Host on which this actor should be started (mandatory).
function
Code to execute.
That function must be registered beforehand with
simgrid::s4u::Engine::register_actor()
or withsimgrid::s4u::Engine::register_function()
.If you are stuck with MSG, use
MSG_process_create()
,MSG_process_create_with_arguments()
orMSG_process_create_with_environment()
.There is nothing to do in Java, as SimGrid uses introspection abilities to retrieve the classes from their names. You must then use the full class name (including the package name) in your XML file.
start_time
Useful to delay the start of your actor.
-1 starts the actor immediately.
kill_time
Time at which the actor should be killed.
-1 means that the actor should not be killed automatically.
on_failure
What to do when the actor’s host is turned off and back on.
Either
DIE
(default – don’t restart the actor) orRESTART