Logo AND Algorithmique Numérique Distribuée

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