Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
0e5654a04c7433b37e335482bdbb0cdb59a18128
[simgrid.git] / examples / msg / README.doc
1 This file follows the Doxygen syntax to be included in the
2 documentation, but it should remain readable directly.
3
4 /** 
5  @defgroup msg_examples MSG examples
6  @ingroup MSG_API
7  @brief Find the MSG example fitting your needs from the extensive set provided in the archive.
8
9   - @ref msg_ex_basics
10   - @ref msg_ex_async
11   - @ref msg_ex_process
12   - @ref msg_ex_tracing
13     - @ref msg_ex_tracing_user_variables
14   - @ref msg_ex_models
15     - @ref msg_ex_ns3
16     - @ref msg_ex_io
17   - @ref msg_ex_apps
18   - @ref msg_ex_misc
19
20 @section msg_ex_basics Basic examples and features
21
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). 
28
29  - <b>Token Ring</b>.
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.
35
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.
41
42 @section msg_ex_async Asynchronous communications
43
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:
47   
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
54    MSG_comm_wait.
55  
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.
60    
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
65    first.
66    
67 @section msg_ex_process Acting on Processes
68
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.
73
74   - <b>Suspend and Resume processes</b>.
75     @ref examples/msg/process-suspend/process-suspend.c \n
76     Processes can be suspended and resumed during their executions
77     thanks to the @ref MSG_process_suspend and @ref MSG_process_resume functions.
78
79   - <b>Kill processes</b>.
80     @ref examples/msg/process-kill/process-kill.c \n
81     Processes can forcefully stop other processes with the @ref MSG_process_kill function.
82      
83   - <b>Migrating processes</b>.
84     @ref examples/msg/process-migration/process-migration.c \n
85     Processes can move or be moved from a host to another with the @ref MSG_process_migrate function.
86     
87   - <b>Yielding to other processes</b>.
88     @ref examples/msg/process-yield/process-yield.c\n
89     The @ref MSG_process_yield function interrupts the execution of the
90     current process, leaving a chance to run to the other processes
91     that are ready to run at the exact same timestamp
92
93   - <b>Controling the process life cycle from the XML</b>.
94     @ref examples/msg/process-startkilltime/process-startkilltime.c \n
95     You can specify a start time and a kill time in the deployment
96     file. See all *_d.xml files in this directory.
97
98 @section msg_ex_tracing Tracing and visualization features
99
100 Tracing can be activated by various configuration options which
101 are illustrated in these example. See also the 
102 @ref tracing_tracing_options "full list of options related to tracing".
103
104 It is interesting to run the process-create example with the following
105 options to see the task executions:
106
107   - <b>Platform tracing</b>.
108     @ref examples/msg/trace-platform/trace-platform.c \n
109     This program is a toy example just loading the platform, so that
110     you can play with the platform visualization. Recommanded options:
111     @verbatim --cfg=tracing:yes --cfg=tracing/categorized:yes
112     @endverbatim
113
114   - <b>Setting Categories</b>.
115     @ref examples/msg/trace-categories/trace-categories.c \n
116     This example declares several tracing categories
117     to that are used to classify its tasks. When the program is executed,
118     the tracing mechanism registers the resource utilization of hosts
119     and links according to these categories. Recommanded options:
120     @verbatim --cfg=tracing:yes --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes --cfg=viva/categorized:viva_cat.plist --cfg=viva/uncategorized:viva_uncat.plist
121     @endverbatim
122     
123   - <b>Master Workers tracing</b>.
124     @ref examples/msg/trace-masterworker/trace-masterworker.c \n
125     This is an augmented version of our basic master/worker example
126     using several tracing features. It traces resource usage, sorted
127     out in several categories; Trace marks and user variables are also
128     used. Recommanded options:
129     @verbatim --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes --cfg=viva/categorized:viva_cat.plist --cfg=viva/uncategorized:viva_uncat.plist
130     @endverbatim
131     
132   - <b>Process migration tracing</b>.
133     @ref examples/msg/trace-process-migration/trace-process-migration.c \n
134     This version is enhanced so that the process migrations can be
135     displayed as arrows in a Gantt-chart visualization. Recommanded
136     options to that extend:
137     @verbatim -cfg=tracing:yes --cfg=tracing/msg/process:yes
138     @endverbatim     
139
140 TODO: These tracing examples should be integrated in the examples to
141 not duplicate the C files. A full command line to see the result in
142 the right tool (viva/vite/FrameSoc) should be given along with some
143 screenshots.
144
145 @subsection msg_ex_tracing_user_variables Tracing user variables
146
147 You can also attach your own variables to a any resource described in
148 the platform file. The following examples illustrate this feature.
149 They have to be run with the following options:
150 @verbatim --cfg=tracing:yes --cfg=tracing/platform:yes
151 @endverbatim
152
153   - <b>Attaching variables to Hosts</b>.
154     @ref examples/msg/trace-host-user-variables/trace-host-user-variables.c 
155
156   - <b>Attaching variables to Links</b>.
157     @ref examples/msg/trace-link-user-variables/trace-link-user-variables.c \n
158     The tricky part is that you have to know the name of the link you
159     want to enhance with a variable.
160
161   - <b>Attaching variables to network Routes</b>
162     @ref examples/msg/trace-route-user-variables/trace-route-user-variables.c \n
163     It is often easier to update a given variable for all links of a
164     given network path (identified by its source and destination
165     hosts) instead of knowing the name of each specific link.
166
167 @section msg_ex_models Models-related examples
168
169 @subsection msg_ex_ns3 NS3 as a SimGrid Network Model
170
171 This example demonstrates how to use the bindings to the Network
172 Simulator, as explained in @ref pls_ns3. The most
173 interesting is probably not the C files since they are unchanged from
174 the other simulations, but the associated files, such as the platform
175 file to see how to declare a platform to be used with the ns-3 bindings
176 of SimGrid and the tesh file to see how to actually start a simulation
177 in these settings.
178   
179   - @ref examples/msg/network-ns3/network-ns3.c. Simple ping-pong using
180     ns-3 instead of the SimGrid network models.
181
182 TODO: merge the C files
183
184 TODO: show the XML files instead if it's what is interesting. On a "XML example files" page that does not exist yet.
185
186 @subsection msg_ex_io Simulating disks and files
187
188 The examples of this section demonstrate how to interact with the
189 simulated storages.
190
191   - <b>Basic example</b>.
192     @ref examples/msg/io-storage/io-storage.c \n
193     All main storage and file functions are demoed.
194     
195   - <b>File Management</b>. @ref examples/msg/io-file/io-file.c \n
196     This example illustrates the use of operations on file
197     (@ref MSG_file_open, @ref MSG_file_read, @ref MSG_file_write,
198     or @ref MSG_file_close).
199     
200   - <b>Remote I/O</b>. @ref examples/msg/io-remote/io-remote.c \n
201     I/O operations can also be done in a remote, i.e. when the
202     accessed disk is not mounted on the caller's host.
203
204 @section msg_ex_misc Miscellaneous
205
206  - <b>Task priorities</b>.
207    @ref examples/msg/task-priority/task-priority.c \n
208    Demonstrates the use of @ref MSG_task_set_priority to change the
209    computation priority of  a given task.
210
211  - <b>User-defined properties</b>.
212    @ref examples/msg/platform-properties/platform-properties.c \n
213    Attaching arbitrary information to host, processes and
214    such, and retrieving them with @ref MSG_host_get_properties,
215    @ref MSG_host_get_property_value, @ref MSG_process_get_properties, and 
216    @ref MSG_process_get_property_value. Also make sure to read the
217    platform and deployment XML files to see how to declare these data.
218  
219 TODO: Document the many other examples that we have 
220 */
221
222 As a human, you can stop reading at this point. The rest is garbage:
223
224 Every example must be listed in the following, but it's not possible
225 to move this content upper as each @example directive seems to eat
226 everything until the next */ marker (and the content is placed at the
227 top of the example file). 
228
229
230 /**
231 @example examples/msg/app-pingpong/app-pingpong.c
232 @example examples/msg/app-token-ring/app-token-ring.c
233 @example examples/msg/app-masterworker/app-masterworker.c
234
235 @example examples/msg/async-wait/async-wait.c
236 @example examples/msg/async-waitall/async-waitall.c
237 @example examples/msg/async-waitany/async-waitany.c
238 @example examples/msg/async-yield/async-yield.c
239
240 @example examples/msg/process-create/process-create.c
241 @example examples/msg/process-suspend/process-suspend.c
242 @example examples/msg/process-kill/process-kill.c
243 @example examples/msg/process-migration/process-migration.c
244 @example examples/msg/process-startkilltime/process-startkilltime.c
245
246 @example examples/msg/trace-platform/trace-platform.c
247 @example examples/msg/trace-categories/trace-categories.c
248 @example examples/msg/trace-masterworker/trace-masterworker.c
249 @example examples/msg/trace-process-migration/trace-process-migration.c
250 @example examples/msg/trace-host-user-variables/trace-host-user-variables.c
251 @example examples/msg/trace-link-user-variables/trace-link-user-variables.c
252 @example examples/msg/trace-route-user-variables/trace-route-user-variables.c
253
254 @example examples/msg/network-ns3/network-ns3.c
255
256 @example examples/msg/io-storage/io-storage.c
257 @example examples/msg/io-file/io-file.c
258 @example examples/msg/io-remote/io-remote.c
259
260 @example examples/msg/task-priority/task-priority.c
261 @example examples/msg/platform-properties/platform-properties.c
262
263 */
264