Logo AND Algorithmique Numérique Distribuée

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