1 S4U (Simgrid for you) is the next interface of SimGrid, expected to be released with SimGrid 4.0.
3 Even if it's in a very preliminary state so far, you are welcome to
4 try it and report any interface glitches that you see. Be however
5 warned that the interface will be modified until its final release.
6 You will have to adapt your code on the way.
8 This file follows the Doxygen syntax to be included in the
9 documentation, but it should remain readable directly.
12 @defgroup s4u_examples S4U examples
14 @brief Find the S4U example fitting your needs in the archive.
22 @section s4u_ex_basics Basics of SimGrid simulation
24 - <b>Creating actors:</b> @ref examples/s4u/actor-create/s4u_actor-create.cpp and
25 @ref examples/s4u/actor-create/s4u_actor-create_d.xml \n
26 Shows how to start your actors to populate your simulation.
28 - <b>Ping Pong</b>: @ref examples/s4u/app-pingpong/s4u_app-pingpong.c\n
29 It's hard to think of a simpler example: it is just sending one message back and forth.
30 The tesh file laying in the directory show how to start the simulator binary, highlighting how to pass options to
31 the simulators (as detailed in Section \ref options).
33 - <b>Token ring:</b> @ref examples/s4u/app-token-ring/s4u_app-token-ring.cpp \n
34 Shows how to implement a classical communication pattern, where a token is exchanged along a ring to reach every
37 - <b>Master Workers:</b> @ref examples/s4u/app-masterworker/s4u_app-masterworker.cpp \n
38 Another good old example, where one Master process has a bunch of task to dispatch to a set of several Worker
41 @section msg_ex_async Asynchronous communications
43 - <b>Waiting for all communications in a set</b>.
44 @ref examples/s4u/async-waitall/s4u_async-waitall.cpp\n
45 The @ref S4U_comm_waitall function is useful when you want to block
46 until all activities in a given set have completed.
48 - <b>Waiting for the first completed communication in a set</b>.
49 @ref examples/s4u/async-waitany/s4u_async-waitany.cpp\n
50 The @ref S4U_comm_waitany function is useful when you want to block
51 until one activity of the set completes, no matter which terminates
54 @section s4u_ex_actors Acting on Actors
56 - <b>Creating actors</b>.
57 @ref examples/s4u/actor-create/s4u_actor-create.cpp \n
58 Most actors are started from the deployment XML file, but they exist other methods.
60 - <b>Daemonize actors</b>
61 @ref examples/s4u/actor-daemon/s4u_actor-daemon.cpp \n
62 Some actors may be intended to simulate daemons that run in background. This example show how to transform a regular
63 actor into a daemon that will be automatically killed once the simulation is over.
65 - <b>Suspend and Resume actors</b>.
66 @ref examples/s4u/actor-suspend/s4u_actor-suspend.cpp \n
67 Actors can be suspended and resumed during their executions
68 thanks to the @ref suspend and @ref resume methods.
71 @ref examples/s4u/actor-kill/s4u_actor-kill.cpp \n
72 Actors can forcefully stop other actors with the @ref kill method.
74 - <b>Migrating Actors</b>.
75 @ref examples/s4u/actor-migration/s4u_actor-migration.cpp \n
76 Actors can move or be moved from a host to another with the @ref migrate method.
78 @section s4u_ex_synchro Inter-Actor Synchronization
80 - <b>Mutex: </b> @ref examples/s4u/mutex/s4u_mutex.cpp \n
81 Shows how to use simgrid::s4u::Mutex synchronization objects.
83 @section s4u_ex_actions Following Workload Traces
85 This section details how to run trace-driven simulations. It is very
86 handy when you want to test an algorithm or protocol that only react
87 to external events. For example, many P2P protocols react to user
88 requests, but do nothing if there is no such event.
90 In such situations, you should write your protocol in C++, and separate
91 the workload that you want to play onto your protocol in a separate
92 text file. Declare a function handling each type of the events in your
93 trace, register them using @ref xbt_replay_action_register in your
94 main, and then run the simulation.
96 Then, you can either have one trace file containing all your events,
97 or a file per simulated process: the former may be easier to work
98 with, but the second is more efficient on very large traces. Check
99 also the tesh files in the example directories for details.
101 - <b>Communication replay</b>.
102 @ref examples/s4u/actions-comm/s4u_actions-comm.cpp \n
103 Presents a set of event handlers reproducing classical communication
104 primitives (asynchronous send/receive at the moment).
107 @ref examples/s4u/actions-storage/s4u_actions-storage.cpp \n
108 Presents a set of event handlers reproducing classical I/O
109 primitives (open, read, close).
114 @example examples/s4u/actions-comm/s4u_actions-comm.cpp
115 @example examples/s4u/actions-storage/s4u_actions-storage.cpp
116 @example examples/s4u/actor-create/s4u_actor-create.cpp
117 @example examples/s4u/actor-create/s4u_actor-create_d.xml
118 @example examples/s4u/actor-daemon/s4u_actor-daemon.cpp
119 @example examples/s4u/actor-kill/s4u_actor-kill.cpp
120 @example examples/s4u/actor-migration/s4u_actor-migration.cpp
121 @example examples/s4u/actor-suspend/s4u_actor-suspend.cpp
122 @example examples/s4u/app-token-ring/s4u_app-token-ring.cpp
123 @example examples/s4u/app-masterworker/s4u_app-masterworker.cpp
124 @example examples/s4u/app-pingpong/s4u_app-pingpong.cpp
126 @example examples/s4u/mutex/s4u_mutex.cpp