1 /*! \page use Using SimGrid
3 This page is under work -- sorry for the inconvinience (FIXME).
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
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.
21 \section using_msg Using MSG
24 You should also check our online <a href="http://simgrid.gforge.inria.fr/tutorials.html"> tutorial section</a> that contains a dedicated tutorial.
27 Here are some examples on how to use MSG, the most used API.
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.
34 \subsection MSG_ex_basics Basic examples and features
36 \subsubsection MSG_ex_asynchronous_communications Asynchronous communications
39 Simulation of asynchronous communications between a sender and a receiver using a realistic platform and
40 an external description of the deployment.
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
53 \dontinclude msg/icomms/peer.c
55 \paragraph MSG_ext_icomms_code Code of the application
57 \paragraph MSG_ext_icomms_preliminary Preliminary declarations
59 \until Sender function
61 \paragraph MSG_ext_icomms_Sender Sender function
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.
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()
78 \until Receiver function
80 \paragraph MSG_ext_icomms_Receiver Receiver function
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()".
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()
94 \paragraph MSG_ext_icomms_core Simulation core
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
100 -# Application deployment : create the processes on the right locations with
101 MSG_launch_application()
102 -# The simulation is run with #MSG_main()
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
110 \paragraph MSG_ext_icomms_Main Main function
112 This initializes MSG, runs a simulation, and free all data-structures created by MSG.
116 \dontinclude msg/icomms/peer2.c
118 \paragraph MSG_ext_icomms_fct_Waitall Waitall function for sender
120 The use of this function permit to send all messages and wait for the completion of all in one time.
122 \skipline Sender function
125 \paragraph MSG_ext_icomms_fct_Waitany Waitany function
127 The MSG_comm_waitany() function return the place of the first message send or receive from a xbt_dynar_t table.
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
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
141 \subsubsection MSG_ex_master_slave Basic Master/Slaves
143 Simulation of a master-slave application using a realistic platform
144 and an external description of the deployment.
146 \paragraph MSG_ex_ms_TOC Table of contents:
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
160 \dontinclude msg/masterslave/masterslave_forwarder.c
163 \paragraph MSG_ext_ms_preliminary Preliminary declarations
169 \paragraph MSG_ext_ms_master Master code
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().
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.
183 Tasks are dumbly sent in a round-robin style.
187 \paragraph MSG_ext_ms_slave Slave code
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.
193 This function keeps waiting for tasks and executes them as it receives them.
197 \paragraph MSG_ext_ms_forwarder Forwarder code
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.
203 C style arguments (argc/argv) are interpreted as a list of host that
204 will accept those tasks.
206 This function keeps waiting for tasks and dispathes them to its slaves.
208 \until end_of_forwarder
210 \paragraph MSG_ext_ms_core Simulation core
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
216 -# Application deployment : create the processes on the right locations with
217 MSG_launch_application()
218 -# The simulation is run with #MSG_main()
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
224 \until end_of_test_all
226 \paragraph MSG_ext_ms_main Main() function
228 This initializes MSG, runs a simulation, and free all data-structures created by MSG.
232 \subsubsection MSG_ext_ms_helping Helping files
234 \paragraph MSG_ext_ms_application Example of application file
236 \include msg/masterslave/deployment_masterslave.xml
238 \paragraph MSG_ext_ms_platform Example of platform file
240 \include msg/small_platform.xml
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.
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.
248 \section using_trace Using Trace
249 Check out the \ref tracing section.
251 You should check our online <a href="http://simgrid.gforge.inria.fr/tutorials.html"> tutorial section</a> that contains a dedicated tutorial.
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.
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.