settings.
Since v3.20 (June 2018), S4U is the way to go for long-term
-projects. It is feature complete, but may still evolve slightly in
+projects. It is feature complete, but may still evolve slightly in
future releases. It can already be used to do everything that can be
done in SimGrid, but you may have to adapt your code in future
releases. When this happens, compiling your code will produce
deprecation warnings for 4 releases (one year) before the removal of
-the old symbols.
+the old symbols.
If you want an API that will never ever evolve in the future, you
-should use the :ref:`deprecated MSG API <MSG_doc>` instead.
+should use the :ref:`deprecated MSG API <MSG_doc>` instead.
Main Concepts
*************
The :ref:`simgrid::s4u::this_actor <API_s4u_this_actor>` namespace
provides many helper functions to simplify the code of actors.
-- **Simulation Elements**
+.. rst-class:: compact-list
- - :ref:`class Actor <API_s4u_Actor>`:
- Active entities executing your application.
- - :ref:`class Engine <API_s4u_Engine>`
- Simulation engine (singleton).
- - :ref:`class Mailbox <API_s4u_Mailbox>`
- Communication rendezvous, with which actors meet each other.
+ - **Simulation Elements**
-- **Resources**
+ - :ref:`class Actor <API_s4u_Actor>`: Active entities executing your application.
+ - :ref:`class Engine <API_s4u_Engine>`: Simulation engine (singleton).
+ - :ref:`class Mailbox <API_s4u_Mailbox>`: Communication rendezvous, with which actors meet each other.
- - :ref:`class Disk <API_s4u_Disk>`
- Resource on which actors can write and read data.
- - :ref:`class Host <API_s4u_Host>`:
- Actor location, providing computational power.
- - :ref:`class Link <API_s4u_Link>`
- Interconnecting hosts.
- - :ref:`class NetZone <API_s4u_NetZone>`:
- Sub-region of the platform, containing resources (Hosts, Links, etc).
- - :ref:`class VirtualMachine <API_s4u_VirtualMachine>`:
- Execution containers that can be moved between Hosts.
+ - **Resources**
-- **Activities** (:ref:`class Activity <API_s4u_Activity>`):
- The things that actors can do on resources
+ - :ref:`class Disk <API_s4u_Disk>`: Resource on which actors can write and read data.
+ - :ref:`class Host <API_s4u_Host>`: Actor location, providing computational power.
+ - :ref:`class Link <API_s4u_Link>`: Interconnecting hosts.
+ - :ref:`class NetZone <API_s4u_NetZone>`: Sub-region of the platform, containing resources (Hosts, Links, etc).
+ - :ref:`class VirtualMachine <API_s4u_VirtualMachine>`: Execution containers that can be moved between Hosts.
- - :ref:`class Comm <API_s4u_Comm>`
- Communication activity, started on Mailboxes and consuming links.
- - :ref:`class Exec <API_s4u_Exec>`
- Computation activity, started on Host and consuming CPU resources.
- - :ref:`class Io <API_s4u_Io>`
- I/O activity, started on and consuming disks.
+ - **Activities** (:ref:`class Activity <API_s4u_Activity>`): The things that actors can do on resources.
-- **Synchronization Objects**: Classical IPC that actors can use
+ - :ref:`class Comm <API_s4u_Comm>`: Communication activity, started on Mailboxes and consuming links.
+ - :ref:`class Exec <API_s4u_Exec>`: Computation activity, started on Host and consuming CPU resources.
+ - :ref:`class Io <API_s4u_Io>`: I/O activity, started on and consuming disks.
- - :ref:`class Barrier <API_s4u_Barrier>`
- - :ref:`class ConditionVariable <API_s4u_ConditionVariable>`
- - :ref:`class Mutex <API_s4u_Mutex>`
- - :ref:`class Semaphore <API_s4u_Semaphore>`
+ - **Synchronization Objects**: Classical IPC that actors can use
+ - :ref:`class Barrier <API_s4u_Barrier>`
+ - :ref:`class ConditionVariable <API_s4u_ConditionVariable>`
+ - :ref:`class Mutex <API_s4u_Mutex>`
+ - :ref:`class Semaphore <API_s4u_Semaphore>`
.. |API_s4u_Actors| replace:: **Actors**
.. _API_s4u_Actors: #api-s4u-actor
**********
Activities represent the actions that consume a resource, such as a
-:ref:`Comm <API_s4u_Comm>` that consumes the *transmitting power* of
+:ref:`Comm <API_s4u_Comm>` that consumes the *transmitting power* of
:ref:`Link <API_s4u_Link>` resources, or an :ref:`Exec <API_s4u_Exec>`
that consumes the *computing power* of :ref:`Host <API_s4u_Host>` resources.
See also the :ref:`full API <API_s4u_Activity>` below.
Finally, to wait at most until a specified time limit, use
:cpp:func:`s4u::Activity::wait_until() <simgrid::s4u::Activity::wait_until>`.
-Every kind of activity can be asynchronous:
-
- - :ref:`s4u::CommPtr <API_s4u_Comm>` are created with
- :cpp:func:`s4u::Mailbox::put_async() <simgrid::s4u::Mailbox::put_async>` and
- :cpp:func:`s4u::Mailbox::get_async() <simgrid::s4u::Mailbox::get_async>`.
- - :ref:`s4u::IoPtr <API_s4u_Io>` are created with
- :cpp:func:`s4u::Disk::read_async() <simgrid::s4u::Disk::read_async>` and
- :cpp:func:`s4u::Disk::write_async() <simgrid::s4u::Disk::write_async>`.
- - :ref:`s4u::ExecPtr <API_s4u_Exec>` are created with
- :cpp:func:`s4u::Host::exec_async() <simgrid::s4u::Host::exec_async>`.
- - In the future, it will become possible to have asynchronous IPC
- such as asynchronous mutex lock requests.
+Every kind of activity can be asynchronous.
+:ref:`s4u::CommPtr <API_s4u_Comm>` are created with :cpp:func:`s4u::Mailbox::put_async() <simgrid::s4u::Mailbox::put_async>` and
+:cpp:func:`s4u::Mailbox::get_async() <simgrid::s4u::Mailbox::get_async>`;
+:ref:`s4u::IoPtr <API_s4u_Io>` are created with :cpp:func:`s4u::Disk::read_async() <simgrid::s4u::Disk::read_async>` and
+:cpp:func:`s4u::Disk::write_async() <simgrid::s4u::Disk::write_async>`; and
+:ref:`s4u::ExecPtr <API_s4u_Exec>` are created with
+:cpp:func:`s4u::Host::exec_async() <simgrid::s4u::Host::exec_async>`.
+In the future, it will become possible to have asynchronous IPC such as asynchronous mutex lock requests.
The following example shows how to have several concurrent
communications ongoing. First, you have to declare a vector in which
:language: c++
:start-after: init-begin
:end-before: init-end
- :dedent: 4
+ :dedent: 2
Then, you start all the communications that should occur concurrently with
-:cpp:func:`s4u::Mailbox::put_async() <simgrid::s4u::Mailbox::put_async>`.
+:cpp:func:`s4u::Mailbox::put_async() <simgrid::s4u::Mailbox::put_async>`.
Finally, the actor waits for the completion of all of them at once
-with
-:cpp:func:`s4u::Comm::wait_all() <simgrid::s4u::Comm::wait_all>`.
-
+with :cpp:func:`s4u::Comm::wait_all() <simgrid::s4u::Comm::wait_all>`.
+
.. literalinclude:: ../../examples/cpp/comm-waitall/s4u-comm-waitall.cpp
:language: c++
:start-after: put-begin
:end-before: put-end
- :dedent: 4
-
+ :dedent: 2
=====================
Activities Life cycle
=====================
-Sometimes, you want to change the setting of an activity before it even starts.
+Sometimes, you want to change the setting of an activity before it even starts.
.. todo:: write this section
.. _s4u_mailbox:
-
+
Mailboxes
*********
They are similar to many common things: The phone number, which allows
the caller to find the receiver. The Twitter hashtag, which helps
-senders and receivers to find each other. In TCP, the pair
+senders and receivers to find each other. In TCP, the pair
``{host name, host port}`` to which you can connect to find your peer.
-In HTTP, URLs through which the clients can connect to the servers.
+In HTTP, URLs through which the clients can connect to the servers.
In ZeroMQ, the queues are used to match senders and receivers.
One big difference with most of these systems is that no actor is the
A big difference with the ZeroMQ queues is that you cannot filter
on the data you want to get from the mailbox. To model such settings
in SimGrid, you'd have one mailbox per potential topic, and subscribe
-to each topic individually with a
+to each topic individually with a
:cpp:func:`get_async() <simgrid::s4u::Mailbox::get_async>` on each mailbox.
-Then, use :cpp:func:`Comm::wait_any() <simgrid::s4u::Comm::wait_any>`
+Then, use :cpp:func:`Comm::wait_any() <simgrid::s4u::Comm::wait_any>`
to get the first message on any of the mailboxes you are subscribed to.
The mailboxes are not located on the network, and you can access
The last twist is that by default in the simulator, the data starts
to be exchanged only when both the sender and the receiver are
announced (it waits until both :cpp:func:`put() <simgrid::s4u::Mailbox::put()>`
-and :cpp:func:`get() <simgrid::s4u::Mailbox::get()>` are posted).
+and :cpp:func:`get() <simgrid::s4u::Mailbox::get()>` are posted).
In TCP, since you establish connections beforehand, the data starts to
flow as soon as the sender posts it, even if the receiver did not post
-its :cpp:func:`put() <simgrid::s4u::Mailbox::put()>` yet.
+its :cpp:func:`put() <simgrid::s4u::Mailbox::put()>` yet.
To model this in SimGrid, you can declare a specific receiver to a
-given mailbox (with the function
-:cpp:func:`set_receiver() <simgrid::s4u::Mailbox::set_receiver()>`).
+given mailbox (with the function
+:cpp:func:`set_receiver() <simgrid::s4u::Mailbox::set_receiver()>`).
That way, any :cpp:func:`put() <simgrid::s4u::Mailbox::put()>`
posted to that mailbox will start as soon as possible, and the data
will already be there on the receiver host when the receiver actor
.. code-block:: cpp
- void myFunc()
+ void myFunc()
{
simgrid::s4u::MutexPtr mutex = simgrid::s4u::Mutex::create(); // Too bad we cannot use `new`
mutex->lock(); // use the mutex as a simple reference
// bla bla
- mutex->unlock();
-
+ mutex->unlock();
+
} // The mutex gets automatically freed because the only existing reference gets out of scope
Note that Mailboxes, Hosts, and Links are not handled through smart
class Actor
==============
-.. doxygenclass:: simgrid::s4u::Actor
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::Actor
-.. doxygentypedef:: aid_t
+ .. doxygentypedef:: aid_t
+
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.Actor
Basic management
----------------
from simgrid import Actor
- .. autoclass:: simgrid.Actor
-
.. group-tab:: C
.. code:: C
Creating actors
---------------
+See also :ref:`the relevant example <s4u_ex_actors_create>`.
+
.. tabs::
.. group-tab:: C++
.. doxygenfunction:: sg_actor_by_pid(aid_t pid)
.. doxygenfunction:: sg_actor_self()
+ .. doxygenfunction:: sg_actor_list()
Querying info
-------------
.. doxygenfunction:: simgrid::s4u::Actor::get_ppid
.. doxygenfunction:: simgrid::s4u::Actor::get_properties() const
.. doxygenfunction:: simgrid::s4u::Actor::get_property(const std::string &key) const
- .. doxygenfunction:: simgrid::s4u::Actor::set_property(const std::string &key, const std::string &value)
+ .. doxygenfunction:: simgrid::s4u::Actor::set_property(const std::string &key, const std::string &value)
.. doxygenfunction:: simgrid::s4u::Actor::get_host
.. doxygenfunction:: simgrid::s4u::Actor::set_host
.. doxygenfunction:: simgrid::s4u::Actor::get_impl
.. group-tab:: Python
-
+
.. autoattribute:: simgrid.Actor.name
.. autoattribute:: simgrid.Actor.host
.. autoattribute:: simgrid.Actor.pid
.. group-tab:: C++
- .. doxygenvariable:: simgrid::s4u::Actor::on_creation
- .. doxygenvariable:: simgrid::s4u::Actor::on_suspend
- .. doxygenvariable:: simgrid::s4u::Actor::on_host_change
- .. doxygenvariable:: simgrid::s4u::Actor::on_resume
- .. doxygenvariable:: simgrid::s4u::Actor::on_sleep
- .. doxygenvariable:: simgrid::s4u::Actor::on_wake_up
- .. doxygenvariable:: simgrid::s4u::Actor::on_termination
- .. doxygenvariable:: simgrid::s4u::Actor::on_destruction
+ .. doxygenfunction:: simgrid::s4u::Actor::on_creation_cb
+ .. doxygenfunction:: simgrid::s4u::Actor::on_suspend_cb
+ .. doxygenfunction:: simgrid::s4u::Actor::on_host_change_cb
+ .. doxygenfunction:: simgrid::s4u::Actor::on_resume_cb
+ .. doxygenfunction:: simgrid::s4u::Actor::on_sleep_cb
+ .. doxygenfunction:: simgrid::s4u::Actor::on_wake_up_cb
+ .. doxygenfunction:: simgrid::s4u::Actor::on_termination_cb
+ .. doxygenfunction:: simgrid::s4u::Actor::on_destruction_cb
.. _API_s4u_this_actor:
.. autofunction:: simgrid.this_actor.get_host
.. autofunction:: simgrid.this_actor.set_host
+ .. autofunction:: simgrid.this_actor.get_pid
+ .. autofunction:: simgrid.this_actor.get_ppid
+
.. group-tab:: C
.. doxygenfunction:: sg_actor_self_get_data()
.. tabs::
+ .. group-tab:: C++
+
+ Please refer to :ref:`the relevant documentation <logging_prog>`.
+
.. group-tab:: Python
+ .. autofunction:: simgrid.this_actor.debug
.. autofunction:: simgrid.this_actor.info
.. autofunction:: simgrid.this_actor.error
Simulation Engine
====================
-.. doxygenclass:: simgrid::s4u::Engine
+.. tabs::
-Initialization
---------------
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::Engine
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.Engine
+
+Engin initialization
+--------------------
.. tabs::
.. doxygenfunction:: simgrid::s4u::Engine::Engine(int *argc, char **argv)
.. doxygenfunction:: simgrid::s4u::Engine::is_initialized()
.. doxygenfunction:: simgrid::s4u::Engine::shutdown()
+ .. doxygenfunction:: simgrid::s4u::Engine::get_instance()
+
+ .. group-tab:: Python
+
+ .. automethod:: simgrid.Engine.__init__
+ .. autoattribute:: simgrid.Engine.instance
+
+ .. group-tab:: C
+
+ .. doxygenfunction:: simgrid_init
+
+Simulation setup
+----------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
.. doxygenfunction:: simgrid::s4u::Engine::set_config(const std::string &str)
.. doxygenfunction:: simgrid::s4u::Engine::set_config(const std::string &name, bool value)
.. doxygenfunction:: simgrid::s4u::Engine::set_config(const std::string &name, double value)
.. doxygenfunction:: simgrid::s4u::Engine::register_function(const std::string &name, const kernel::actor::ActorCodeFactory &factory)
.. group-tab:: Python
-
+
.. automethod:: simgrid.Engine.load_deployment
.. automethod:: simgrid.Engine.load_platform
.. automethod:: simgrid.Engine.register_actor
.. group-tab:: C
- .. doxygenfunction:: simgrid_init
-
.. doxygenfunction:: simgrid_load_deployment
.. doxygenfunction:: simgrid_load_platform
.. doxygenfunction:: simgrid_register_default
.. doxygenfunction:: simgrid_register_function
+
Run the simulation
------------------
.. doxygenfunction:: simgrid::s4u::Engine::get_clock()
.. doxygenfunction:: simgrid::s4u::Engine::run
+ .. doxygenfunction:: simgrid::s4u::Engine::run_until
.. group-tab:: Python
-
- .. automethod:: simgrid.Engine.get_clock
+
+ .. autoattribute:: simgrid.Engine.clock
.. automethod:: simgrid.Engine.run
+ .. automethod:: simgrid.Engine.run_until
.. group-tab:: C
.. doxygenfunction:: simgrid_get_clock
.. doxygenfunction:: simgrid_run
+ .. doxygenfunction:: simgrid_run_until
Retrieving actors
-----------------
.. group-tab:: C
- .. doxygenfunction:: simgrid_get_actor_count()
+ .. doxygenfunction:: sg_actor_count()
Retrieving hosts
----------------
.. group-tab:: Python
- .. automethod:: simgrid.Engine.get_all_hosts
+ .. autoattribute:: simgrid.Engine.all_hosts
.. group-tab:: C
.. doxygenfunction:: simgrid::s4u::Engine::link_by_name
.. doxygenfunction:: simgrid::s4u::Engine::link_by_name_or_null
+ .. group-tab:: Python
+
+ .. autoattribute:: simgrid.Engine.all_links
+
Interacting with the routing
----------------------------
.. doxygenfunction:: simgrid::s4u::Engine::get_all_netpoints
.. doxygenfunction:: simgrid::s4u::Engine::get_filtered_netzones
- .. doxygenfunction:: simgrid::s4u::Engine::get_instance()
.. doxygenfunction:: simgrid::s4u::Engine::get_netzone_root
.. doxygenfunction:: simgrid::s4u::Engine::netpoint_by_name_or_null
.. doxygenfunction:: simgrid::s4u::Engine::netzone_by_name_or_null
- .. doxygenfunction:: simgrid::s4u::Engine::set_netzone_root(const NetZone *netzone)
+
+ .. group-tab:: Python
+
+ .. autoattribute:: simgrid.Engine.all_netpoints
+ .. autoattribute:: simgrid.Engine.netzone_root
+ .. automethod:: simgrid.Engine.netpoint_by_name
+ .. automethod:: simgrid.Engine.netzone_by_name
Signals
-------
.. group-tab:: C++
- .. doxygenvariable:: simgrid::s4u::Engine::on_deadlock
- .. doxygenvariable:: simgrid::s4u::Engine::on_platform_created
- .. doxygenvariable:: simgrid::s4u::Engine::on_platform_creation
- .. doxygenvariable:: simgrid::s4u::Engine::on_simulation_end
- .. doxygenvariable:: simgrid::s4u::Engine::on_time_advance
+ .. doxygenfunction:: simgrid::s4u::Engine::on_deadlock_cb
+ .. doxygenfunction:: simgrid::s4u::Engine::on_platform_created_cb
+ .. doxygenfunction:: simgrid::s4u::Engine::on_platform_creation_cb
+ .. doxygenfunction:: simgrid::s4u::Engine::on_simulation_end_cb
+ .. doxygenfunction:: simgrid::s4u::Engine::on_time_advance_cb
.. _API_s4u_Mailbox:
class Mailbox
================
-.. doxygenclass:: simgrid::s4u::Mailbox
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::Mailbox
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.Mailbox
Please also refer to the :ref:`full doc on s4u::Mailbox <s4u_mailbox>`.
idiom on mailboxes because they are internal objects to the simulation
engine. Once created, there is no way to destroy a mailbox before the end
of the simulation.
-
+
.. doxygenfunction:: simgrid::s4u::Mailbox::by_name(const std::string &name)
.. group-tab:: Python
#include <simgrid/mailbox.h>
- .. autoclass:: simgrid.Mailbox
-
.. automethod:: simgrid.Mailbox.by_name
.. group-tab:: C
.. code-block:: C
#include <simgrid/s4u/mailbox.h>
-
+
.. doxygentypedef:: sg_mailbox_t
.. doxygentypedef:: const_sg_mailbox_t
.. group-tab:: C
.. doxygenfunction:: sg_mailbox_set_receiver(const char *alias)
-
+
.. _API_s4u_Resource:
=========
class Disk
=============
-.. doxygenclass:: simgrid::s4u::Disk
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::Disk
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.Disk
+
+ .. group-tab:: C
+
+ .. doxygentypedef:: sg_disk_t
+ .. doxygentypedef:: const_sg_disk_t
Basic management
----------------
Note that there is no DiskPtr type and that you cannot use the RAII
idiom on disks because SimGrid does not allow (yet) to create nor
- destroy resources once the simulation is started.
-
+ destroy resources once the simulation is started.
+
.. doxygenfunction:: simgrid::s4u::Disk::seal()
.. group-tab:: Python
.. group-tab:: C++
- .. doxygenvariable:: simgrid::s4u::Disk::on_creation
- .. doxygenvariable:: simgrid::s4u::Disk::on_destruction
- .. doxygenvariable:: simgrid::s4u::Disk::on_state_change
+ .. doxygenfunction:: simgrid::s4u::Disk::on_creation_cb
+ .. doxygenfunction:: simgrid::s4u::Disk::on_destruction_cb
+ .. doxygenfunction:: simgrid::s4u::Disk::on_state_change_cb
.. _API_s4u_Host:
class Host
=============
-.. doxygenclass:: simgrid::s4u::Host
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::Host
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.Host
Basic management
----------------
Note that there is no HostPtr type, and that you cannot use the RAII
idiom on hosts because SimGrid does not allow (yet) to create nor
- destroy resources once the simulation is started.
+ destroy resources once the simulation is started.
.. doxygenfunction:: simgrid::s4u::Host::destroy()
.. doxygenfunction:: simgrid::s4u::Host::seal()
.. group-tab:: Python
- See also :py:func:`simgrid.Engine.get_all_hosts`.
+ See also :py:attr:`simgrid.Engine.all_hosts`.
.. automethod:: simgrid.Host.by_name
.. automethod:: simgrid.Host.current
.. doxygenfunction:: sg_host_by_name(const char *name)
.. doxygenfunction:: sg_host_count()
.. doxygenfunction:: sg_host_list()
- .. doxygenfunction:: sg_hosts_as_dynar()
Modifying characteristics
-------------------------
.. group-tab:: Python
- .. automethod:: simgrid.Host.set_core_count
+ .. autoattribute:: simgrid.Host.core_count
.. automethod:: simgrid.Host.set_coordinates
.. automethod:: simgrid.Host.set_sharing_policy
.. group-tab:: Python
.. autoattribute:: simgrid.Host.name
+ .. autoattribute:: simgrid.Host.core_count
.. autoattribute:: simgrid.Host.load
.. autoattribute:: simgrid.Host.pstate
.. autoattribute:: simgrid.Host.speed
+ .. autoattribute:: simgrid.Host.available_speed
.. group-tab:: C
.. doxygenfunction:: simgrid::s4u::Host::get_pstate_count() const
.. doxygenfunction:: simgrid::s4u::Host::get_pstate_speed(unsigned long pstate_index) const
.. doxygenfunction:: simgrid::s4u::Host::set_pstate(unsigned long pstate_index)
- .. doxygenfunction:: simgrid::s4u::Host::set_speed_profile(kernel::profile::Profile *p)
- .. doxygenfunction:: simgrid::s4u::Host::set_state_profile(kernel::profile::Profile *p)
.. group-tab:: Python
- .. automethod:: simgrid.Host.get_pstate_count
- .. automethod:: simgrid.Host.get_pstate_speed
+ .. autoattribute:: simgrid.Host.pstate_count
+ .. automethod:: simgrid.Host.pstate_speed
.. group-tab:: C
.. doxygenfunction:: sg_host_get_pstate_speed(const_sg_host_t host, unsigned long pstate_index)
.. doxygenfunction:: sg_host_set_pstate(sg_host_t host, unsigned long pstate)
+Dynamic profiles
+----------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenfunction:: simgrid::s4u::Host::set_speed_profile(kernel::profile::Profile *p)
+ .. doxygenfunction:: simgrid::s4u::Host::set_state_profile(kernel::profile::Profile *p)
+
+ .. group-tab:: Python
+
+ .. automethod:: simgrid.Host.set_speed_profile
+ .. automethod:: simgrid.Host.set_state_profile
+
Execution
---------
.. doxygenfunction:: simgrid::s4u::Host::get_englobing_zone() const
.. doxygenfunction:: simgrid::s4u::Host::get_netpoint() const
.. doxygenfunction:: simgrid::s4u::Host::route_to(const Host *dest, std::vector< Link * > &links, double *latency) const
- .. doxygenfunction:: simgrid::s4u::Host::route_to(const Host *dest, std::vector< kernel::resource::LinkImpl * > &links, double *latency) const
+ .. doxygenfunction:: simgrid::s4u::Host::route_to(const Host *dest, std::vector< kernel::resource::StandardLinkImpl * > &links, double *latency) const
.. doxygenfunction:: simgrid::s4u::Host::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth)
.. doxygenfunction:: simgrid::s4u::Host::create_disk(const std::string& name, const std::string& read_bandwidth, const std::string& write_bandwidth)
.. group-tab:: Python
- .. automethod:: simgrid.Host.get_netpoint
+ .. autoattribute:: simgrid.Host.netpoint
.. automethod:: simgrid.Host.create_disk
+
+ .. automethod:: simgrid.Host.route_to
.. group-tab:: C
.. group-tab:: C++
- .. doxygenvariable:: simgrid::s4u::Host::on_creation
- .. doxygenvariable:: simgrid::s4u::Host::on_destruction
- .. doxygenvariable:: simgrid::s4u::Host::on_speed_change
- .. doxygenvariable:: simgrid::s4u::Host::on_state_change
+ .. doxygenfunction:: simgrid::s4u::Host::on_creation_cb
+ .. doxygenfunction:: simgrid::s4u::Host::on_destruction_cb
+ .. doxygenfunction:: simgrid::s4u::Host::on_speed_change_cb
+ .. doxygenfunction:: simgrid::s4u::Host::on_state_change_cb
.. _API_s4u_Link:
class Link
=============
-.. doxygenclass:: simgrid::s4u::Link
-.. doxygenclass:: simgrid::s4u::SplitDuplexLink
-.. doxygenclass:: simgrid::s4u::LinkInRoute
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::Link
+ .. doxygenclass:: simgrid::s4u::SplitDuplexLink
+ .. doxygenclass:: simgrid::s4u::LinkInRoute
+
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.Link
Basic management
----------------
Note that there is no LinkPtr type and that you cannot use the RAII
idiom on hosts because SimGrid does not allow (yet) to create nor
- destroy resources once the simulation is started.
+ destroy resources once the simulation is started.
.. doxygenfunction:: simgrid::s4u::Link::seal()
.. group-tab:: Python
+ See also :py:attr:`simgrid.Engine.all_links`.
+
+ .. automethod:: simgrid.Link.by_name
.. autoattribute:: simgrid.Link.name
.. group-tab:: C
.. doxygenfunction:: simgrid::s4u::Link::get_usage() const
.. doxygenfunction:: simgrid::s4u::Link::is_used() const
+ .. group-tab:: Python
+
+ .. autoattribute:: simgrid.Link.bandwidth
+ .. autoattribute:: simgrid.Link.latency
+
.. group-tab:: C
.. doxygenfunction:: sg_link_get_bandwidth(const_sg_link_t link)
.. group-tab:: Python
+ .. automethod:: simgrid.Link.set_bandwidth
.. automethod:: simgrid.Link.set_latency
.. automethod:: simgrid.Link.set_concurrency_limit
.. automethod:: simgrid.Link.set_sharing_policy
.. doxygenfunction:: simgrid::s4u::Link::turn_off()
.. doxygenfunction:: simgrid::s4u::Link::turn_on()
+ .. group-tab:: Python
+
+ See also :py:func:`simgrid.Link.set_state_profile`.
+
+ .. automethod:: simgrid.Link.is_on
+ .. automethod:: simgrid.Link.turn_off
+ .. automethod:: simgrid.Link.turn_on
+
Dynamic profiles
----------------
.. doxygenfunction:: simgrid::s4u::Link::set_latency_profile(kernel::profile::Profile *profile)
.. doxygenfunction:: simgrid::s4u::Link::set_state_profile(kernel::profile::Profile *profile)
+ .. group-tab:: Python
+
+ .. automethod:: simgrid.Link.set_bandwidth_profile
+ .. automethod:: simgrid.Link.set_latency_profile
+ .. automethod:: simgrid.Link.set_state_profile
+
WIFI links
----------
.. group-tab:: C++
- .. doxygenvariable:: simgrid::s4u::Link::on_bandwidth_change
- .. doxygenvariable:: simgrid::s4u::Link::on_communicate
- .. doxygenvariable:: simgrid::s4u::Link::on_communication_state_change
- .. doxygenvariable:: simgrid::s4u::Link::on_creation
- .. doxygenvariable:: simgrid::s4u::Link::on_destruction
- .. doxygenvariable:: simgrid::s4u::Link::on_state_change
+ .. doxygenfunction:: simgrid::s4u::Link::on_bandwidth_change_cb
+ .. doxygenfunction:: simgrid::s4u::Link::on_communication_state_change_cb
+ .. doxygenfunction:: simgrid::s4u::Link::on_creation_cb
+ .. doxygenfunction:: simgrid::s4u::Link::on_destruction_cb
+ .. doxygenfunction:: simgrid::s4u::Link::on_state_change_cb
.. _API_s4u_NetZone:
class NetZone
================
-.. doxygenclass:: simgrid::s4u::NetZone
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::NetZone
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.NetZone
Basic management
----------------
Note that there is no NetZonePtr type and that you cannot use the RAII
idiom on network zones because SimGrid does not allow (yet) to create nor
- destroy resources once the simulation is started.
+ destroy resources once the simulation is started.
.. doxygenfunction:: simgrid::s4u::NetZone::seal
from simgrid import NetZone
- .. autoclass:: simgrid.NetZone
.. automethod:: simgrid.NetZone.seal
.. group-tab:: C
.. group-tab:: Python
.. autoattribute:: simgrid.NetZone.name
- .. automethod:: simgrid.NetZone.get_netpoint
+ .. autoattribute:: simgrid.NetZone.netpoint
.. group-tab:: C
.. group-tab:: C++
- .. doxygenvariable:: simgrid::s4u::NetZone::on_creation
- .. doxygenvariable:: simgrid::s4u::NetZone::on_seal
+ .. doxygenfunction:: simgrid::s4u::NetZone::on_creation_cb
+ .. doxygenfunction:: simgrid::s4u::NetZone::on_seal_cb
Creating resources
------------------
.. group-tab:: C++
- .. doxygenfunction:: simgrid::s4u::VirtualMachine::VirtualMachine(const std::string &name, Host *physical_host, int core_amount)
- .. doxygenfunction:: simgrid::s4u::VirtualMachine::VirtualMachine(const std::string &name, Host *physical_host, int core_amount, size_t ramsize)
+ .. doxygenfunction:: simgrid::s4u::Host::create_vm(const std::string &name, int core_amount)
+ .. doxygenfunction:: simgrid::s4u::Host::create_vm(const std::string &name, int core_amount, size_t ramsize)
.. doxygenfunction:: simgrid::s4u::VirtualMachine::destroy
.. group-tab:: C
.. group-tab:: C++
- .. doxygenvariable:: simgrid::s4u::VirtualMachine::on_migration_end
- .. doxygenvariable:: simgrid::s4u::VirtualMachine::on_migration_start
- .. doxygenvariable:: simgrid::s4u::VirtualMachine::on_resume
- .. doxygenvariable:: simgrid::s4u::VirtualMachine::on_shutdown
- .. doxygenvariable:: simgrid::s4u::VirtualMachine::on_start
- .. doxygenvariable:: simgrid::s4u::VirtualMachine::on_started
- .. doxygenvariable:: simgrid::s4u::VirtualMachine::on_suspend
+ .. doxygenfunction:: simgrid::s4u::VirtualMachine::on_creation_cb
+ .. doxygenfunction:: simgrid::s4u::VirtualMachine::on_destruction_cb
+ .. doxygenfunction:: simgrid::s4u::VirtualMachine::on_migration_end_cb
+ .. doxygenfunction:: simgrid::s4u::VirtualMachine::on_migration_start_cb
+ .. doxygenfunction:: simgrid::s4u::VirtualMachine::on_resume_cb
+ .. doxygenfunction:: simgrid::s4u::VirtualMachine::on_shutdown_cb
+ .. doxygenfunction:: simgrid::s4u::VirtualMachine::on_start_cb
+ .. doxygenfunction:: simgrid::s4u::VirtualMachine::on_started_cb
+ .. doxygenfunction:: simgrid::s4u::VirtualMachine::on_suspend_cb
.. _API_s4u_Activity:
class Comm
=============
-.. doxygenclass:: simgrid::s4u::Comm
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::Comm
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.Comm
Basic management
----------------
from simgrid import Comm
- .. autoclass:: simgrid.Comm
-
.. group-tab:: c
.. code:: c
.. group-tab:: C++
.. doxygenfunction:: simgrid::s4u::Comm::sendto
- .. doxygenfunction:: simgrid::s4u::Comm::sendto_init
+ .. doxygenfunction:: simgrid::s4u::Comm::sendto_init()
+ .. doxygenfunction:: simgrid::s4u::Comm::sendto_init(Host *from, Host *to)
.. doxygenfunction:: simgrid::s4u::Comm::sendto_async
-
+
.. doxygenfunction:: simgrid::s4u::Comm::cancel
.. doxygenfunction:: simgrid::s4u::Comm::start
.. doxygenfunction:: simgrid::s4u::Comm::test
.. group-tab:: C++
- .. doxygenvariable:: simgrid::s4u::Comm::on_completion
- .. doxygenvariable:: simgrid::s4u::Comm::on_start
+ .. doxygenfunction:: simgrid::s4u::Comm::on_start_cb
+ .. doxygenfunction:: simgrid::s4u::Comm::on_completion_cb
+ .. doxygenfunction:: simgrid::s4u::Comm::on_recv_cb
+ .. doxygenfunction:: simgrid::s4u::Comm::on_send_cb
.. _API_s4u_Exec:
class Exec
=============
-.. doxygenclass:: simgrid::s4u::Exec
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::Exec
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.Exec
Basic management
----------------
from simgrid import Exec
- .. autoclass:: simgrid.Exec
-
.. group-tab:: C
.. code-block:: C
.. autoattribute:: simgrid.Exec.remaining_ratio
.. group-tab:: C
-
+
.. doxygenfunction:: sg_exec_set_bound(sg_exec_t exec, double bound)
.. doxygenfunction:: sg_exec_get_name(const_sg_exec_t exec)
.. doxygenfunction:: sg_exec_set_name(sg_exec_t exec, const char* name)
.. automethod:: simgrid.Exec.wait
.. group-tab:: C
-
+
.. doxygenfunction:: sg_exec_start(sg_exec_t exec)
.. doxygenfunction:: sg_exec_cancel(sg_exec_t exec);
.. doxygenfunction:: sg_exec_test(sg_exec_t exec);
.. group-tab:: C++
- .. doxygenvariable:: simgrid::s4u::Exec::on_start
- .. doxygenvariable:: simgrid::s4u::Exec::on_completion
+ .. doxygenfunction:: simgrid::s4u::Exec::on_start_cb
+ .. doxygenfunction:: simgrid::s4u::Exec::on_completion_cb
.. _API_s4u_Io:
class Io
===========
-.. doxygenclass:: simgrid::s4u::Io
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenclass:: simgrid::s4u::Io
+
+ .. group-tab:: Python
+
+ .. autoclass:: simgrid.Io
Basic management
----------------
.. automethod:: simgrid.Io.wait_any_for
.. automethod:: simgrid.Io.wait_any
+Signals
+-------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. doxygenfunction:: simgrid::s4u::Io::on_start_cb
+ .. doxygenfunction:: simgrid::s4u::Io::on_completion_cb
+
.. _API_s4u_Synchronizations:
=======================
#include <simgrid/barrier.hpp>
.. doxygentypedef:: sg_bar_t
- .. cpp:type:: const s4u_Barrier* const_sg_bar_t
-
- Pointer to a constant barrier object.
+ .. doxygentypedef:: const_sg_bar_t
.. doxygenfunction:: sg_barrier_init(unsigned int count)
.. doxygenfunction:: sg_barrier_destroy(const_sg_bar_t bar)