Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'Takishipp-energy-pstate'
[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_process
11   - @ref msg_ex_tracing
12     - @ref msg_ex_tracing_user_variables
13   - @ref msg_ex_models
14     - @ref msg_ex_ns3
15     - @ref msg_ex_io
16   - @ref msg_ex_apps
17   - @ref msg_ex_misc
18
19 @section msg_ex_basics Basic examples and features
20
21  - <b>Ping Pong</b>: @ref examples/msg/app-pingpong/app-pingpong.c\n
22    It's hard to think of a simpler example: it is just sending one
23    message back and forth.  
24    The tesh file laying in the directory show how to start the
25    simulator binary, highlighting how to pass options to the simulators
26    (as detailed in Section \ref options). 
27
28  - <b>Token Ring</b>.
29    @ref examples/msg/app-token-ring/app-token-ring.c\n
30    Classical communication pattern, where a token is exchanged
31    along a ring to reach every participant. 
32    The tesh file laying in the directory shows how to run the same
33    example on different virtual platforms.
34
35  - <b>Master Workers</b>.
36    @ref examples/msg/app-masterworker/app-masterworker.c\n
37    Another good old example, where one Master process has a bunch of
38    task to dispatch to a set of several Worker processes. It is fully
39    commented in @ref msg_ex_master_worker.
40
41 @section msg_ex_process Acting on Processes
42
43   - <b>Creating processes</b>. 
44     @ref examples/msg/process-create/process-create.c \n
45     Most processes are started from the deployment XML file, but they
46     can also be used with the @ref MSG_process_create() function.
47
48   - <b>Controling the process life cycle from the XML</b>.
49     @ref examples/msg/process-startkilltime/process-startkilltime.c \n
50     You can specify a start time and a kill time in the deployment
51     file. See all *_d.xml files in this directory.
52
53   - <b>Using Pstates on a host</b>
54     @ref examples/msg/energy-pstate/energy-pstate.c\n
55     Show how define a set of pstates for a host and how the current
56     pstate can be accessed/changed with @ref MSG_get_host_current_power_peak and @ref  MSG_set_host_pstate.
57     See also the platform XML file for have a details on how to declare the CPU capacity for each pstate.
58
59 @section msg_ex_tracing Tracing and visualization features
60
61 Tracing can be activated by various configuration options which
62 are illustrated in these example. See also the 
63 @ref tracing_tracing_options "full list of options related to tracing".
64
65 It is interesting to run the process-create example with the following
66 options to see the task executions:
67
68   - <b>Platform tracing</b>.
69     @ref examples/msg/trace-platform/trace-platform.c \n
70     This program is a toy example just loading the platform, so that
71     you can play with the platform visualization. Recommanded options:
72     @verbatim --cfg=tracing:yes --cfg=tracing/categorized:yes
73     @endverbatim
74
75   - <b>Setting Categories</b>.
76     @ref examples/msg/trace-categories/trace-categories.c \n
77     This example declares several tracing categories
78     to that are used to classify its tasks. When the program is executed,
79     the tracing mechanism registers the resource utilization of hosts
80     and links according to these categories. Recommanded options:
81     @verbatim --cfg=tracing:yes --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes
82     @endverbatim
83     
84   - <b>Master Workers tracing</b>.
85     @ref examples/msg/trace-masterworker/trace-masterworker.c \n
86     This is an augmented version of our basic master/worker example
87     using several tracing features. It traces resource usage, sorted
88     out in several categories; Trace marks and user variables are also
89     used. Recommanded options:
90     @verbatim --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes
91     @endverbatim
92     
93   - <b>Process migration tracing</b>.
94     @ref examples/msg/trace-process-migration/trace-process-migration.c \n
95     This version is enhanced so that the process migrations can be
96     displayed as arrows in a Gantt-chart visualization. Recommanded
97     options to that extend:
98     @verbatim -cfg=tracing:yes --cfg=tracing/msg/process:yes
99     @endverbatim 
100     
101 TODO: These tracing examples should be integrated in the examples to
102 not duplicate the C files. A full command line to see the result in
103 the right tool (vite/FrameSoc) should be given along with some
104 screenshots.
105
106 @subsection msg_ex_tracing_user_variables Tracing user variables
107
108 You can also attach your own variables to a any resource described in
109 the platform file. The following examples illustrate this feature.
110 They have to be run with the following options:
111 @verbatim --cfg=tracing:yes --cfg=tracing/platform:yes
112 @endverbatim
113
114   - <b>Attaching variables to Hosts</b>.
115     @ref examples/msg/trace-host-user-variables/trace-host-user-variables.c 
116
117   - <b>Attaching variables to Links</b>.
118     @ref examples/msg/trace-link-user-variables/trace-link-user-variables.c \n
119     The tricky part is that you have to know the name of the link you
120     want to enhance with a variable.
121
122   - <b>Attaching variables to network Routes</b>
123     @ref examples/msg/trace-route-user-variables/trace-route-user-variables.c \n
124     It is often easier to update a given variable for all links of a
125     given network path (identified by its source and destination
126     hosts) instead of knowing the name of each specific link.
127
128 @section msg_ex_models Models-related examples
129
130 @subsection msg_ex_ns3 NS3 as a SimGrid Network Model
131
132 This example demonstrates how to use the bindings to the Network
133 Simulator, as explained in @ref pls_ns3. The most
134 interesting is probably not the C files since they are unchanged from
135 the other simulations, but the associated files, such as the platform
136 file to see how to declare a platform to be used with the ns-3 bindings
137 of SimGrid and the tesh file to see how to actually start a simulation
138 in these settings.
139   
140   - @ref examples/msg/network-ns3/network-ns3.c. Simple ping-pong using
141     ns-3 instead of the SimGrid network models.
142
143 TODO: merge the C files
144
145 TODO: show the XML files instead if it's what is interesting. On a "XML example files" page that does not exist yet.
146
147 @subsection msg_ex_io Simulating disks and files
148
149 The examples of this section demonstrate how to interact with the
150 simulated storages.
151
152   - <b>File Management</b>. @ref examples/msg/io-file/io-file.c \n
153     This example illustrates the use of operations on file
154     (@ref MSG_file_open, @ref MSG_file_read, @ref MSG_file_write,
155     or @ref MSG_file_close).
156     
157   - <b>Remote I/O</b>. @ref examples/msg/io-remote/io-remote.c \n
158     I/O operations can also be done in a remote, i.e. when the
159     accessed disk is not mounted on the caller's host.
160
161 @section msg_ex_misc Miscellaneous
162
163  - <b>Task priorities</b>.
164    @ref examples/msg/task-priority/task-priority.c \n
165    Demonstrates the use of @ref MSG_task_set_priority to change the
166    computation priority of  a given task.
167
168  - <b>User-defined properties</b>.
169    @ref examples/msg/platform-properties/platform-properties.c \n
170    Attaching arbitrary information to host, processes and
171    such, and retrieving them with @ref MSG_host_get_properties,
172    @ref MSG_host_get_property_value, @ref MSG_process_get_properties, and 
173    @ref MSG_process_get_property_value. Also make sure to read the
174    platform and deployment XML files to see how to declare these data.
175  
176 TODO: Document the many other examples that we have 
177 */
178
179 As a human, you can stop reading at this point. The rest is garbage:
180
181 Every example must be listed in the following, but it's not possible
182 to move this content upper as each @example directive seems to eat
183 everything until the next */ marker (and the content is placed at the
184 top of the example file). 
185
186
187 /**
188 @example examples/msg/app-pingpong/app-pingpong.c
189 @example examples/msg/app-token-ring/app-token-ring.c
190 @example examples/msg/app-masterworker/app-masterworker.c
191
192 @example examples/msg/process-create/process-create.c
193 @example examples/msg/process-startkilltime/process-startkilltime.c
194
195 @example examples/msg/trace-platform/trace-platform.c
196 @example examples/msg/trace-categories/trace-categories.c
197 @example examples/msg/trace-masterworker/trace-masterworker.c
198 @example examples/msg/trace-process-migration/trace-process-migration.c
199 @example examples/msg/trace-host-user-variables/trace-host-user-variables.c
200 @example examples/msg/trace-link-user-variables/trace-link-user-variables.c
201 @example examples/msg/trace-route-user-variables/trace-route-user-variables.c
202
203 @example examples/msg/network-ns3/network-ns3.c
204
205 @example examples/msg/io-storage/io-storage.c
206 @example examples/msg/io-file/io-file.c
207 @example examples/msg/io-remote/io-remote.c
208
209 @example examples/msg/task-priority/task-priority.c
210 @example examples/msg/platform-properties/platform-properties.c
211
212 */
213