Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
The debian package are of course very uptodate, what do you mean?
[simgrid.git] / doc / doxygen / use.doc
1 /*! \page use Using SimGrid
2
3 This page is under work -- sorry for the inconvinience (FIXME).
4
5 - @ref help
6
7 \tableofcontents
8
9 SimGrid comes with many examples provided in the examples/ directory.
10 Those examples are described in section \ref MSG_examples. Those
11 examples are commented and should be easy to understand. for a first
12 step into SimGrid we also provide some more detailed examples in the
13 sections below. 
14
15 \htmlonly
16 You should also check our online <a href="http://simgrid.gforge.inria.fr/tutorials.html"> tutorial section</a> that contains a generic tutorial about using SimGrid. 
17 \endhtmlonly
18
19 \section using_msg Using MSG
20
21 \htmlonly
22 You should also check our online <a href="http://simgrid.gforge.inria.fr/tutorials.html"> tutorial section</a> that contains a dedicated tutorial. 
23 \endhtmlonly
24
25 Here are some examples on how to use MSG, the most used API.
26
27 MSG comes with an extensive set of examples. It is sometimes difficult
28 to find the one you need. This list aims at helping you finding the
29 example from which you can learn what you want to.
30
31 \subsection MSG_ex_basics Basic examples and features
32
33 \subsubsection MSG_ex_asynchronous_communications Asynchronous communications
34
35
36 Simulation of asynchronous communications between a sender and a receiver using a realistic platform and
37 an external description of the deployment.
38
39  - \ref MSG_ext_icomms_code
40    - \ref MSG_ext_icomms_preliminary
41    - \ref MSG_ext_icomms_Sender
42    - \ref MSG_ext_icomms_Receiver
43    - \ref MSG_ext_icomms_core
44    - \ref MSG_ext_icomms_Main
45  - \ref MSG_ext_icomms_fct_Waitall
46  - \ref MSG_ext_icomms_fct_Waitany
47
48 <hr>
49
50 \dontinclude msg/icomms/peer.c
51
52 \paragraph MSG_ext_icomms_code Code of the application
53
54 \paragraph MSG_ext_icomms_preliminary Preliminary declarations
55 \skip include
56 \until Sender function
57
58 \paragraph MSG_ext_icomms_Sender Sender function
59
60 A host can send an an asynchronous message with \c MSG_task_isend(). %As this function is non-blocking,
61 we have to call \c MSG_comm_test() to know if the communication has finished and finally destroy it with a call to \c MSG_comm_destroy().
62 It is also possible to call \c MSG_comm_wait() which, is provides a shortcut.
63
64   C style arguments (argc/argv) are interpreted as:
65    - the number of tasks to distribute
66    - the computation size of each task
67    - the size of the files associated to each task
68    - a list of host that will accept those tasks.
69    - the time to sleep at the beginning of the function
70    - This time defined the process sleep time
71                         if time = 0 use of MSG_comm_wait()
72                         if time > 0 use of MSG_comm_test()
73
74
75 \until Receiver function
76
77 \paragraph MSG_ext_icomms_Receiver Receiver function
78
79 This function executes tasks when it receives them. %As the receiving is asynchronous we have to test the communication to know
80 if it is completed or not with \c MSG_comm_test() or wait for the completion \c MSG_comm_wait().
81
82   C style arguments (argc/argv) are interpreted as:
83    - the id to use for received the communication.
84    - the time to sleep at the beginning of the function
85    - This time defined the process sleep time
86                         if time = 0 use of MSG_comm_wait()
87                         if time > 0 use of MSG_comm_test()
88
89 \until Test function
90
91 \paragraph MSG_ext_icomms_core Simulation core
92
93   This function is the core of the simulation and is divided only into 3 parts
94   thanks to MSG_create_environment() and MSG_launch_application().
95      -# Simulation settings : MSG_create_environment() creates a realistic
96         environment
97      -# Application deployment : create the processes on the right locations with
98         MSG_launch_application()
99      -# The simulation is run with #MSG_main()
100
101   Its arguments are:
102         - <i>platform_file</i>: the name of a file containing an valid surfxml platform description.
103         - <i>application_file</i>: the name of a file containing a valid surfxml application description
104
105 \until Main function
106
107 \paragraph MSG_ext_icomms_Main Main function
108
109 This initializes MSG, runs a simulation, and free all data-structures created by MSG.
110
111 \until end_of_main
112
113 \dontinclude msg/icomms/peer2.c
114
115 \paragraph MSG_ext_icomms_fct_Waitall Waitall function for sender
116
117 The use of this function permit to send all messages and wait for the completion of all in one time.
118
119 \skipline Sender function
120 \until end_of_sender
121
122 \paragraph MSG_ext_icomms_fct_Waitany Waitany function
123
124 The MSG_comm_waitany() function return the place of the first message send or receive from a xbt_dynar_t table.
125
126 \paragraph MSG_ext_icomms_fct_Waitany_sender From a sender
127 We can use this function to wait all sent messages.
128 \dontinclude msg/icomms/peer3.c
129 \skipline Sender function
130 \until end_of_sender
131
132 \paragraph MSG_ext_icomms_fct_Waitany_receiver From a receiver
133 We can also wait for the arrival of all messages.
134 \dontinclude msg/icomms/peer3.c
135 \skipline Receiver function
136 \until end_of_receiver
137
138 \subsubsection MSG_ex_master_slave Basic Master/Slaves
139
140 Simulation of a master-slave application using a realistic platform
141 and an external description of the deployment.
142
143 \paragraph MSG_ex_ms_TOC Table of contents:
144
145    - \ref MSG_ext_ms_preliminary
146    - \ref MSG_ext_ms_master
147    - \ref MSG_ext_ms_slave
148    - \ref MSG_ext_ms_forwarder
149    - \ref MSG_ext_ms_core
150    - \ref MSG_ext_ms_main
151    - \ref MSG_ext_ms_helping
152    - \ref MSG_ext_ms_application
153    - \ref MSG_ext_ms_platform
154
155 <hr>
156
157 \dontinclude msg/masterslave/masterslave_forwarder.c
158
159
160 \paragraph MSG_ext_ms_preliminary Preliminary declarations
161
162 \skip include
163 \until printf
164 \until }
165
166 \paragraph MSG_ext_ms_master Master code
167
168 This function has to be assigned to a #msg_process_t that will behave as
169 the master. It should not be called directly but either given as a
170 parameter to #MSG_process_create() or registered as a public function
171 through #MSG_function_register() and then automatically assigned to a
172 process through #MSG_launch_application().
173
174 C style arguments (argc/argv) are interpreted as:
175    - the number of tasks to distribute
176    - the computation size of each task
177    - the size of the files associated to each task
178    - a list of host that will accept those tasks.
179
180 Tasks are dumbly sent in a round-robin style.
181
182 \until end_of_master
183
184 \paragraph MSG_ext_ms_slave Slave code
185
186 This function has to be assigned to a #msg_process_t that has to behave
187 as a slave. Just like the master function (described in \ref
188 MSG_ext_ms_master), it should not be called directly.
189
190 This function keeps waiting for tasks and executes them as it receives them.
191
192 \until end_of_slave
193
194 \paragraph MSG_ext_ms_forwarder Forwarder code
195
196 This function has to be assigned to a #msg_process_t that has to behave
197 as a forwarder. Just like the master function (described in \ref
198 MSG_ext_ms_master), it should not be called directly.
199
200 C style arguments (argc/argv) are interpreted as a list of hosts that
201 will accept those tasks.
202
203 This function keeps waiting for tasks and dispatches them to its slaves.
204
205 \until end_of_forwarder
206
207 \paragraph MSG_ext_ms_core Simulation core
208
209 This function is the core of the simulation and is divided only into 3 parts
210 thanks to MSG_create_environment() and MSG_launch_application().
211    -# Simulation settings : MSG_create_environment() creates a realistic
212       environment
213    -# Application deployment : create the processes on the right locations with
214       MSG_launch_application()
215    -# The simulation is run with #MSG_main()
216
217 Its arguments are:
218         - <i>platform_file</i>: the name of a file containing an valid surfxml platform description.
219         - <i>application_file</i>: the name of a file containing a valid surfxml application description
220
221 \until end_of_test_all
222
223 \paragraph MSG_ext_ms_main Main() function
224
225 This initializes MSG, runs a simulation, and free all data-structures created by MSG.
226
227 \until end_of_main
228
229 \subsubsection MSG_ext_ms_helping Helping files
230
231 \paragraph MSG_ext_ms_application Example of a deployment file
232
233 The following listing can be found in \c examples/msg/masterslave/deployment_masterslave_forwarder.xml:
234
235 \include msg/masterslave/deployment_masterslave_forwarder.xml
236
237 \paragraph MSG_ext_ms_platform Example of a platform file
238
239 \include platforms/small_platform.xml
240
241 \section using_smpi Using SMPI
242 You should check our online <a href="http://simgrid.gforge.inria.fr/tutorials.html"> tutorial section</a> that contains a dedicated tutorial. 
243
244 \section using_MC Using Model Checking
245 You should check our online <a href="http://simgrid.gforge.inria.fr/tutorials.html"> tutorial section</a> that contains a dedicated tutorial. 
246
247 \section using_trace Using Trace
248 Check out the \ref tracing section.
249
250 You should check our online <a href="http://simgrid.gforge.inria.fr/tutorials.html"> tutorial section</a> that contains a dedicated tutorial. 
251
252 \section using_simdag Using SimDag
253 You should check our online <a href="http://simgrid.gforge.inria.fr/tutorials.html"> tutorial section</a> that contains a dedicated tutorial. 
254
255 \section using_simix Using SIMIX
256 You should check our online <a href="http://simgrid.gforge.inria.fr/tutorials.html"> tutorial section</a> that contains a dedicated tutorial. 
257
258 */
259
260