Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
finish the API under the new format
[simgrid.git] / docs / source / app_s4u.rst
1 .. _S4U_doc:
2
3 The S4U Interface
4 #################
5
6 .. raw:: html
7
8    <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
9    <script>
10    window.onload=function() { // Wait for the SVG to be loaded before changing it
11      var elem=document.querySelector("#TOC").contentDocument.getElementById("ActorBox")
12      elem.style="opacity:0.93999999;fill:#ff0000;fill-opacity:0.1;stroke:#000000;stroke-width:0.35277778;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1";
13    }
14    </script>
15    <br/>
16    <br/>
17
18 The S4U interface (SimGrid for you) mixes the full power of SimGrid
19 with the full power of C++. This is the preferred interface to describe
20 abstract algorithms in the domains of Cloud, P2P, HPC, IoT, and similar
21 settings.
22
23 Since v3.20 (June 2018), S4U is definitely the way to go for long-term
24 projects. It is feature complete, but may still evolve slightly in the
25 future releases. It can already be used to do everything that can be
26 done in SimGrid, but you may have to adapt your code in future
27 releases. When this happens, compiling your code will produce
28 deprecation warnings for 4 releases (one year) before the removal of
29 the old symbols. 
30 If you want an API that will never ever evolve in the future, you
31 should use the :ref:`deprecated MSG API <MSG_doc>` instead. 
32
33 Main Concepts
34 *************
35
36 A typical SimGrid simulation is composed of several |API_s4u_Actors|_, that
37 execute user-provided functions. The actors have to explicitly use the
38 S4U interface to express their :ref:`computation <API_s4u_Exec>`,
39 :ref:`communication <API_s4u_Comm>`, :ref:`disk usage <API_s4u_Io>`,
40 and other |API_s4u_Activities|_, so that they get reflected within the
41 simulator. These activities take place on resources such as |API_s4u_Hosts|_,
42 |API_s4u_Links|_ and |API_s4u_Disks|_. SimGrid predicts the time taken by each
43 activity and orchestrates the actors accordingly, waiting for the
44 completion of these activities.
45
46
47 When **communicating**, data is not directly sent to other actors but
48 posted onto a |API_s4u_Mailbox|_ that serves as a rendez-vous point between
49 communicating actors. This means that you don't need to know who you
50 are talking to, you just put your communication `Put` request in a
51 mailbox, and it will be matched with a complementary `Get`
52 request.  Alternatively, actors can interact through **classical
53 synchronization mechanisms** such as |API_s4u_Barrier|_, |API_s4u_Semaphore|_,
54 |API_s4u_Mutex|_ and |API_s4u_ConditionVariable|_.
55
56 Each actor is located on a simulated |API_s4u_Host|_. Each host is located
57 itself in a |API_s4u_NetZone|_, that knows the networking path between one
58 resource to another. Each NetZone is included in another one, forming
59 a tree of NetZones which root zone contains the whole platform. The
60 actors can also be located on a |API_s4U_VirtualMachine|_ that may
61 restrict the activities it contains to a limited amount of cores.
62 Virtual machines can also be migrated between hosts.
63
64 The :ref:`simgrid::s4u::this_actor <API_s4u_this_actor>` namespace
65 provides many helper functions to simplify the code of actors.
66
67 - **Simulation Elements**
68
69   - :ref:`class Actor <API_s4u_Actor>`:
70     Active entities executing your application.
71   - :ref:`class Engine <API_s4u_Engine>`
72     Simulation engine (singleton).
73   - :ref:`class Mailbox <API_s4u_Mailbox>`
74     Communication rendez-vous, with which actors meet each other.
75
76 - **Resources**
77
78   - :ref:`class Disk <API_s4u_Disk>`
79     Resource on which actors can write and read data.
80   - :ref:`class Host <API_s4u_Host>`:
81     Actor location, providing computational power.
82   - :ref:`class Link <API_s4u_Link>`
83     Interconnecting hosts.
84   - :ref:`class NetZone <API_s4u_NetZone>`:
85     Sub-region of the platform, containing resources (Hosts, Links, etc).
86   - :ref:`class VirtualMachine <API_s4u_VirtualMachine>`:
87     Execution containers that can be moved between Hosts.
88
89 - **Activities** (:ref:`class Activity <API_s4u_Activity>`):
90   The things that actors can do on resources
91
92   - :ref:`class Comm <API_s4u_Comm>`
93     Communication activity, started on Mailboxes and consuming links.
94   - :ref:`class Exec <API_s4u_Exec>`
95     Computation activity, started on Host and consuming CPU resources.
96   - :ref:`class Io <API_s4u_Io>`
97     I/O activity, started on and consumming disks.
98
99 - **Synchronization Objects**: Classical IPC that actors can use
100
101   - :ref:`class Barrier <API_s4u_Barrier>`
102   - :ref:`class ConditionVariable <API_s4u_ConditionVariable>`
103   - :ref:`class Mutex <API_s4u_Mutex>`
104   - :ref:`class Semaphore <API_s4u_Semaphore>`
105
106
107 .. |API_s4u_Actors| replace:: **Actors**
108 .. _API_s4u_Actors: #api-s4u-actor
109
110 .. |API_s4u_Activities| replace:: **Activities**
111 .. _API_s4u_Activities: #api-s4u-activity
112
113 .. |API_s4u_Hosts| replace:: **Hosts**
114 .. _API_s4u_Hosts: #api-s4u-host
115
116 .. |API_s4u_Links| replace:: **Links**
117 .. _API_s4u_Links: #api-s4u-link
118
119 .. |API_s4u_Disks| replace:: **Disks**
120 .. _API_s4u_Disks: #api-s4u-disk
121
122 .. |API_s4u_VirtualMachine| replace:: **VirtualMachines**
123
124 .. |API_s4u_Host| replace:: **Host**
125
126 .. |API_s4u_Mailbox| replace:: **Mailbox**
127
128 .. |API_s4u_Mailboxes| replace:: **Mailboxes**
129 .. _API_s4u_Mailboxes: #s4u-mailbox
130
131 .. |API_s4u_NetZone| replace:: **NetZone**
132
133 .. |API_s4u_Barrier| replace:: **Barrier**
134
135 .. |API_s4u_Semaphore| replace:: **Semaphore**
136
137 .. |API_s4u_ConditionVariable| replace:: **ConditionVariable**
138
139 .. |API_s4u_Mutex| replace:: **Mutex**
140
141 .. _s4u_Activities:
142
143 Activities
144 **********
145
146 Activities represent the actions that consume a resource, such as a
147 :ref:`Comm <API_s4u_Comm>` that consumes the *transmitting power* of 
148 :ref:`Link <API_s4u_Link>` resources, or an :ref:`Exec <API_s4u_Exec>`
149 that consumes the *computing power* of :ref:`Host <API_s4u_Host>` resources.
150 See also the :ref:`full API <API_s4u_Activity>` below.
151
152 =======================
153 Asynchronous Activities
154 =======================
155
156 Every activity can be either **blocking** or **asynchronous**. For
157 example, :cpp:func:`s4u::Mailbox::put() <simgrid::s4u::Mailbox::put>`
158 and :cpp:func:`s4u::Mailbox::get() <simgrid::s4u::Mailbox::get>`
159 create blocking communications: the actor is blocked until the
160 completion of that communication. Asynchronous communications do not
161 block the actor during their execution but progress on their own.
162
163 Once your asynchronous activity is started, you can test for its
164 completion using :cpp:func:`s4u::Activity::test() <simgrid::s4u::Activity::test>`.
165 This function returns ``true`` if the activity completed already.
166 You can also use :cpp:func:`s4u::Activity::wait() <simgrid::s4u::Activity::wait>`
167 to block until the completion of the activity. To wait for at most a given amount of time,
168 use  :cpp:func:`s4u::Activity::wait_for() <simgrid::s4u::Activity::wait_for>`.
169 Finally, to wait at most until a specified time limit, use
170 :cpp:func:`s4u::Activity::wait_until() <simgrid::s4u::Activity::wait_until>`.
171
172 .. todo::
173
174    wait_for and wait_until are currently not implemented for Exec and Io activities.
175
176 Every kind of activity can be asynchronous:
177
178   - :ref:`s4u::CommPtr <API_s4u_Comm>` are created with 
179     :cpp:func:`s4u::Mailbox::put_async() <simgrid::s4u::Mailbox::put_async>` and
180     :cpp:func:`s4u::Mailbox::get_async() <simgrid::s4u::Mailbox::get_async>`.
181   - :ref:`s4u::IoPtr <API_s4u_Io>` are created with 
182     :cpp:func:`s4u::Disk::read_async() <simgrid::s4u::Disk::read_async>` and
183     :cpp:func:`s4u::Disk::write_async() <simgrid::s4u::Disk::write_async>`.
184   - :ref:`s4u::ExecPtr <API_s4u_Exec>` are created with
185     :cpp:func:`s4u::Host::exec_async() <simgrid::s4u::Host::exec_async>`.
186   - In the future, it will become possible to have asynchronous IPC
187     such as asynchronous mutex lock requests.
188
189 The following example shows how to have several concurrent
190 communications ongoing.  First, you have to declare a vector in which
191 we will store the ongoing communications. It is also useful to have a
192 vector of mailboxes.
193
194 .. literalinclude:: ../../examples/s4u/async-waitall/s4u-async-waitall.cpp
195    :language: c++
196    :start-after: init-begin
197    :end-before: init-end
198    :dedent: 4
199
200 Then, you start all the communications that should occur concurrently with
201 :cpp:func:`s4u::Mailbox::put_async() <simgrid::s4u::Mailbox::put_async>`.  
202 Finally, the actor waits for the completion of all of them at once
203 with 
204 :cpp:func:`s4u::Comm::wait_all() <simgrid::s4u::Comm::wait_all>`.  
205      
206 .. literalinclude:: ../../examples/s4u/async-waitall/s4u-async-waitall.cpp
207    :language: c++
208    :start-after: put-begin
209    :end-before: put-end
210    :dedent: 4
211
212
213 =====================
214 Activities Life cycle
215 =====================
216
217 Sometimes, you want to change the setting of an activity before it even starts. 
218
219 .. todo:: write this section
220
221 .. _s4u_mailbox:
222           
223 Mailboxes
224 *********
225
226 Please also refer to the :ref:`API reference for s4u::Mailbox
227 <API_s4u_Mailbox>`.
228
229 ===================
230 What are Mailboxes?
231 ===================
232
233 |API_s4u_Mailboxes|_ are rendez-vous points for network communications,
234 similar to URLs on which you could post and retrieve data. Actually,
235 the mailboxes are not involved in the communication once it starts,
236 but only to find the contact with which you want to communicate.
237
238 They are similar to many common things: The phone number, which allows
239 the caller to find the receiver. The twitter hashtag, which help
240 senders and receivers to find each others. In TCP, the pair 
241 ``{host name, host port}`` to which you can connect to find your peer.
242 In HTTP, URLs through which the clients can connect to the servers. 
243 In ZeroMQ, the queues are used to match senders and receivers.
244
245 One big difference with most of these systems is that no actor is the
246 exclusive owner of a mailbox, neither in sending nor in receiving.
247 Many actors can send into and/or receive from the same mailbox.  TCP
248 socket ports for example are shared on the sender side but exclusive
249 on the receiver side (only one process can receive from a given socket
250 at a given point of time).
251
252 A big difference with TCP sockets or MPI communications is that
253 communications do not start right away after a
254 :cpp:func:`Mailbox::put() <simgrid::s4u::Mailbox::put()>`, but wait
255 for the corresponding :cpp:func:`Mailbox::get() <simgrid::s4u::Mailbox::get()>`.
256 You can change this by :ref:`declaring a receiving actor <s4u_receiving_actor>`.
257
258 A big difference with twitter hashtags is that SimGrid does not
259 offer easy support to broadcast a given message to many
260 receivers. So that would be like a twitter tag where each message
261 is consumed by the first receiver.
262
263 A big difference with the ZeroMQ queues is that you cannot filter
264 on the data you want to get from the mailbox. To model such settings
265 in SimGrid, you'd have one mailbox per potential topic, and subscribe
266 to each topic individually with a 
267 :cpp:func:`get_async() <simgrid::s4u::Mailbox::get_async()>` on each mailbox.
268 Then, use :cpp:func:`Comm::wait_any() <simgrid::s4u::Comm::wait_any()>` 
269 to get the first message on any of the mailbox you are subscribed onto.
270
271 The mailboxes are not located on the network, and you can access
272 them without any latency. The network delay are only related to the
273 location of the sender and receiver once the match between them is
274 done on the mailbox. This is just like the phone number that you
275 can use locally, and the geographical distance only comes into play
276 once you start the communication by dialing this number.
277
278 =====================
279 How to use Mailboxes?
280 =====================
281
282 You can retrieve any existing mailbox from its name (which is a
283 unique string, just like a twitter tag). This results in a
284 versatile mechanism that can be used to build many different
285 situations.
286
287 To model classical socket communications, use "hostname:port" as
288 mailbox names, and make sure that only one actor reads into a given
289 mailbox. This does not make it easy to build a perfectly realistic
290 model of the TCP sockets, but in most cases, this system is too
291 cumbersome for your simulations anyway. You probably want something
292 simpler, that turns our to be easy to build with the mailboxes.
293
294 Many SimGrid examples use a sort of yellow page system where the
295 mailbox names are the name of the service (such as "worker",
296 "master" or "reducer"). That way, you don't have to know where your
297 peer is located to contact it. You don't even need its name. Its
298 function is enough for that. This also gives you some sort of load
299 balancing for free if more than one actor pulls from the mailbox:
300 the first actor that can deal with the request will handle it.
301
302 =========================================
303 How are put() and get() requests matched?
304 =========================================
305
306 The matching algorithm simple: first come, first serve. When a new
307 send arrives, it matches the oldest enqueued receive. If no receive is
308 currently enqueued, then the incoming send is enqueued. As you can
309 see, the mailbox cannot contain both send and receive requests: all
310 enqueued requests must be of the same sort.
311
312 .. _s4u_receiving_actor:
313
314 ===========================
315 Declaring a Receiving Actor
316 ===========================
317
318 The last twist is that by default in the simulator, the data starts
319 to be exchanged only when both the sender and the receiver are
320 announced (it waits until both :cpp:func:`put() <simgrid::s4u::Mailbox::put()>`
321 and :cpp:func:`get() <simgrid::s4u::Mailbox::get()>` are posted). 
322 In TCP, since you establish connections beforehand, the data starts to
323 flow as soon as the sender posts it, even if the receiver did not post
324 its :cpp:func:`recv() <simgrid::s4u::Mailbox::recv()>` yet. 
325
326 To model this in SimGrid, you can declare a specific receiver to a
327 given mailbox (with the function 
328 :cpp:func:`set_receiver() <simgrid::s4u::Mailbox::set_receiver()>`). 
329 That way, any :cpp:func:`put() <simgrid::s4u::Mailbox::put()>`
330 posted to that mailbox will start as soon as possible, and the data
331 will already be there on the receiver host when the receiver actor
332 posts its :cpp:func:`get() <simgrid::s4u::Mailbox::get()>`
333
334 Note that being permanent receivers of a mailbox prevents actors to be
335 garbage-collected. If your simulation creates many short-lived actors
336 that marked as permanent receiver, you should call
337 ``mailbox->set_receiver(nullptr)`` by the end of the actors so that their
338 memory gets properly reclaimed. This call should be at the end of the
339 actor's function, not in a on_exit callback.
340
341 .. _s4u_raii:
342
343 Memory Management
344 *****************
345
346 For sake of simplicity, we use `RAII
347 <https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_
348 for many classes in S4U. This is an idiom where resources are automatically
349 managed through the context. Provided that you never manipulate
350 objects of type Foo directly but always FooPtr references (which are
351 defined as `boost::intrusive_ptr
352 <http://www.boost.org/doc/libs/1_61_0/libs/smart_ptr/intrusive_ptr.html>`_
353 <Foo>), you will never have to explicitly release the resource that
354 you use nor to free the memory of unused objects.
355 Here is a little example:
356
357 .. code-block:: cpp
358
359    void myFunc() 
360    {
361      simgrid::s4u::MutexPtr mutex = simgrid::s4u::Mutex::create(); // Too bad we cannot use `new`
362
363      mutex->lock();   // use the mutex as a simple reference
364      //  bla bla
365      mutex->unlock(); 
366   
367    } // The mutex gets automatically freed because the only existing reference gets out of scope
368
369 Note that Mailboxes, Hosts and Links are not handled thought smart
370 pointers (yet?). This means that it is currently impossible to destroy a
371 mailbox or a link. You can still destroy an host (but probably
372 shouldn't), using :cpp:func:`simgrid::s4u::Host::destroy`.
373
374 .. THE EXAMPLES
375
376 .. include:: ../../examples/README.rst
377
378 API Reference
379 *************
380
381 .. _API_s4u_simulation_object:
382
383 ==================
384 Simulation objects
385 ==================
386
387 .. _API_s4u_Actor:
388
389 ==============
390 ⁣  class Actor
391 ==============
392
393 .. autodoxyclass:: simgrid::s4u::Actor
394
395 .. doxygentypedef:: aid_t
396
397 Basic management
398 ----------------
399
400 .. tabs::
401
402    .. group-tab:: C++
403
404       .. code:: C++
405
406          #include <simgrid/s4u/Actor.hpp>
407
408       .. doxygentypedef:: ActorPtr
409
410    .. group-tab:: Python
411
412       .. code:: Python
413
414          from simgrid import Actor
415
416    .. group-tab:: C
417
418       .. code:: C
419
420          #include <simgrid/actor.h>
421
422       .. doxygentypedef:: sg_actor_t
423       .. cpp:type:: const s4u_Actor* const_sg_actor_t
424
425          Pointer to a constant actor object.
426
427       .. autodoxymethod:: sg_actor_ref(const_sg_actor_t actor)
428       .. autodoxymethod:: sg_actor_unref(const_sg_actor_t actor)
429
430 Creating actors
431 ---------------
432
433 .. tabs::
434
435    .. group-tab:: C++
436
437       .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, const std::function< void()> &code)
438       .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, F code)
439       .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, F code, Args... args)
440       .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, const std::string &function, std::vector< std::string > args)
441
442       .. autodoxymethod:: simgrid::s4u::Actor::init(const std::string &name, s4u::Host *host)
443       .. autodoxymethod:: simgrid::s4u::Actor::start(const std::function< void()> &code)
444
445    .. group-tab:: Python
446
447       .. automethod:: simgrid.Actor.create
448
449    .. group-tab:: C
450
451       .. autodoxymethod:: sg_actor_init(const char *name, sg_host_t host)
452       .. autodoxymethod:: sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, char **argv)
453
454       .. autodoxymethod:: sg_actor_attach(const char *name, void *data, sg_host_t host, xbt_dict_t properties)
455       .. autodoxymethod:: sg_actor_detach()
456
457 Retrieving actors
458 -----------------
459
460 .. tabs::
461
462    .. group-tab:: C++
463
464       .. autodoxymethod:: simgrid::s4u::Actor::by_pid(aid_t pid)
465       .. autodoxymethod:: simgrid::s4u::Actor::self()
466
467    .. group-tab:: Python
468
469       .. automethod:: simgrid.Actor.by_pid
470       .. automethod:: simgrid.Actor.self
471
472    .. group-tab:: C
473
474       .. autodoxymethod:: sg_actor_by_PID(aid_t pid)
475       .. autodoxymethod:: sg_actor_self()
476
477 Querying info
478 -------------
479
480 .. tabs::
481
482    .. group-tab:: C++
483
484       .. autodoxymethod:: simgrid::s4u::Actor::get_cname
485       .. autodoxymethod:: simgrid::s4u::Actor::get_name
486       .. autodoxymethod:: simgrid::s4u::Actor::get_pid
487       .. autodoxymethod:: simgrid::s4u::Actor::get_ppid
488       .. autodoxymethod:: simgrid::s4u::Actor::get_properties() const
489       .. autodoxymethod:: simgrid::s4u::Actor::get_property(const std::string &key) const
490       .. autodoxymethod:: simgrid::s4u::Actor::set_property(const std::string &key, const std::string &value) 
491
492       .. autodoxymethod:: simgrid::s4u::Actor::get_host
493       .. autodoxymethod:: simgrid::s4u::Actor::set_host
494
495       .. autodoxymethod:: simgrid::s4u::Actor::get_refcount()
496       .. autodoxymethod:: simgrid::s4u::Actor::get_impl
497
498    .. group-tab:: Python
499                   
500       .. autoattribute:: simgrid.Actor.name
501       .. autoattribute:: simgrid.Actor.host
502       .. autoattribute:: simgrid.Actor.pid
503       .. autoattribute:: simgrid.Actor.ppid
504
505    .. group-tab:: C
506
507       .. autodoxymethod:: sg_actor_get_name(const_sg_actor_t actor)
508       .. autodoxymethod:: sg_actor_get_PID(const_sg_actor_t actor)
509       .. autodoxymethod:: sg_actor_get_PPID(const_sg_actor_t actor)
510       .. autodoxymethod:: sg_actor_get_properties(const_sg_actor_t actor)
511       .. autodoxymethod:: sg_actor_get_property_value(const_sg_actor_t actor, const char *name)
512
513       .. autodoxymethod:: sg_actor_get_host(const_sg_actor_t actor)
514       .. autodoxymethod:: sg_actor_set_host(sg_actor_t actor, sg_host_t host)
515
516       .. autodoxymethod:: sg_actor_data(const_sg_actor_t actor)
517       .. autodoxymethod:: sg_actor_data_set(sg_actor_t actor, void *userdata)        
518
519 Suspending and resuming actors
520 ------------------------------
521
522 .. tabs::
523
524    .. group-tab:: C++
525
526       .. autodoxymethod:: simgrid::s4u::Actor::suspend()
527       .. autodoxymethod:: simgrid::s4u::Actor::resume()
528       .. autodoxymethod:: simgrid::s4u::Actor::is_suspended()
529
530    .. group-tab:: Python
531
532       .. automethod:: simgrid.Actor.resume
533       .. automethod:: simgrid.Actor.suspend
534       .. automethod:: simgrid.Actor.is_suspended
535
536    .. group-tab:: C
537
538       .. autodoxymethod:: sg_actor_suspend(sg_actor_t actor)
539       .. autodoxymethod:: sg_actor_resume(sg_actor_t actor)
540       .. autodoxymethod:: sg_actor_is_suspended(sg_actor_t actor)
541
542 Specifying when actors should terminate
543 ---------------------------------------
544
545 .. tabs::
546
547    .. group-tab:: C++
548
549       .. autodoxymethod:: simgrid::s4u::Actor::kill()
550       .. autodoxymethod:: simgrid::s4u::Actor::kill_all()
551       .. autodoxymethod:: simgrid::s4u::Actor::set_kill_time(double time)
552       .. autodoxymethod:: simgrid::s4u::Actor::get_kill_time()
553
554       .. autodoxymethod:: simgrid::s4u::Actor::restart()
555       .. autodoxymethod:: simgrid::s4u::Actor::daemonize()
556       .. autodoxymethod:: simgrid::s4u::Actor::is_daemon
557
558    .. group-tab:: Python
559
560       .. automethod:: simgrid.Actor.kill
561       .. automethod:: simgrid.Actor.kill_all
562
563       .. automethod:: simgrid.Actor.daemonize
564       .. automethod:: simgrid.Actor.is_daemon
565
566    .. group-tab:: C
567
568       .. autodoxymethod:: sg_actor_kill(sg_actor_t actor)
569       .. autodoxymethod:: sg_actor_kill_all()
570       .. autodoxymethod:: sg_actor_set_kill_time(sg_actor_t actor, double kill_time)
571
572       .. autodoxymethod:: sg_actor_restart(sg_actor_t actor)
573       .. autodoxymethod:: sg_actor_daemonize(sg_actor_t actor)
574
575 .. _API_s4u_Actor_end:
576
577 Reacting to the end of actors
578 -----------------------------
579
580 .. tabs::
581
582    .. group-tab:: C++
583
584       .. autodoxymethod:: simgrid::s4u::Actor::on_exit
585       .. autodoxymethod:: simgrid::s4u::Actor::join()
586       .. autodoxymethod:: simgrid::s4u::Actor::join(double timeout)
587       .. autodoxymethod:: simgrid::s4u::Actor::set_auto_restart(bool autorestart)
588
589    .. group-tab:: Python
590
591       .. automethod:: simgrid.Actor.join
592
593    .. group-tab:: C
594
595       .. autodoxymethod:: sg_actor_join(sg_actor_t actor, double timeout)
596       .. autodoxymethod:: sg_actor_set_auto_restart(sg_actor_t actor, int auto_restart)
597
598 Signals
599 -------
600
601 .. tabs::
602
603    .. group-tab:: C++
604
605       .. autodoxyvar:: simgrid::s4u::Actor::on_creation
606       .. autodoxyvar:: simgrid::s4u::Actor::on_suspend
607       .. cpp:var:: xbt::signal<void(const Actor&, const Host & previous_location)> Actor::on_host_change
608
609          Signal fired when an actor is migrated from one host to another.
610
611       .. autodoxyvar:: simgrid::s4u::Actor::on_resume
612       .. autodoxyvar:: simgrid::s4u::Actor::on_sleep
613       .. autodoxyvar:: simgrid::s4u::Actor::on_wake_up
614       .. autodoxyvar:: simgrid::s4u::Actor::on_termination
615       .. autodoxyvar:: simgrid::s4u::Actor::on_destruction
616
617 .. _API_s4u_this_actor:
618
619 ====================
620 ⁣  The current actor
621 ====================
622
623 These functions can be used in your user code to interact with the actor
624 currently running (the one retrieved with :cpp:func:`simgrid::s4u::Actor::self`).
625 Using these functions can greatly improve the code readability.
626
627 Querying info
628 -------------
629
630 .. tabs::
631
632    .. group-tab:: C++
633
634       .. autodoxymethod:: simgrid::s4u::this_actor::get_cname()
635       .. autodoxymethod:: simgrid::s4u::this_actor::get_name()
636       .. autodoxymethod:: simgrid::s4u::this_actor::get_pid()
637       .. autodoxymethod:: simgrid::s4u::this_actor::get_ppid()
638       .. autodoxymethod:: simgrid::s4u::this_actor::is_maestro()
639
640       .. autodoxymethod:: simgrid::s4u::this_actor::get_host()
641       .. autodoxymethod:: simgrid::s4u::this_actor::set_host(Host *new_host)
642
643    .. group-tab:: Python
644
645       .. autofunction:: simgrid.this_actor.get_host
646       .. autofunction:: simgrid.this_actor.set_host
647
648    .. group-tab:: C
649
650       .. autodoxymethod:: sg_actor_self_data()
651       .. autodoxymethod:: sg_actor_self_data_set(void *data)
652       .. autodoxymethod:: sg_actor_self_get_name()
653       .. autodoxymethod:: sg_actor_self_get_pid()
654       .. autodoxymethod:: sg_actor_self_get_ppid()
655       .. autodoxymethod:: sg_host_self()
656       .. autodoxymethod:: sg_host_self_get_name()
657
658 Suspending and resuming
659 -----------------------
660
661 .. tabs::
662
663    .. group-tab:: C++
664
665       .. autodoxymethod:: simgrid::s4u::this_actor::suspend()
666       .. autodoxymethod:: simgrid::s4u::this_actor::yield()
667
668    .. group-tab:: Python
669
670       .. autofunction:: simgrid.this_actor.suspend
671       .. autofunction:: simgrid.this_actor.yield_
672
673 Logging messages
674 ----------------
675
676 .. tabs::
677
678    .. group-tab:: Python
679
680        .. autofunction:: simgrid.this_actor.info
681        .. autofunction:: simgrid.this_actor.error
682
683 Sleeping
684 --------
685
686 .. tabs::
687
688    .. group-tab:: C++
689
690       .. autodoxymethod:: simgrid::s4u::this_actor::sleep_for(double duration)
691       .. autodoxymethod:: simgrid::s4u::this_actor::sleep_for(std::chrono::duration< Rep, Period > duration)
692       .. autodoxymethod:: simgrid::s4u::this_actor::sleep_until(const SimulationTimePoint< Duration > &wakeup_time)
693       .. autodoxymethod:: simgrid::s4u::this_actor::sleep_until(double wakeup_time)
694
695    .. group-tab:: Python
696
697       .. autofunction:: simgrid.this_actor.sleep_for
698       .. autofunction:: simgrid.this_actor.sleep_until
699
700    .. group-tab:: C
701
702       .. autodoxymethod:: sg_actor_sleep_for(double duration)
703
704 Simulating executions
705 ---------------------
706
707 Simulate the execution of some code on this actor. You can either simulate
708 parallel or sequential code, and you can either block upon the termination of
709 the execution, or start an asynchronous activity.
710
711 .. tabs::
712
713    .. group-tab:: C++
714
715       .. autodoxymethod:: simgrid::s4u::this_actor::exec_async(double flops_amounts)
716       .. autodoxymethod:: simgrid::s4u::this_actor::exec_init(const std::vector< s4u::Host * > &hosts, const std::vector< double > &flops_amounts, const std::vector< double > &bytes_amounts)
717       .. autodoxymethod:: simgrid::s4u::this_actor::exec_init(double flops_amounts)
718       .. autodoxymethod:: simgrid::s4u::this_actor::execute(double flop)
719       .. autodoxymethod:: simgrid::s4u::this_actor::execute(double flop, double priority)
720       .. autodoxymethod:: simgrid::s4u::this_actor::parallel_execute(const std::vector< s4u::Host * > &hosts, const std::vector< double > &flops_amounts, const std::vector< double > &bytes_amounts)
721       .. autodoxymethod:: simgrid::s4u::this_actor::parallel_execute(const std::vector< s4u::Host * > &hosts, const std::vector< double > &flops_amounts, const std::vector< double > &bytes_amounts, double timeout)
722
723    .. group-tab:: Python
724
725       .. autofunction:: simgrid.this_actor.exec_init
726       .. autofunction:: simgrid.this_actor.execute
727
728    .. group-tab:: C
729
730       .. autodoxymethod:: sg_actor_self_execute(double flops)
731
732 Exiting
733 -------
734
735 .. tabs::
736
737    .. group-tab:: C++
738
739       .. autodoxymethod:: simgrid::s4u::this_actor::exit()
740       .. autodoxymethod:: simgrid::s4u::this_actor::on_exit(const std::function< void(bool)> &fun)
741
742    .. group-tab:: Python
743
744       .. autofunction:: simgrid.this_actor.exit
745       .. autofunction:: simgrid.this_actor.on_exit
746
747 .. _API_s4u_Engine:
748
749 ====================
750 ⁣  Simulation Engine
751 ====================
752
753 .. autodoxyclass:: simgrid::s4u::Engine
754
755 Initialization
756 --------------
757
758 .. tabs::
759
760    .. group-tab:: C++
761
762       .. autodoxymethod:: simgrid::s4u::Engine::Engine(int *argc, char **argv)
763       .. autodoxymethod:: simgrid::s4u::Engine::is_initialized()
764       .. autodoxymethod:: simgrid::s4u::Engine::shutdown()
765       .. autodoxymethod:: simgrid::s4u::Engine::set_config(const std::string &str)
766
767       .. autodoxymethod:: simgrid::s4u::Engine::load_deployment(const std::string &deploy)
768       .. autodoxymethod:: simgrid::s4u::Engine::load_platform(const std::string &platf)
769       .. autodoxymethod:: simgrid::s4u::Engine::register_actor(const std::string &name)
770       .. autodoxymethod:: simgrid::s4u::Engine::register_actor(const std::string &name, F code)
771       .. autodoxymethod:: simgrid::s4u::Engine::register_default(int(*code)(int, char **))
772       .. autodoxymethod:: simgrid::s4u::Engine::register_function(const std::string &name, int(*code)(int, char **))
773       .. autodoxymethod:: simgrid::s4u::Engine::register_function(const std::string &name, void(*code)(std::vector< std::string >))
774
775    .. group-tab:: Python
776    
777        .. automethod:: simgrid.Engine.load_deployment
778        .. automethod:: simgrid.Engine.load_platform
779        .. automethod:: simgrid.Engine.register_actor
780
781    .. group-tab:: C
782
783       .. autodoxymethod:: simgrid_init
784
785       .. autodoxymethod:: simgrid_load_deployment
786       .. autodoxymethod:: simgrid_load_platform
787       .. autodoxymethod:: simgrid_register_default
788       .. autodoxymethod:: simgrid_register_function
789
790 Run the simulation
791 ------------------
792
793 .. tabs::
794
795    .. group-tab:: C++
796
797       .. autodoxymethod:: simgrid::s4u::Engine::get_clock()
798       .. autodoxymethod:: simgrid::s4u::Engine::run()
799
800    .. group-tab:: Python
801    
802       .. automethod:: simgrid.Engine.get_clock
803       .. automethod:: simgrid.Engine.run
804
805    .. group-tab:: C
806
807       .. autodoxymethod:: simgrid_get_clock
808       .. autodoxymethod:: simgrid_run
809
810 Retrieving actors
811 -----------------
812
813 .. tabs::
814
815    .. group-tab:: C++
816
817       .. autodoxymethod:: simgrid::s4u::Engine::get_actor_count()
818       .. autodoxymethod:: simgrid::s4u::Engine::get_all_actors()
819       .. autodoxymethod:: simgrid::s4u::Engine::get_filtered_actors(const std::function< bool(ActorPtr)> &filter)
820
821    .. group-tab:: C
822
823       .. autodoxymethod:: simgrid_get_actor_count()
824
825 Retrieving hosts
826 ----------------
827
828 .. tabs::
829
830    .. group-tab:: C++
831
832       .. autodoxymethod:: simgrid::s4u::Engine::get_all_hosts()
833       .. autodoxymethod:: simgrid::s4u::Engine::get_host_count()
834       .. autodoxymethod:: simgrid::s4u::Engine::get_filtered_hosts(const std::function< bool(Host *)> &filter)
835       .. autodoxymethod:: simgrid::s4u::Engine::host_by_name(const std::string &name)
836       .. autodoxymethod:: simgrid::s4u::Engine::host_by_name_or_null(const std::string &name)
837
838    .. group-tab:: Python
839
840       .. automethod:: simgrid.Engine.get_all_hosts
841
842    .. group-tab:: C
843
844       See also :cpp:func:`sg_host_list` and :cpp:func:`sg_host_count`.
845
846 Retrieving links
847 ----------------
848
849 .. tabs::
850
851    .. group-tab:: C++
852
853       .. autodoxymethod:: simgrid::s4u::Engine::get_all_links()
854       .. autodoxymethod:: simgrid::s4u::Engine::get_link_count()
855       .. autodoxymethod:: simgrid::s4u::Engine::get_filtered_links
856       .. autodoxymethod:: simgrid::s4u::Engine::link_by_name(const std::string &name)
857       .. autodoxymethod:: simgrid::s4u::Engine::link_by_name_or_null(const std::string &name)
858
859 Interacting with the routing
860 ----------------------------
861
862 .. tabs::
863
864    .. group-tab:: C++
865
866       .. autodoxymethod:: simgrid::s4u::Engine::get_all_netpoints()
867       .. autodoxymethod:: simgrid::s4u::Engine::get_filtered_netzones()
868       .. autodoxymethod:: simgrid::s4u::Engine::get_instance()
869       .. autodoxymethod:: simgrid::s4u::Engine::get_netzone_root()
870       .. autodoxymethod:: simgrid::s4u::Engine::netpoint_by_name_or_null(const std::string &name)
871       .. autodoxymethod:: simgrid::s4u::Engine::netzone_by_name_or_null(const std::string &name)
872       .. autodoxymethod:: simgrid::s4u::Engine::set_netzone_root(const NetZone *netzone)
873
874 Signals
875 -------
876
877 .. tabs::
878
879    .. group-tab:: C++
880
881       .. autodoxyvar:: simgrid::s4u::Engine::on_deadlock
882       .. autodoxyvar:: simgrid::s4u::Engine::on_platform_created
883       .. autodoxyvar:: simgrid::s4u::Engine::on_platform_creation
884       .. autodoxyvar:: simgrid::s4u::Engine::on_simulation_end
885       .. autodoxyvar:: simgrid::s4u::Engine::on_time_advance
886
887 .. _API_s4u_Mailbox:
888
889 ================
890 ⁣  class Mailbox
891 ================
892
893 .. autodoxyclass:: simgrid::s4u::Mailbox
894
895 Please also refer to the :ref:`full doc on s4u::Mailbox <s4u_mailbox>`.
896
897 Basic management
898 ----------------
899
900 .. tabs::
901
902    .. group-tab:: C++
903
904       .. code-block:: C++
905
906          #include <simgrid/s4u/Mailbox.hpp>
907
908       Note that there is no MailboxPtr type, and that you cannot use the RAII
909       idiom on mailboxes because they are internal objects to the simulation
910       engine. Once created, there is no way to destroy a mailbox before the end
911       of the simulation.
912          
913       .. autodoxymethod:: simgrid::s4u::Mailbox::by_name(const std::string &name)
914
915    .. group-tab:: Python
916
917       .. automethod:: simgrid.Mailbox.by_name
918
919 Querying info
920 -------------
921
922 .. tabs::
923
924    .. group-tab:: C++
925
926       .. autodoxymethod:: simgrid::s4u::Mailbox::get_cname() const
927       .. autodoxymethod:: simgrid::s4u::Mailbox::get_name() const
928
929    .. group-tab:: Python
930
931       .. autoattribute:: simgrid.Mailbox.name
932
933 Sending data
934 ------------
935
936 .. tabs::
937
938    .. group-tab:: C++
939
940       .. autodoxymethod:: simgrid::s4u::Mailbox::put(void *payload, uint64_t simulated_size_in_bytes)
941       .. autodoxymethod:: simgrid::s4u::Mailbox::put(void *payload, uint64_t simulated_size_in_bytes, double timeout)
942       .. autodoxymethod:: simgrid::s4u::Mailbox::put_async(void *data, uint64_t simulated_size_in_bytes)
943       .. autodoxymethod:: simgrid::s4u::Mailbox::put_init()
944       .. autodoxymethod:: simgrid::s4u::Mailbox::put_init(void *data, uint64_t simulated_size_in_bytes)
945
946    .. group-tab:: Python
947
948       .. automethod:: simgrid.Mailbox.put
949       .. automethod:: simgrid.Mailbox.put_async
950
951
952 Receiving data
953 --------------
954
955 .. tabs::
956
957    .. group-tab:: C++
958
959       .. autodoxymethod:: simgrid::s4u::Mailbox::empty()
960       .. autodoxymethod:: simgrid::s4u::Mailbox::front()
961       .. autodoxymethod:: simgrid::s4u::Mailbox::get()
962       .. autodoxymethod:: simgrid::s4u::Mailbox::get(double timeout)
963       .. autodoxymethod:: simgrid::s4u::Mailbox::get_async(void **data)
964       .. autodoxymethod:: simgrid::s4u::Mailbox::get_init()
965       .. autodoxymethod:: simgrid::s4u::Mailbox::iprobe(int type, bool(*match_fun)(void *, void *, kernel::activity::CommImpl *), void *data)
966       .. autodoxymethod:: simgrid::s4u::Mailbox::listen()
967       .. autodoxymethod:: simgrid::s4u::Mailbox::ready()
968
969    .. group-tab:: Python
970
971        .. automethod:: simgrid.Mailbox.get
972
973    .. group-tab:: C
974
975       .. autodoxymethod:: sg_mailbox_listen(const char *alias)
976
977 Receiving actor
978 ---------------
979
980 See :ref:`s4u_receiving_actor`.
981
982 .. tabs::
983
984    .. group-tab:: C++
985
986       .. autodoxymethod:: simgrid::s4u::Mailbox::get_receiver()
987       .. autodoxymethod:: simgrid::s4u::Mailbox::set_receiver(ActorPtr actor)
988
989    .. group-tab:: C
990
991       .. autodoxymethod:: ::sg_mailbox_set_receiver(const char *alias)
992                   
993 .. _API_s4u_Resource:
994
995 =========
996 Resources
997 =========
998
999 .. _API_s4u_Disk:
1000
1001 =============
1002 ⁣  class Disk
1003 =============
1004
1005 .. autodoxyclass:: simgrid::s4u::Disk
1006
1007 Basic management
1008 ----------------
1009
1010 .. tabs::
1011
1012    .. group-tab:: C++
1013
1014       .. code-block:: C++
1015
1016          #include <simgrid/s4u/Disk.hpp>
1017
1018       Note that there is no DiskPtr type, and that you cannot use the RAII
1019       idiom on disks because SimGrid does not allow (yet) to create nor
1020       destroy resources once the simulation is started. 
1021          
1022
1023 Querying info
1024 -------------
1025
1026 .. tabs::
1027
1028    .. group-tab:: C++
1029
1030       .. autodoxymethod:: simgrid::s4u::Disk::get_cname() const
1031       .. autodoxymethod:: simgrid::s4u::Disk::get_host() const
1032       .. autodoxymethod:: simgrid::s4u::Disk::get_name() const
1033       .. autodoxymethod:: simgrid::s4u::Disk::get_properties() const
1034       .. autodoxymethod:: simgrid::s4u::Disk::get_property(const std::string &key) const
1035       .. autodoxymethod:: simgrid::s4u::Disk::get_read_bandwidth() const
1036       .. autodoxymethod:: simgrid::s4u::Disk::get_write_bandwidth() const
1037       .. autodoxymethod:: simgrid::s4u::Disk::set_property(const std::string &, const std::string &value)
1038
1039 I/O operations
1040 --------------
1041
1042 .. tabs::
1043
1044    .. group-tab:: C++
1045
1046       .. autodoxymethod:: simgrid::s4u::Disk::io_init(sg_size_t size, s4u::Io::OpType type)
1047       .. autodoxymethod:: simgrid::s4u::Disk::read(sg_size_t size)
1048       .. autodoxymethod:: simgrid::s4u::Disk::read_async(sg_size_t size)
1049       .. autodoxymethod:: simgrid::s4u::Disk::write(sg_size_t size)
1050       .. autodoxymethod:: simgrid::s4u::Disk::write_async(sg_size_t size)
1051
1052 Signals
1053 -------
1054
1055 .. tabs::
1056
1057    .. group-tab:: C++
1058
1059       .. autodoxyvar:: simgrid::s4u::Disk::on_creation
1060       .. autodoxyvar:: simgrid::s4u::Disk::on_destruction
1061       .. autodoxyvar:: simgrid::s4u::Disk::on_state_change
1062
1063
1064 .. _API_s4u_Host:
1065
1066 =============
1067 ⁣  class Host
1068 =============
1069
1070 .. autodoxyclass:: simgrid::s4u::Host
1071
1072 Basic management
1073 ----------------
1074
1075 .. tabs::
1076
1077    .. group-tab:: C++
1078
1079       .. code-block:: C++
1080
1081          #include <simgrid/s4u/Host.hpp>
1082
1083       Note that there is no HostPtr type, and that you cannot use the RAII
1084       idiom on hosts because SimGrid does not allow (yet) to create nor
1085       destroy resources once the simulation is started. 
1086
1087       .. autodoxymethod:: simgrid::s4u::Host::destroy()
1088
1089    .. group-tab:: Python
1090
1091       .. code:: Python
1092
1093          from simgrid import Host
1094
1095    .. group-tab:: C
1096
1097       .. code:: C
1098
1099          #include <simgrid/host.h>
1100
1101       .. doxygentypedef:: sg_host_t
1102       .. cpp:type:: const s4u_Host* const_sg_host_t
1103
1104          Pointer to a constant host object.
1105
1106 Retrieving hosts
1107 ----------------
1108
1109 .. tabs::
1110
1111    .. group-tab:: C++
1112
1113       See also :cpp:func:`simgrid::s4u::Engine::get_all_hosts`.
1114
1115       .. autodoxymethod:: simgrid::s4u::Host::by_name(const std::string &name)
1116       .. autodoxymethod:: simgrid::s4u::Host::by_name_or_null(const std::string &name)
1117       .. autodoxymethod:: simgrid::s4u::Host::current()
1118
1119    .. group-tab:: Python
1120
1121       See also :py:func:`simgrid.Engine.get_all_hosts`.
1122
1123       .. automethod:: simgrid.Host.by_name
1124       .. automethod:: simgrid.Host.current
1125
1126    .. group-tab:: C
1127
1128       .. autodoxymethod:: sg_host_by_name(const char *name)
1129       .. autodoxymethod:: sg_host_count()
1130       .. autodoxymethod:: sg_host_list()
1131       .. autodoxymethod:: sg_hosts_as_dynar()
1132
1133 Querying info
1134 -------------
1135
1136 .. tabs::
1137
1138    .. group-tab:: C++
1139
1140       .. autodoxymethod:: simgrid::s4u::Host::get_cname() const
1141       .. autodoxymethod:: simgrid::s4u::Host::get_core_count() const
1142       .. autodoxymethod:: simgrid::s4u::Host::get_name() const
1143       .. autodoxymethod:: simgrid::s4u::Host::get_available_speed() const
1144       .. autodoxymethod:: simgrid::s4u::Host::get_load() const
1145       .. autodoxymethod:: simgrid::s4u::Host::get_speed() const
1146
1147    .. group-tab:: Python
1148
1149       .. autoattribute:: simgrid.Host.name
1150       .. autoattribute:: simgrid.Host.load
1151       .. autoattribute:: simgrid.Host.pstate
1152       .. autoattribute:: simgrid.Host.speed
1153
1154    .. group-tab:: C
1155
1156       .. autodoxymethod:: sg_host_core_count(const_sg_host_t host)
1157       .. autodoxymethod:: sg_host_dump(const_sg_host_t ws)
1158       .. autodoxymethod:: sg_host_get_name(const_sg_host_t host)
1159       .. autodoxymethod:: sg_host_load(const_sg_host_t host)
1160       .. autodoxymethod:: sg_host_speed(const_sg_host_t host)
1161
1162 User data and properties
1163 ------------------------
1164
1165 .. tabs::
1166
1167    .. group-tab:: C++
1168
1169       .. autodoxymethod:: simgrid::s4u::Host::get_properties() const
1170       .. autodoxymethod:: simgrid::s4u::Host::get_property(const std::string &key) const
1171       .. autodoxymethod:: simgrid::s4u::Host::set_properties(const std::map< std::string, std::string > &properties)
1172       .. autodoxymethod:: simgrid::s4u::Host::set_property(const std::string &key, const std::string &value)
1173
1174    .. group-tab:: C
1175
1176       .. autodoxymethod:: sg_host_set_property_value(sg_host_t host, const char *name, const char *value)
1177       .. autodoxymethod:: sg_host_get_properties(const_sg_host_t host)
1178       .. autodoxymethod:: sg_host_get_property_value(const_sg_host_t host, const char *name)
1179       .. autodoxymethod:: sg_host_extension_create(void(*deleter)(void *))
1180       .. autodoxymethod:: sg_host_extension_get(const_sg_host_t host, size_t rank)
1181
1182 Retrieving components
1183 ---------------------
1184
1185 .. tabs::
1186
1187    .. group-tab:: C++
1188
1189       .. autodoxymethod:: simgrid::s4u::Host::add_disk(Disk *disk)
1190       .. autodoxymethod:: simgrid::s4u::Host::get_actor_count() const
1191       .. autodoxymethod:: simgrid::s4u::Host::get_all_actors() const
1192       .. autodoxymethod:: simgrid::s4u::Host::get_disks() const
1193       .. autodoxymethod:: simgrid::s4u::Host::remove_disk(const std::string &disk_name)
1194
1195    .. group-tab:: C
1196
1197       .. autodoxymethod:: sg_host_get_actor_list(const_sg_host_t host, xbt_dynar_t whereto)
1198
1199 On/Off
1200 ------
1201
1202 .. tabs::
1203
1204    .. group-tab:: C++
1205
1206       .. autodoxymethod:: simgrid::s4u::Host::is_on() const
1207       .. autodoxymethod:: simgrid::s4u::Host::turn_off()
1208       .. autodoxymethod:: simgrid::s4u::Host::turn_on()
1209
1210    .. group-tab:: C
1211
1212       .. autodoxymethod:: sg_host_is_on(const_sg_host_t host)
1213       .. autodoxymethod:: sg_host_turn_off(sg_host_t host)
1214       .. autodoxymethod:: sg_host_turn_on(sg_host_t host)
1215
1216 DVFS
1217 ----
1218
1219 .. tabs::
1220
1221    .. group-tab:: C++
1222
1223       .. autodoxymethod:: simgrid::s4u::Host::get_pstate() const
1224       .. autodoxymethod:: simgrid::s4u::Host::get_pstate_count() const
1225       .. autodoxymethod:: simgrid::s4u::Host::get_pstate_speed(int pstate_index) const
1226       .. autodoxymethod:: simgrid::s4u::Host::set_pstate(int pstate_index)
1227       .. autodoxymethod:: simgrid::s4u::Host::set_speed_profile(kernel::profile::Profile *p)
1228       .. autodoxymethod:: simgrid::s4u::Host::set_state_profile(kernel::profile::Profile *p)
1229
1230    .. group-tab:: Python
1231
1232       .. automethod:: simgrid.Host.get_pstate_count
1233       .. automethod:: simgrid.Host.get_pstate_speed
1234
1235    .. group-tab:: C
1236
1237       .. autodoxymethod:: sg_host_get_available_speed(const_sg_host_t host)
1238       .. autodoxymethod:: sg_host_get_nb_pstates(const_sg_host_t host)
1239       .. autodoxymethod:: sg_host_get_pstate(const_sg_host_t host)
1240       .. autodoxymethod:: sg_host_get_pstate_speed(const_sg_host_t host, int pstate_index)
1241       .. autodoxymethod:: sg_host_set_pstate(sg_host_t host, int pstate)
1242
1243 Execution
1244 ---------
1245
1246 .. tabs::
1247
1248    .. group-tab:: C++
1249
1250       .. autodoxymethod:: simgrid::s4u::Host::exec_async(double flops_amounts)
1251       .. autodoxymethod:: simgrid::s4u::Host::execute(double flops)
1252       .. autodoxymethod:: simgrid::s4u::Host::execute(double flops, double priority)
1253
1254 Platform and routing
1255 --------------------
1256
1257 .. tabs::
1258
1259    .. group-tab:: C++
1260
1261       .. autodoxymethod:: simgrid::s4u::Host::get_englobing_zone()
1262       .. autodoxymethod:: simgrid::s4u::Host::get_netpoint() const
1263       .. autodoxymethod:: simgrid::s4u::Host::route_to(const Host *dest, std::vector< Link * > &links, double *latency) const
1264       .. autodoxymethod:: simgrid::s4u::Host::route_to(const Host *dest, std::vector< kernel::resource::LinkImpl * > &links, double *latency) const
1265       .. autodoxymethod:: simgrid::s4u::Host::send_to(Host *dest, double byte_amount)
1266
1267    .. group-tab:: C
1268
1269       .. autodoxymethod:: sg_host_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links)
1270       .. autodoxymethod:: sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to)
1271       .. autodoxymethod:: sg_host_route_latency(const_sg_host_t from, const_sg_host_t to)
1272       .. autodoxymethod:: sg_host_send_to(sg_host_t from, sg_host_t to, double byte_amount)
1273
1274 Signals
1275 -------
1276
1277 .. tabs::
1278
1279    .. group-tab:: C++
1280
1281       .. autodoxyvar:: simgrid::s4u::Host::on_creation
1282       .. autodoxyvar:: simgrid::s4u::Host::on_destruction
1283       .. autodoxyvar:: simgrid::s4u::Host::on_speed_change
1284       .. autodoxyvar:: simgrid::s4u::Host::on_state_change
1285
1286 .. _API_s4u_Link:
1287
1288 =============
1289 ⁣  class Link
1290 =============
1291
1292 .. autodoxyclass:: simgrid::s4u::Link
1293
1294 Basic management
1295 ----------------
1296
1297 .. tabs::
1298
1299    .. group-tab:: C++
1300
1301       .. code-block:: C++
1302
1303          #include <simgrid/s4u/Link.hpp>
1304
1305       Note that there is no LinkPtr type, and that you cannot use the RAII
1306       idiom on hosts because SimGrid does not allow (yet) to create nor
1307       destroy resources once the simulation is started. 
1308
1309    .. group-tab:: Python
1310
1311       .. code:: Python
1312
1313          from simgrid import Link
1314
1315    .. group-tab:: C
1316
1317       .. code:: C
1318
1319          #include <simgrid/link.h>
1320
1321       .. doxygentypedef:: sg_link_t
1322       .. cpp:type:: const s4u_Link* const_sg_link_t
1323
1324          Pointer to a constant link object.
1325
1326 Retrieving links
1327 ----------------
1328
1329 .. tabs::
1330
1331    .. group-tab:: C++
1332
1333       See also :cpp:func:`simgrid::s4u::Engine::get_all_links`.
1334
1335       .. autodoxymethod:: simgrid::s4u::Link::by_name(const std::string &name)
1336       .. autodoxymethod:: simgrid::s4u::Link::by_name_or_null(const std::string &name)
1337
1338    .. group-tab:: C
1339
1340       .. autodoxymethod:: sg_link_by_name(const char *name)
1341       .. autodoxymethod:: sg_link_count()
1342       .. autodoxymethod:: sg_link_list()
1343
1344 Querying info
1345 --------------
1346
1347 .. tabs::
1348
1349    .. group-tab:: C++
1350
1351       .. autodoxymethod:: simgrid::s4u::Link::get_bandwidth() const
1352       .. autodoxymethod:: simgrid::s4u::Link::get_cname() const
1353       .. autodoxymethod:: simgrid::s4u::Link::get_latency() const
1354       .. autodoxymethod:: simgrid::s4u::Link::get_name() const
1355       .. autodoxymethod:: simgrid::s4u::Link::get_sharing_policy() const
1356       .. autodoxymethod:: simgrid::s4u::Link::get_usage() const
1357       .. autodoxymethod:: simgrid::s4u::Link::is_used() const
1358
1359    .. group-tab:: C
1360
1361       .. autodoxymethod:: sg_link_bandwidth(const_sg_link_t link)
1362       .. autodoxymethod:: sg_link_is_shared(const_sg_link_t link)
1363       .. autodoxymethod:: sg_link_latency(const_sg_link_t link)
1364       .. autodoxymethod:: sg_link_name(const_sg_link_t link)
1365
1366 User data and properties
1367 ------------------------
1368
1369 .. tabs::
1370
1371    .. group-tab:: C++
1372
1373       .. autodoxymethod:: simgrid::s4u::Link::get_property(const std::string &key) const
1374       .. autodoxymethod:: simgrid::s4u::Link::set_property(const std::string &key, const std::string &value)
1375
1376    .. group-tab:: C
1377
1378       .. autodoxymethod:: sg_link_data(const_sg_link_t link)
1379       .. autodoxymethod:: sg_link_data_set(sg_link_t link, void *data)
1380
1381 On/Off
1382 ------
1383
1384 .. tabs::
1385
1386    .. group-tab:: C++
1387
1388       See also :cpp:func:`simgrid::s4u::Link::set_state_profile`.
1389
1390       .. autodoxymethod:: simgrid::s4u::Link::is_on() const
1391       .. autodoxymethod:: simgrid::s4u::Link::turn_off()
1392       .. autodoxymethod:: simgrid::s4u::Link::turn_on()
1393
1394 Dynamic profiles
1395 ----------------
1396
1397 .. tabs::
1398
1399    .. group-tab:: C++
1400
1401       .. autodoxymethod:: simgrid::s4u::Link::set_bandwidth_profile(kernel::profile::Profile *profile)
1402       .. autodoxymethod:: simgrid::s4u::Link::set_latency_profile(kernel::profile::Profile *profile)
1403       .. autodoxymethod:: simgrid::s4u::Link::set_state_profile(kernel::profile::Profile *profile)
1404
1405 Signals
1406 -------
1407
1408 .. tabs::
1409
1410    .. group-tab:: C++
1411
1412       .. autodoxyvar:: simgrid::s4u::Link::on_bandwidth_change
1413       .. cpp:var:: xbt::signal<void(kernel::resource::NetworkAction&, Host* src, Host* dst)> Link::on_communicate
1414       .. autodoxyvar:: simgrid::s4u::Link::on_communication_state_change
1415       .. autodoxyvar:: simgrid::s4u::Link::on_creation
1416       .. autodoxyvar:: simgrid::s4u::Link::on_destruction
1417       .. autodoxyvar:: simgrid::s4u::Link::on_state_change
1418
1419 .. _API_s4u_NetZone:
1420
1421 ================
1422 ⁣  class NetZone
1423 ================
1424
1425 .. autodoxyclass:: simgrid::s4u::NetZone
1426
1427 Basic management
1428 ----------------
1429
1430 .. tabs::
1431
1432    .. group-tab:: C++
1433
1434       .. code-block:: C++
1435
1436          #include <simgrid/s4u/NetZone.hpp>
1437
1438       Note that there is no NetZonePtr type, and that you cannot use the RAII
1439       idiom on network zones because SimGrid does not allow (yet) to create nor
1440       destroy resources once the simulation is started. 
1441
1442    .. group-tab:: C
1443
1444       .. code:: C
1445
1446          #include <simgrid/zone.h>
1447
1448       .. doxygentypedef:: sg_netzone_t
1449       .. cpp:type:: const s4u_NetZone* const_sg_netzone_t
1450
1451          Pointer to a constant network zone object.
1452
1453 Retrieving zones
1454 ----------------
1455
1456 .. tabs::
1457
1458    .. group-tab:: C++
1459
1460       See :cpp:func:`simgrid::s4u::Engine::get_netzone_root`,
1461       :cpp:func:`simgrid::s4u::Engine::netzone_by_name_or_null` and
1462       :cpp:func:`simgrid::s4u::Engine::get_filtered_netzones`.
1463
1464    .. group-tab:: C
1465
1466       .. autodoxymethod:: sg_zone_get_by_name(const char *name)
1467       .. autodoxymethod:: sg_zone_get_root()
1468
1469 Querying info
1470 --------------
1471
1472 .. tabs::
1473
1474    .. group-tab:: C++
1475
1476       .. autodoxymethod:: simgrid::s4u::NetZone::get_cname() const
1477       .. autodoxymethod:: simgrid::s4u::NetZone::get_name() const
1478
1479    .. group-tab:: C
1480
1481       .. autodoxymethod:: sg_zone_get_name(const_sg_netzone_t zone)
1482
1483 User data and properties
1484 ------------------------
1485
1486 .. tabs::
1487
1488    .. group-tab:: C++
1489
1490       .. autodoxymethod:: simgrid::s4u::NetZone::get_properties() const
1491       .. autodoxymethod:: simgrid::s4u::NetZone::get_property(const std::string &key) const
1492       .. autodoxymethod:: simgrid::s4u::NetZone::set_property(const std::string &key, const std::string &value)
1493
1494    .. group-tab:: C
1495
1496       .. autodoxymethod:: sg_zone_get_property_value(const_sg_netzone_t as, const char *name)
1497       .. autodoxymethod:: sg_zone_set_property_value(sg_netzone_t netzone, const char *name, const char *value)
1498
1499 Retrieving components
1500 ---------------------
1501
1502 .. tabs::
1503
1504    .. group-tab:: C++
1505
1506       .. autodoxymethod:: simgrid::s4u::NetZone::get_all_hosts() const
1507       .. autodoxymethod:: simgrid::s4u::NetZone::get_host_count() const
1508
1509    .. group-tab:: C
1510
1511       .. autodoxymethod:: sg_zone_get_hosts(const_sg_netzone_t zone, xbt_dynar_t whereto)
1512
1513 Routing data
1514 ------------
1515
1516 .. tabs::
1517
1518    .. group-tab:: C++
1519
1520       .. autodoxymethod:: simgrid::s4u::NetZone::add_bypass_route(kernel::routing::NetPoint *src, kernel::routing::NetPoint *dst, kernel::routing::NetPoint *gw_src, kernel::routing::NetPoint *gw_dst, std::vector< kernel::resource::LinkImpl * > &link_list, bool symmetrical)
1521       .. autodoxymethod:: simgrid::s4u::NetZone::add_component(kernel::routing::NetPoint *elm)
1522       .. autodoxymethod:: simgrid::s4u::NetZone::add_route(kernel::routing::NetPoint *src, kernel::routing::NetPoint *dst, kernel::routing::NetPoint *gw_src, kernel::routing::NetPoint *gw_dst, std::vector< kernel::resource::LinkImpl * > &link_list, bool symmetrical)
1523       .. autodoxymethod:: simgrid::s4u::NetZone::get_children() const
1524       .. autodoxymethod:: simgrid::s4u::NetZone::get_father()
1525
1526    .. group-tab:: C
1527
1528       .. autodoxymethod:: sg_zone_get_sons(const_sg_netzone_t zone, xbt_dict_t whereto)
1529
1530 Signals
1531 -------
1532
1533 .. tabs::
1534
1535   .. group-tab:: C++
1536
1537      .. autodoxyvar:: simgrid::s4u::NetZone::on_creation
1538      .. autodoxyvar:: simgrid::s4u::NetZone::on_route_creation
1539      .. autodoxyvar:: simgrid::s4u::NetZone::on_seal
1540
1541 .. _API_s4u_VirtualMachine:
1542
1543 =======================
1544 ⁣  class VirtualMachine
1545 =======================
1546
1547
1548 .. autodoxyclass:: simgrid::s4u::VirtualMachine
1549
1550 Basic management
1551 ----------------
1552 .. tabs::
1553
1554    .. group-tab:: C++
1555
1556       .. code-block:: C++
1557
1558          #include <simgrid/s4u/VirtualMachine.hpp>
1559
1560       Note that there is no VirtualMachinePtr type, and that you cannot use the RAII
1561       idiom on virtual machines. There is no good reason for that and should change in the future.
1562
1563    .. group-tab:: C
1564
1565       .. code:: C
1566
1567          #include <simgrid/vm.h>
1568
1569       .. doxygentypedef:: sg_vm_t
1570       .. cpp:type:: const s4u_VirtualMachine* const_sg_vm_t
1571
1572          Pointer to a constant virtual machine object.
1573
1574 Creating VMs
1575 ------------
1576
1577 .. tabs::
1578
1579    .. group-tab:: C++
1580
1581       .. autodoxymethod:: simgrid::s4u::VirtualMachine::VirtualMachine(const std::string &name, Host *physical_host, int core_amount)
1582       .. autodoxymethod:: simgrid::s4u::VirtualMachine::VirtualMachine(const std::string &name, Host *physical_host, int core_amount, size_t ramsize)
1583       .. autodoxymethod:: simgrid::s4u::VirtualMachine::destroy
1584
1585    .. group-tab:: C
1586
1587       .. autodoxymethod:: sg_vm_create_core
1588       .. autodoxymethod:: sg_vm_create_multicore
1589       .. autodoxymethod:: sg_vm_destroy
1590
1591 Querying info
1592 --------------
1593
1594 .. tabs::
1595
1596    .. group-tab:: C++
1597
1598       .. autodoxymethod:: simgrid::s4u::VirtualMachine::get_pm() const
1599       .. autodoxymethod:: simgrid::s4u::VirtualMachine::get_ramsize() const
1600       .. autodoxymethod:: simgrid::s4u::VirtualMachine::get_state()
1601
1602       .. autodoxymethod:: simgrid::s4u::VirtualMachine::set_bound(double bound)
1603       .. autodoxymethod:: simgrid::s4u::VirtualMachine::set_pm(Host *pm)
1604       .. autodoxymethod:: simgrid::s4u::VirtualMachine::set_ramsize(size_t ramsize)
1605
1606    .. group-tab:: C
1607
1608       .. autodoxymethod:: sg_vm_get_ramsize(const_sg_vm_t vm)
1609       .. autodoxymethod:: sg_vm_set_bound(sg_vm_t vm, double bound)
1610       .. autodoxymethod:: sg_vm_set_ramsize(sg_vm_t vm, size_t size)
1611
1612       .. autodoxymethod:: sg_vm_get_name
1613       .. autodoxymethod:: sg_vm_get_pm
1614       .. autodoxymethod:: sg_vm_is_created
1615       .. autodoxymethod:: sg_vm_is_running
1616       .. autodoxymethod:: sg_vm_is_suspended
1617
1618 Life cycle
1619 ----------
1620
1621 .. tabs::
1622
1623    .. group-tab:: C++
1624
1625       .. autodoxymethod:: simgrid::s4u::VirtualMachine::resume()
1626       .. autodoxymethod:: simgrid::s4u::VirtualMachine::shutdown()
1627       .. autodoxymethod:: simgrid::s4u::VirtualMachine::start()
1628       .. autodoxymethod:: simgrid::s4u::VirtualMachine::suspend()
1629
1630    .. group-tab:: C
1631
1632       .. autodoxymethod:: sg_vm_start
1633       .. autodoxymethod:: sg_vm_suspend
1634       .. autodoxymethod:: sg_vm_resume
1635       .. autodoxymethod:: sg_vm_shutdown
1636
1637 Signals
1638 -------
1639
1640 .. tabs::
1641
1642    .. group-tab:: C++
1643
1644       .. autodoxyvar:: simgrid::s4u::VirtualMachine::on_migration_end
1645       .. autodoxyvar:: simgrid::s4u::VirtualMachine::on_migration_start
1646       .. autodoxyvar:: simgrid::s4u::VirtualMachine::on_resume
1647       .. autodoxyvar:: simgrid::s4u::VirtualMachine::on_shutdown
1648       .. autodoxyvar:: simgrid::s4u::VirtualMachine::on_start
1649       .. autodoxyvar:: simgrid::s4u::VirtualMachine::on_started
1650       .. autodoxyvar:: simgrid::s4u::VirtualMachine::on_suspend
1651
1652 .. _API_s4u_Activity:
1653
1654 ==============
1655 class Activity
1656 ==============
1657
1658 .. autodoxyclass:: simgrid::s4u::Activity
1659
1660    **Known subclasses:**
1661    :ref:`Communications <API_s4u_Comm>` (started on Mailboxes and consuming links),
1662    :ref:`Executions <API_s4u_Exec>` (started on Host and consuming CPU resources)
1663    :ref:`I/O <API_s4u_Io>` (started on and consumming disks).
1664    See also the :ref:`section on activities <s4u_Activities>` above.
1665
1666 Basic management
1667 ----------------
1668
1669 .. tabs::
1670
1671    .. group-tab:: C++
1672
1673       .. code-block:: C++
1674
1675          #include <simgrid/s4u/Activity.hpp>
1676
1677       .. doxygentypedef:: ActivityPtr
1678
1679 Querying info
1680 -------------
1681
1682 .. tabs::
1683
1684    .. group-tab:: C++
1685
1686       .. autodoxymethod:: simgrid::s4u::Activity::get_cname
1687       .. autodoxymethod:: simgrid::s4u::Activity::get_name
1688       .. autodoxymethod:: simgrid::s4u::Activity::get_remaining()
1689       .. autodoxymethod:: simgrid::s4u::Activity::get_state()
1690       .. autodoxymethod:: simgrid::s4u::Activity::set_remaining(double remains)
1691       .. autodoxymethod:: simgrid::s4u::Activity::set_state(Activity::State state)
1692
1693
1694 Activities life cycle
1695 ---------------------
1696
1697 .. tabs::
1698
1699    .. group-tab:: C++
1700
1701       .. autodoxymethod:: simgrid::s4u::Activity::start
1702       .. autodoxymethod:: simgrid::s4u::Activity::cancel
1703       .. autodoxymethod:: simgrid::s4u::Activity::test
1704       .. autodoxymethod:: simgrid::s4u::Activity::wait
1705       .. autodoxymethod:: simgrid::s4u::Activity::wait_for
1706       .. autodoxymethod:: simgrid::s4u::Activity::wait_until(double time_limit)
1707       .. autodoxymethod:: simgrid::s4u::Activity::vetoable_start()
1708
1709 .. _API_s4u_Comm:
1710
1711 =============
1712 ⁣  class Comm
1713 =============
1714
1715 .. autodoxyclass:: simgrid::s4u::Comm
1716
1717 Basic management
1718 ----------------
1719
1720 .. tabs::
1721
1722    .. group-tab:: C++
1723
1724       .. code-block:: C++
1725
1726          #include <simgrid/s4u/Comm.hpp>
1727
1728       .. doxygentypedef:: CommPtr
1729
1730    .. group-tab:: Python
1731
1732       .. code:: Python
1733
1734          from simgrid import Comm
1735
1736 Querying info
1737 -------------
1738
1739 .. tabs::
1740
1741    .. group-tab:: C++
1742
1743       .. autodoxymethod:: simgrid::s4u::Comm::get_dst_data_size()
1744       .. autodoxymethod:: simgrid::s4u::Comm::get_mailbox()
1745       .. autodoxymethod:: simgrid::s4u::Comm::get_sender()
1746       .. autodoxymethod:: simgrid::s4u::Comm::set_dst_data(void **buff)
1747       .. autodoxymethod:: simgrid::s4u::Comm::set_dst_data(void **buff, size_t size)
1748       .. autodoxymethod:: simgrid::s4u::Comm::detach()
1749       .. autodoxymethod:: simgrid::s4u::Comm::detach(void(*clean_function)(void *))
1750       .. autodoxymethod:: simgrid::s4u::Comm::set_rate(double rate)
1751       .. autodoxymethod:: simgrid::s4u::Comm::set_src_data(void *buff)
1752       .. autodoxymethod:: simgrid::s4u::Comm::set_src_data(void *buff, size_t size)
1753       .. autodoxymethod:: simgrid::s4u::Comm::set_src_data_size(size_t size)
1754       .. autodoxymethod:: simgrid::s4u::Comm::set_tracing_category(const std::string &category)
1755
1756 Life cycle
1757 ----------
1758
1759 .. tabs::
1760
1761    .. group-tab:: C++
1762
1763       .. autodoxymethod:: simgrid::s4u::Comm::cancel
1764       .. autodoxymethod:: simgrid::s4u::Comm::start
1765       .. autodoxymethod:: simgrid::s4u::Comm::test
1766       .. autodoxymethod:: simgrid::s4u::Comm::test_any(const std::vector< CommPtr > *comms)
1767       .. autodoxymethod:: simgrid::s4u::Comm::wait
1768       .. autodoxymethod:: simgrid::s4u::Comm::wait_all(const std::vector< CommPtr > *comms)
1769       .. autodoxymethod:: simgrid::s4u::Comm::wait_any(const std::vector< CommPtr > *comms)
1770       .. autodoxymethod:: simgrid::s4u::Comm::wait_any_for(const std::vector< CommPtr > *comms_in, double timeout)
1771       .. autodoxymethod:: simgrid::s4u::Comm::wait_for
1772
1773    .. group-tab:: Python
1774
1775        .. automethod:: simgrid.Comm.test
1776        .. automethod:: simgrid.Comm.wait
1777        .. automethod:: simgrid.Comm.wait_all
1778        .. automethod:: simgrid.Comm.wait_any
1779
1780 Signals
1781 -------
1782
1783 .. tabs::
1784
1785    .. group-tab:: C++
1786
1787       .. autodoxyvar:: simgrid::s4u::Comm::on_completion
1788       .. autodoxyvar:: simgrid::s4u::Comm::on_receiver_start
1789       .. autodoxyvar:: simgrid::s4u::Comm::on_sender_start
1790
1791 .. _API_s4u_Exec:
1792
1793 =============
1794 ⁣  class Exec
1795 =============
1796
1797 .. autodoxyclass:: simgrid::s4u::Exec
1798
1799 Basic management
1800 ----------------
1801
1802 .. tabs::
1803
1804    .. group-tab:: C++
1805
1806       .. code-block:: C++
1807
1808          #include <simgrid/s4u/Exec.hpp>
1809
1810       .. doxygentypedef:: ExecPtr
1811
1812    .. group-tab:: Python
1813
1814       .. code:: Python
1815
1816          from simgrid import Exec
1817
1818 Querying info
1819 -------------
1820
1821 .. tabs::
1822
1823    .. group-tab:: C++
1824
1825       .. autodoxymethod:: simgrid::s4u::Exec::get_cost() const
1826       .. autodoxymethod:: simgrid::s4u::Exec::get_finish_time() const
1827       .. autodoxymethod:: simgrid::s4u::Exec::get_host() const
1828       .. autodoxymethod:: simgrid::s4u::Exec::get_host_number() const
1829       .. cpp:function:: double Exec::get_remaining()
1830
1831          On sequential executions, returns the amount of flops that remain to be done;
1832          This cannot be used on parallel executions.
1833       
1834       .. autodoxymethod:: simgrid::s4u::Exec::get_remaining_ratio
1835       .. autodoxymethod:: simgrid::s4u::Exec::get_start_time() const
1836       .. autodoxymethod:: simgrid::s4u::Exec::set_bound(double bound)
1837       .. autodoxymethod:: simgrid::s4u::Exec::set_host
1838       .. autodoxymethod:: simgrid::s4u::Exec::set_priority(double priority)
1839
1840    .. group-tab:: Python
1841
1842        .. autoattribute:: simgrid.Exec.host
1843        .. autoattribute:: simgrid.Exec.remaining
1844        .. autoattribute:: simgrid.Exec.remaining_ratio
1845
1846 Life cycle
1847 ----------
1848
1849 .. tabs::
1850
1851    .. group-tab:: C++
1852
1853       .. autodoxymethod:: simgrid::s4u::Exec::cancel
1854       .. autodoxymethod:: simgrid::s4u::Exec::set_timeout(double timeout)
1855       .. autodoxymethod:: simgrid::s4u::Exec::start
1856       .. autodoxymethod:: simgrid::s4u::Exec::test
1857       .. autodoxymethod:: simgrid::s4u::Exec::wait
1858       .. autodoxymethod:: simgrid::s4u::Exec::wait_any(std::vector< ExecPtr > *execs)
1859       .. autodoxymethod:: simgrid::s4u::Exec::wait_any_for(std::vector< ExecPtr > *execs, double timeout)
1860       .. autodoxymethod:: simgrid::s4u::Exec::wait_for
1861
1862    .. group-tab:: Python
1863
1864        .. automethod:: simgrid.Exec.cancel
1865        .. automethod:: simgrid.Exec.start
1866        .. automethod:: simgrid.Exec.test
1867        .. automethod:: simgrid.Exec.wait
1868
1869 Signals
1870 -------
1871
1872 .. tabs::
1873
1874    .. group-tab:: C++
1875
1876       .. cpp:var:: xbt::signal<void(Actor const&, Exec const&)> Exec::on_completion
1877       .. cpp:var:: xbt::signal<void(Actor const&, Exec const&)> Exec::on_start
1878
1879 .. _API_s4u_Io:
1880
1881 ===========
1882 ⁣  class Io
1883 ===========
1884
1885 .. autodoxyclass:: simgrid::s4u::Io
1886
1887 Basic management
1888 ----------------
1889
1890 .. tabs::
1891
1892    .. group-tab:: C++
1893
1894       .. code-block:: C++
1895
1896          #include <simgrid/s4u/Io.hpp>
1897
1898       .. doxygentypedef:: IoPtr
1899
1900 Querying info
1901 -------------
1902
1903 .. tabs::
1904
1905    .. group-tab:: C++
1906
1907       .. autodoxymethod:: simgrid::s4u::Io::get_performed_ioops() const
1908       .. autodoxymethod:: simgrid::s4u::Io::get_remaining
1909
1910 Life cycle
1911 ----------
1912
1913 .. tabs::
1914
1915    .. group-tab:: C++
1916
1917       .. autodoxymethod:: simgrid::s4u::Io::cancel
1918       .. autodoxymethod:: simgrid::s4u::Io::start
1919       .. autodoxymethod:: simgrid::s4u::Io::test
1920       .. autodoxymethod:: simgrid::s4u::Io::wait
1921       .. autodoxymethod:: simgrid::s4u::Io::wait_for
1922
1923 .. _API_s4u_Synchronizations:
1924
1925 =======================
1926 Synchronization Objects
1927 =======================
1928
1929 .. _API_s4u_Mutex:
1930
1931 ==============
1932 ⁣  Mutex
1933 ==============
1934
1935 .. autodoxyclass:: simgrid::s4u::Mutex
1936
1937 Basic management
1938 ----------------
1939
1940    .. tabs::
1941
1942       .. group-tab:: C++
1943
1944          .. code-block:: C++
1945
1946             #include <simgrid/s4u/Mutex.hpp>
1947
1948          .. doxygentypedef:: MutexPtr
1949
1950          .. autodoxymethod:: simgrid::s4u::Mutex::Mutex(kernel::activity::MutexImpl *mutex)
1951          .. autodoxymethod:: simgrid::s4u::Mutex::create()
1952          .. autodoxymethod:: simgrid::s4u::Mutex::~Mutex()
1953
1954       .. group-tab:: C
1955
1956          .. code-block:: C
1957
1958             #include <simgrid/mutex.h>
1959
1960          .. doxygentypedef:: sg_mutex_t
1961          .. cpp:type:: const s4u_Mutex* const_sg_mutex_t
1962
1963             Pointer to a constant mutex object.
1964
1965          .. autodoxymethod:: sg_mutex_init()
1966          .. autodoxymethod:: sg_mutex_destroy(const_sg_mutex_t mutex)
1967
1968 Locking
1969 -------
1970
1971    .. tabs::
1972
1973       .. group-tab:: C++
1974
1975          .. autodoxymethod:: simgrid::s4u::Mutex::lock()
1976          .. autodoxymethod:: simgrid::s4u::Mutex::try_lock()
1977          .. autodoxymethod:: simgrid::s4u::Mutex::unlock()
1978
1979       .. group-tab:: C
1980
1981          .. autodoxymethod:: sg_mutex_lock(sg_mutex_t mutex)
1982          .. autodoxymethod:: sg_mutex_try_lock(sg_mutex_t mutex)
1983          .. autodoxymethod:: sg_mutex_unlock(sg_mutex_t mutex)
1984
1985 .. _API_s4u_Barrier:
1986
1987 ================
1988 ⁣  Barrier
1989 ================
1990
1991 .. autodoxyclass:: simgrid::s4u::Barrier
1992
1993    .. tabs::
1994
1995       .. group-tab:: C++
1996
1997          .. code-block:: C++
1998
1999             #include <simgrid/s4u/Barrier.hpp>
2000
2001          .. doxygentypedef:: BarrierPtr
2002
2003          .. autodoxymethod:: simgrid::s4u::Barrier::Barrier(unsigned int expected_actors)
2004          .. autodoxymethod:: simgrid::s4u::Barrier::create(unsigned int expected_actors)
2005          .. autodoxymethod:: simgrid::s4u::Barrier::wait()
2006
2007       .. group-tab:: C
2008
2009          .. code-block:: C
2010
2011             #include <simgrid/barrier.hpp>
2012
2013          .. doxygentypedef:: sg_bar_t
2014          .. cpp:type:: const s4u_Barrier* const_sg_bar_t
2015
2016             Pointer to a constant barrier object.
2017
2018          .. autodoxymethod:: sg_barrier_init(unsigned int count)
2019          .. autodoxymethod:: sg_barrier_destroy(const_sg_bar_t bar)
2020          .. autodoxymethod:: sg_barrier_wait(sg_bar_t bar)
2021
2022
2023 .. _API_s4u_ConditionVariable:
2024
2025 ==========================
2026 ⁣  Condition variable
2027 ==========================
2028
2029 .. autodoxyclass:: simgrid::s4u::ConditionVariable
2030
2031 Basic management
2032 ----------------
2033
2034    .. tabs::
2035
2036       .. group-tab:: C++
2037
2038          .. code-block:: C++
2039
2040             #include <simgrid/s4u/ConditionVariable.hpp>
2041
2042          .. doxygentypedef:: ConditionVariablePtr
2043
2044          .. autodoxymethod:: simgrid::s4u::ConditionVariable::create()
2045
2046       .. group-tab:: C
2047
2048          .. code-block:: C
2049
2050             #include <simgrid/cond.h>
2051
2052          .. doxygentypedef:: sg_cond_t
2053          .. autodoxymethod:: sg_cond_init
2054          .. autodoxymethod:: sg_cond_destroy
2055
2056 Waiting and notifying
2057 ---------------------
2058
2059    .. tabs::
2060
2061       .. group-tab:: C++
2062
2063          .. autodoxymethod:: simgrid::s4u::ConditionVariable::notify_all()
2064          .. autodoxymethod:: simgrid::s4u::ConditionVariable::notify_one()
2065          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait(s4u::MutexPtr lock)
2066          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait(const std::unique_lock< s4u::Mutex > &lock)
2067          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait(const std::unique_lock< Mutex > &lock, P pred)
2068          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_for(const std::unique_lock< s4u::Mutex > &lock, double duration)
2069          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_for(const std::unique_lock< s4u::Mutex > &lock, double duration, P pred)
2070          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_for(const std::unique_lock< s4u::Mutex > &lock, std::chrono::duration< Rep, Period > duration)
2071          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_for(const std::unique_lock< s4u::Mutex > &lock, std::chrono::duration< Rep, Period > duration, P pred)
2072          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_until(const std::unique_lock< s4u::Mutex > &lock, const SimulationTimePoint< Duration > &timeout_time)
2073          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_until(const std::unique_lock< s4u::Mutex > &lock, const SimulationTimePoint< Duration > &timeout_time, P pred)
2074          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_until(const std::unique_lock< s4u::Mutex > &lock, double timeout_time)
2075          .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_until(const std::unique_lock< s4u::Mutex > &lock, double timeout_time, P pred)
2076
2077       .. group-tab:: C
2078
2079          .. autodoxymethod:: sg_cond_notify_all
2080          .. autodoxymethod:: sg_cond_notify_one
2081          .. autodoxymethod:: sg_cond_wait
2082          .. autodoxymethod:: sg_cond_wait_for
2083
2084 .. _API_s4u_Semaphore:
2085
2086 ==================
2087 ⁣  Semaphore
2088 ==================
2089
2090 .. autodoxyclass:: simgrid::s4u::Semaphore
2091
2092
2093 Basic management
2094 ----------------
2095
2096    .. tabs::
2097
2098       .. group-tab:: C++
2099
2100          .. code-block:: C++
2101
2102             #include <simgrid/s4u/Semaphore.hpp>
2103
2104          .. doxygentypedef:: SemaphorePtr
2105          .. autodoxymethod:: simgrid::s4u::Semaphore::Semaphore(unsigned int initial_capacity)
2106          .. autodoxymethod:: simgrid::s4u::Semaphore::~Semaphore()
2107          .. autodoxymethod:: simgrid::s4u::Semaphore::create(unsigned int initial_capacity)
2108
2109       .. group-tab:: C
2110
2111          .. code-block:: C
2112
2113             #include <simgrid/semaphore.h>
2114
2115          .. doxygentypedef:: sg_sem_t
2116          .. cpp:type:: const s4u_Semaphore* const_sg_sem_t
2117
2118             Pointer to a constant semaphore object.
2119
2120          .. autodoxymethod:: sg_sem_init(int initial_value)
2121          .. autodoxymethod:: sg_sem_destroy(const_sg_sem_t sem)
2122
2123 Locking
2124 -------
2125
2126    .. tabs::
2127
2128       .. group-tab:: C++
2129
2130          .. autodoxymethod:: simgrid::s4u::Semaphore::acquire()
2131          .. autodoxymethod:: simgrid::s4u::Semaphore::acquire_timeout(double timeout)
2132          .. autodoxymethod:: simgrid::s4u::Semaphore::get_capacity()
2133          .. autodoxymethod:: simgrid::s4u::Semaphore::release()
2134          .. autodoxymethod:: simgrid::s4u::Semaphore::would_block()
2135
2136       .. group-tab:: C
2137
2138          .. autodoxymethod:: sg_sem_acquire(sg_sem_t sem)
2139          .. autodoxymethod:: sg_sem_acquire_timeout(sg_sem_t sem, double timeout)
2140          .. autodoxymethod:: sg_sem_get_capacity(sg_sem_t sem)
2141          .. autodoxymethod:: sg_sem_release(sg_sem_t sem)
2142          .. autodoxymethod:: sg_sem_would_block(sg_sem_t sem)
2143
2144 .. |hr| raw:: html
2145
2146    <hr />