Logo AND Algorithmique Numérique Distribuée

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