Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e3ca7e7b5008cdad507e0e32a79ef7a697bb25a7
[simgrid.git] / docs / source / app_msg.rst
1 .. _MSG_doc:
2
3 ====================================
4 The MSG Interface (legacy interface)
5 ====================================
6
7 .. raw:: html
8
9    <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
10    <script>
11    window.onload=function() { // Wait for the SVG to be loaded before changing it
12      //var elem=document.querySelector("#TOC").contentDocument.getElementById("S4UBox")
13      //elem.style="opacity:0.93999999;fill:#ff0000;fill-opacity:0.1";
14    }
15    </script>
16    <br/>
17    <br/>
18
19 MSG is a simple API to write algorithms organized with Concurrent
20 Sequential Processes (CSP) that interact by exchanging messages. It
21 constitutes a convenient simplification of the reality of distributed
22 systems. It can be used to build rather realistic simulations, but
23 remains simple to use: most unpleasant technical elements can be
24 abstracted away rather easily.
25
26 .. warning::
27
28    MSG used to be the main API of SimGrid 3, but we are currently in
29    the process of releasing SimGrid 4. So MSG is frozen and will
30    probably never evolve. If you are starting a new project, you
31    should consider S4U instead. Note that the support for MSG will not
32    be removed from SimGrid before 2020 at least.
33
34 Main MSG Functions
35 ------------------
36
37 The basic workflow is the following:
38
39  - Initialize the library with :c:macro:`MSG_init`
40  - Create a platform (usually by parsing a file with :cpp:func:`MSG_create_environment`)
41  - Register the functions that your processes are supposed to run with
42    :cpp:func:`MSG_function_register` (and maybe :cpp:func:`MSG_function_register_default`) 
43  - Launch your processes from a deployment file with :cpp:func:`MSG_launch_application`
44  - Run the simulation with :cpp:func:`MSG_main`
45
46 .. doxygenenum:: msg_error_t
47
48 .. doxygenfunction:: MSG_config
49 .. doxygenfunction:: MSG_create_environment
50 .. doxygenfunction:: MSG_function_register
51 .. doxygenfunction:: MSG_function_register_default
52 .. doxygenfunction:: MSG_get_clock
53 .. doxygenfunction:: MSG_get_sent_msg
54 .. doxygendefine:: MSG_init
55 .. doxygenfunction:: MSG_launch_application
56 .. doxygenfunction:: MSG_main
57 .. doxygenfunction:: MSG_set_function
58
59 Process Management Functions
60 ----------------------------
61
62 This describes the process structure :cpp:type:`msg_process_t` and the functions for managing it.
63
64 .. doxygentypedef:: msg_process_t
65 .. doxygenfunction:: MSG_process_attach
66 .. doxygenfunction:: MSG_process_auto_restart_set
67 .. doxygenfunction:: MSG_process_create
68 .. doxygenfunction:: MSG_process_create_with_arguments
69 .. doxygenfunction:: MSG_process_create_with_environment
70 .. doxygenfunction:: MSG_process_create_from_stdfunc
71 .. doxygenfunction:: MSG_process_daemonize
72 .. doxygenfunction:: MSG_process_detach
73 .. doxygenfunction:: MSG_processes_as_dynar
74 .. doxygenfunction:: MSG_process_from_PID
75 .. doxygenfunction:: MSG_process_get_data
76 .. doxygenfunction:: MSG_process_get_host
77 .. doxygenfunction:: MSG_process_get_name
78 .. doxygenfunction:: MSG_process_get_number
79 .. doxygenfunction:: MSG_process_get_PID
80 .. doxygenfunction:: MSG_process_get_PPID
81 .. doxygenfunction:: MSG_process_get_properties
82 .. doxygenfunction:: MSG_process_get_property_value
83 .. doxygenfunction:: MSG_process_get_smx_ctx
84 .. doxygenfunction:: MSG_process_is_suspended
85 .. doxygenfunction:: MSG_process_join
86 .. doxygenfunction:: MSG_process_kill
87 .. doxygenfunction:: MSG_process_killall
88 .. doxygenfunction:: MSG_process_migrate
89 .. doxygenfunction:: MSG_process_on_exit
90 .. doxygenfunction:: MSG_process_ref
91 .. doxygenfunction:: MSG_process_restart
92 .. doxygenfunction:: MSG_process_resume
93 .. doxygenfunction:: MSG_process_self
94 .. doxygenfunction:: MSG_process_self_name
95 .. doxygenfunction:: MSG_process_self_PID
96 .. doxygenfunction:: MSG_process_self_PPID
97 .. doxygenfunction:: MSG_process_set_data
98 .. doxygenfunction:: MSG_process_set_data_cleanup
99 .. doxygenfunction:: MSG_process_set_kill_time
100 .. doxygenfunction:: MSG_process_sleep
101 .. doxygenfunction:: MSG_process_suspend
102 .. doxygenfunction:: MSG_process_unref
103 .. doxygenfunction:: MSG_process_yield
104
105 Host Management Functions
106 -------------------------
107
108 .. doxygentypedef:: msg_host_t
109 .. doxygenfunction:: MSG_host_by_name
110 .. doxygenfunction:: MSG_get_host_by_name
111 .. doxygenfunction:: MSG_get_host_number
112 .. doxygenfunction:: MSG_host_get_attached_storage_lists
113 .. doxygenfunction:: MSG_host_get_core_number
114 .. doxygenfunction:: MSG_host_get_data
115 .. doxygenfunction:: MSG_host_get_mounted_storage_list
116 .. doxygenfunction:: MSG_host_get_name
117 .. doxygenfunction:: MSG_host_get_nb_pstates
118 .. doxygenfunction:: MSG_host_get_power_peak_at
119 .. doxygenfunction:: MSG_host_get_process_list
120 .. doxygenfunction:: MSG_host_get_properties
121 .. doxygenfunction:: MSG_host_get_property_value
122 .. doxygenfunction:: MSG_host_get_pstate
123 .. doxygenfunction:: MSG_host_get_speed
124 .. doxygenfunction:: MSG_host_is_off
125 .. doxygenfunction:: MSG_host_is_on
126 .. doxygenfunction:: MSG_host_off
127 .. doxygenfunction:: MSG_host_on
128 .. doxygenfunction:: MSG_hosts_as_dynar
129 .. doxygenfunction:: MSG_host_self
130 .. doxygenfunction:: MSG_host_set_data
131 .. doxygenfunction:: MSG_host_set_property_value
132 .. doxygenfunction:: MSG_host_set_pstate
133
134 Task Management Functions
135 -------------------------
136
137 Task structure of MSG :cpp:type:`msg_task_t` and associated functions.
138
139 .. doxygentypedef:: msg_task_t
140 .. doxygendefine:: MSG_TASK_UNINITIALIZED
141
142 .. doxygenfunction:: MSG_parallel_task_create
143 .. doxygenfunction:: MSG_parallel_task_execute
144 .. doxygenfunction:: MSG_parallel_task_execute_with_timeout
145 .. doxygenfunction:: MSG_task_cancel
146 .. doxygenfunction:: MSG_task_create
147 .. doxygenfunction:: MSG_task_destroy
148 .. doxygenfunction:: MSG_task_dsend
149 .. doxygenfunction:: MSG_task_dsend_bounded
150 .. doxygenfunction:: MSG_task_execute
151 .. doxygenfunction:: MSG_task_get_bytes_amount
152 .. doxygenfunction:: MSG_task_get_category
153 .. doxygenfunction:: MSG_task_get_data
154 .. doxygenfunction:: MSG_task_get_flops_amount
155 .. doxygenfunction:: MSG_task_get_name
156 .. doxygenfunction:: MSG_task_get_remaining_communication
157 .. doxygenfunction:: MSG_task_get_remaining_work_ratio
158 .. doxygenfunction:: MSG_task_get_sender
159 .. doxygenfunction:: MSG_task_get_source
160 .. doxygenfunction:: MSG_task_irecv
161 .. doxygenfunction:: MSG_task_irecv_bounded
162 .. doxygenfunction:: MSG_task_isend
163 .. doxygenfunction:: MSG_task_isend_bounded
164 .. doxygenfunction:: MSG_task_listen
165 .. doxygenfunction:: MSG_task_listen_from
166 .. doxygenfunction:: MSG_task_receive
167 .. doxygenfunction:: MSG_task_receive_bounded
168 .. doxygenfunction:: MSG_task_receive_ext
169 .. doxygenfunction:: MSG_task_receive_ext_bounded
170 .. doxygenfunction:: MSG_task_receive_with_timeout
171 .. doxygenfunction:: MSG_task_receive_with_timeout_bounded
172 .. doxygenfunction:: MSG_task_recv
173 .. doxygenfunction:: MSG_task_recv_bounded
174 .. doxygenfunction:: MSG_task_send
175 .. doxygenfunction:: MSG_task_send_bounded
176 .. doxygenfunction:: MSG_task_send_with_timeout
177 .. doxygenfunction:: MSG_task_send_with_timeout_bounded
178 .. doxygenfunction:: MSG_task_set_bound
179 .. doxygenfunction:: MSG_task_set_bytes_amount
180 .. doxygenfunction:: MSG_task_set_category
181 .. doxygenfunction:: MSG_task_set_copy_callback
182 .. doxygenfunction:: MSG_task_set_data
183 .. doxygenfunction:: MSG_task_set_flops_amount
184 .. doxygenfunction:: MSG_task_set_name
185 .. doxygenfunction:: MSG_task_set_priority
186
187                    
188 Mailbox Management Functions
189 ----------------------------
190
191 .. doxygenfunction:: MSG_mailbox_set_async
192
193 Communications
194 --------------
195
196 .. doxygentypedef:: msg_comm_t
197
198 .. doxygenfunction:: MSG_comm_destroy
199 .. doxygenfunction:: MSG_comm_get_status
200 .. doxygenfunction:: MSG_comm_get_task
201 .. doxygenfunction:: MSG_comm_test
202 .. doxygenfunction:: MSG_comm_testany
203 .. doxygenfunction:: MSG_comm_wait
204 .. doxygenfunction:: MSG_comm_waitall
205 .. doxygenfunction:: MSG_comm_waitany
206
207 Explicit Synchronization Functions
208 ----------------------------------
209
210 Explicit synchronization mechanisms: semaphores (:cpp:type:`msg_sem_t`) and friends.
211
212 In some situations, these things are very helpful to synchronize processes without message exchanges.
213
214 Barriers
215 ........
216
217 .. doxygentypedef:: msg_bar_t
218 .. doxygenfunction:: MSG_barrier_destroy
219 .. doxygenfunction:: MSG_barrier_init
220 .. doxygenfunction:: MSG_barrier_wait
221
222 Semaphores
223 ..........
224                      
225 .. doxygentypedef:: msg_sem_t
226 .. doxygenfunction:: MSG_sem_acquire
227 .. doxygenfunction:: MSG_sem_acquire_timeout
228 .. doxygenfunction:: MSG_sem_destroy
229 .. doxygenfunction:: MSG_sem_get_capacity
230 .. doxygenfunction:: MSG_sem_init
231 .. doxygenfunction:: MSG_sem_release
232 .. doxygenfunction:: MSG_sem_would_block
233
234 Virtual Machines
235 ----------------
236
237 This interface mimics IaaS clouds.
238 With it, you can create virtual machines to put your processes
239 into, and interact directly with the VMs to manage groups of
240 processes.
241
242 .. doxygentypedef:: msg_vm_t
243 .. doxygenfunction:: MSG_vm_create
244 .. doxygenfunction:: MSG_vm_create_core
245 .. doxygenfunction:: MSG_vm_create_multicore
246 .. doxygenfunction:: MSG_vm_destroy
247 .. doxygenfunction:: MSG_vm_get_name
248 .. doxygenfunction:: MSG_vm_get_pm
249 .. doxygenfunction:: MSG_vm_get_ramsize
250 .. doxygenfunction:: MSG_vm_is_created
251 .. doxygenfunction:: MSG_vm_is_running
252 .. doxygenfunction:: MSG_vm_is_suspended
253 .. doxygenfunction:: MSG_vm_resume
254 .. doxygenfunction:: MSG_vm_set_bound
255 .. doxygenfunction:: MSG_vm_set_ramsize
256 .. doxygenfunction:: MSG_vm_shutdown
257 .. doxygenfunction:: MSG_vm_start
258 .. doxygenfunction:: MSG_vm_suspend
259
260 Storage Management Functions
261 ----------------------------
262 Storage structure of MSG (:cpp:type:`msg_storage_t`) and associated functions, inspired from POSIX.
263
264 .. doxygentypedef:: msg_storage_t
265 .. doxygenfunction:: MSG_storage_get_by_name
266 .. doxygenfunction:: MSG_storage_get_data
267 .. doxygenfunction:: MSG_storage_get_host
268 .. doxygenfunction:: MSG_storage_get_name
269 .. doxygenfunction:: MSG_storage_get_properties
270 .. doxygenfunction:: MSG_storage_get_property_value
271 .. doxygenfunction:: MSG_storage_read
272 .. doxygenfunction:: MSG_storages_as_dynar
273 .. doxygenfunction:: MSG_storage_set_data
274 .. doxygenfunction:: MSG_storage_set_property_value
275 .. doxygenfunction:: MSG_storage_write
276
277 Zone Management Functions
278 -------------------------
279 Network Zone (:cpp:class:`msg_file_t`) and associated functions.
280
281 .. doxygentypedef:: msg_netzone_t
282 .. doxygenfunction:: MSG_zone_get_by_name
283 .. doxygenfunction:: MSG_zone_get_hosts
284 .. doxygenfunction:: MSG_zone_get_name
285 .. doxygenfunction:: MSG_zone_get_property_value
286 .. doxygenfunction:: MSG_zone_get_root
287 .. doxygenfunction:: MSG_zone_get_sons
288 .. doxygenfunction:: MSG_zone_set_property_value