1 This file follows the Doxygen syntax to be included in the
2 documentation, but it should remain readable directly.
5 @defgroup msg_examples MSG examples
7 @brief Find the MSG example fitting your needs from the extensive set provided in the archive.
13 - @ref msg_ex_tracing_user_variables
20 @section msg_ex_basics Basic examples and features
22 - <b>Ping Pong</b>: @ref examples/msg/app-pingpong/app-pingpong.c\n
23 It's hard to think of a simpler example: it is just sending one
24 message back and forth.
25 The tesh file laying in the directory show how to start the
26 simulator binary, highlighting how to pass options to the simulators
27 (as detailed in Section \ref options).
30 @ref examples/msg/app-token-ring/app-token-ring.c\n
31 Classical communication pattern, where a token is exchanged
32 along a ring to reach every participant.
33 The tesh file laying in the directory shows how to run the same
34 example on different virtual platforms.
36 - <b>Master Workers</b>.
37 @ref examples/msg/app-masterworker/app-masterworker.c\n
38 Another good old example, where one Master process has a bunch of
39 task to dispatch to a set of several Worker processes. It is fully
40 commented in @ref msg_ex_master_worker.
42 @section msg_ex_async Asynchronous communications
44 In addition to the fully documented example of @ref
45 MSG_ex_asynchronous_communications, there are several other examples
46 shipped in the archive:
48 - <b>Basic asynchronous communications</b>.
49 @ref examples/msg/async-wait/async-wait.c \n
50 Illustrates how to have non-blocking communications, that are
51 communications running in the background leaving the process free
52 to do something else during their completion. The main functions
53 involved are @ref MSG_task_isend, @ref MSG_task_irecv, and @ref
56 - <b>Waiting for all communications in a set</b>.
57 @ref examples/msg/async-waitall/async-waitall.c\n
58 The @ref MSG_comm_waitall function is useful when you want to block
59 until all activities in a given set have completed.
61 - <b>Waiting for the first completed communication in a set</b>.
62 @ref examples/msg/async-waitany/async-waitany.c\n
63 The @ref MSG_comm_waitany function is useful when you want to block
64 until one activity of the set completes, no matter which terminates
67 @section msg_ex_process Acting on Processes
69 - <b>Creating processes</b>.
70 @ref examples/msg/process-create/process-create.c \n
71 Most processes are started from the deployment XML file, but they
72 can also be used with the @ref MSG_process_create() function.
74 - <b>Controling the process life cycle from the XML</b>.
75 @ref examples/msg/process-startkilltime/process-startkilltime.c \n
76 You can specify a start time and a kill time in the deployment
77 file. See all *_d.xml files in this directory.
79 @section msg_ex_tracing Tracing and visualization features
81 Tracing can be activated by various configuration options which
82 are illustrated in these example. See also the
83 @ref tracing_tracing_options "full list of options related to tracing".
85 It is interesting to run the process-create example with the following
86 options to see the task executions:
88 - <b>Platform tracing</b>.
89 @ref examples/msg/trace-platform/trace-platform.c \n
90 This program is a toy example just loading the platform, so that
91 you can play with the platform visualization. Recommanded options:
92 @verbatim --cfg=tracing:yes --cfg=tracing/categorized:yes
95 - <b>Setting Categories</b>.
96 @ref examples/msg/trace-categories/trace-categories.c \n
97 This example declares several tracing categories
98 to that are used to classify its tasks. When the program is executed,
99 the tracing mechanism registers the resource utilization of hosts
100 and links according to these categories. Recommanded options:
101 @verbatim --cfg=tracing:yes --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes
104 - <b>Master Workers tracing</b>.
105 @ref examples/msg/trace-masterworker/trace-masterworker.c \n
106 This is an augmented version of our basic master/worker example
107 using several tracing features. It traces resource usage, sorted
108 out in several categories; Trace marks and user variables are also
109 used. Recommanded options:
110 @verbatim --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes
113 - <b>Process migration tracing</b>.
114 @ref examples/msg/trace-process-migration/trace-process-migration.c \n
115 This version is enhanced so that the process migrations can be
116 displayed as arrows in a Gantt-chart visualization. Recommanded
117 options to that extend:
118 @verbatim -cfg=tracing:yes --cfg=tracing/msg/process:yes
121 TODO: These tracing examples should be integrated in the examples to
122 not duplicate the C files. A full command line to see the result in
123 the right tool (vite/FrameSoc) should be given along with some
126 @subsection msg_ex_tracing_user_variables Tracing user variables
128 You can also attach your own variables to a any resource described in
129 the platform file. The following examples illustrate this feature.
130 They have to be run with the following options:
131 @verbatim --cfg=tracing:yes --cfg=tracing/platform:yes
134 - <b>Attaching variables to Hosts</b>.
135 @ref examples/msg/trace-host-user-variables/trace-host-user-variables.c
137 - <b>Attaching variables to Links</b>.
138 @ref examples/msg/trace-link-user-variables/trace-link-user-variables.c \n
139 The tricky part is that you have to know the name of the link you
140 want to enhance with a variable.
142 - <b>Attaching variables to network Routes</b>
143 @ref examples/msg/trace-route-user-variables/trace-route-user-variables.c \n
144 It is often easier to update a given variable for all links of a
145 given network path (identified by its source and destination
146 hosts) instead of knowing the name of each specific link.
148 @section msg_ex_models Models-related examples
150 @subsection msg_ex_ns3 NS3 as a SimGrid Network Model
152 This example demonstrates how to use the bindings to the Network
153 Simulator, as explained in @ref pls_ns3. The most
154 interesting is probably not the C files since they are unchanged from
155 the other simulations, but the associated files, such as the platform
156 file to see how to declare a platform to be used with the ns-3 bindings
157 of SimGrid and the tesh file to see how to actually start a simulation
160 - @ref examples/msg/network-ns3/network-ns3.c. Simple ping-pong using
161 ns-3 instead of the SimGrid network models.
163 TODO: merge the C files
165 TODO: show the XML files instead if it's what is interesting. On a "XML example files" page that does not exist yet.
167 @subsection msg_ex_io Simulating disks and files
169 The examples of this section demonstrate how to interact with the
172 - <b>Basic example</b>.
173 @ref examples/msg/io-storage/io-storage.c \n
174 All main storage and file functions are demoed.
176 - <b>File Management</b>. @ref examples/msg/io-file/io-file.c \n
177 This example illustrates the use of operations on file
178 (@ref MSG_file_open, @ref MSG_file_read, @ref MSG_file_write,
179 or @ref MSG_file_close).
181 - <b>Remote I/O</b>. @ref examples/msg/io-remote/io-remote.c \n
182 I/O operations can also be done in a remote, i.e. when the
183 accessed disk is not mounted on the caller's host.
185 @section msg_ex_misc Miscellaneous
187 - <b>Task priorities</b>.
188 @ref examples/msg/task-priority/task-priority.c \n
189 Demonstrates the use of @ref MSG_task_set_priority to change the
190 computation priority of a given task.
192 - <b>User-defined properties</b>.
193 @ref examples/msg/platform-properties/platform-properties.c \n
194 Attaching arbitrary information to host, processes and
195 such, and retrieving them with @ref MSG_host_get_properties,
196 @ref MSG_host_get_property_value, @ref MSG_process_get_properties, and
197 @ref MSG_process_get_property_value. Also make sure to read the
198 platform and deployment XML files to see how to declare these data.
200 TODO: Document the many other examples that we have
203 As a human, you can stop reading at this point. The rest is garbage:
205 Every example must be listed in the following, but it's not possible
206 to move this content upper as each @example directive seems to eat
207 everything until the next */ marker (and the content is placed at the
208 top of the example file).
212 @example examples/msg/app-pingpong/app-pingpong.c
213 @example examples/msg/app-token-ring/app-token-ring.c
214 @example examples/msg/app-masterworker/app-masterworker.c
216 @example examples/msg/async-wait/async-wait.c
217 @example examples/msg/async-waitall/async-waitall.c
218 @example examples/msg/async-waitany/async-waitany.c
220 @example examples/msg/process-create/process-create.c
221 @example examples/msg/process-startkilltime/process-startkilltime.c
223 @example examples/msg/trace-platform/trace-platform.c
224 @example examples/msg/trace-categories/trace-categories.c
225 @example examples/msg/trace-masterworker/trace-masterworker.c
226 @example examples/msg/trace-process-migration/trace-process-migration.c
227 @example examples/msg/trace-host-user-variables/trace-host-user-variables.c
228 @example examples/msg/trace-link-user-variables/trace-link-user-variables.c
229 @example examples/msg/trace-route-user-variables/trace-route-user-variables.c
231 @example examples/msg/network-ns3/network-ns3.c
233 @example examples/msg/io-storage/io-storage.c
234 @example examples/msg/io-file/io-file.c
235 @example examples/msg/io-remote/io-remote.c
237 @example examples/msg/task-priority/task-priority.c
238 @example examples/msg/platform-properties/platform-properties.c