memory gets properly reclaimed. This call should be at the end of the
actor's function, not in an on_exit callback.
+===============================
+Communicating without Mailboxes
+===============================
+
+Sometimes you don't want to simulate communications between actors as
+allowed by mailboxes, but you want to create a direct communication
+between two arbitrary hosts. This can arise when you write a
+high-level model of a centralized scheduler, or when you model direct
+communications such as one-sided communications in MPI or remote
+memory direct access in PGAS.
+
+For that, :cpp:func:`Comm::sendto() <simgrid::s4u::Comm::sendto()>`
+simulates a direct communication between the two specified hosts. No
+mailbox is used, and there is no rendezvous between actors. You can
+freely mix such direct communications and rendezvous-based
+communications. Alternatively, :cpp:func:`Comm::sendto_init()
+<simgrid::s4u::Comm::sendto_init()>` and
+:cpp:func:`Comm::sendto_async() <simgrid::s4u::Comm::sendto_async()>`
+create asynchronous direct communications.
+
.. _s4u_raii:
Memory Management
from simgrid import Actor
+ .. autoclass:: simgrid.Actor
+
.. group-tab:: C
.. code:: C
.. group-tab:: C
- .. doxygenfunction:: sg_actor_create(const char *name, sg_host_t host, xbt_main_func_t code, int argc, const char *const *argv)
+ .. doxygenfunction:: sg_actor_create(const char *name, sg_host_t host, xbt_main_func_t code, int argc, char *const *argv)
.. doxygenfunction:: sg_actor_init(const char *name, sg_host_t host)
- .. doxygenfunction:: sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, const char *const *argv)
+ .. doxygenfunction:: sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, char *const *argv)
.. doxygenfunction:: sg_actor_attach(const char *name, void *data, sg_host_t host, xbt_dict_t properties)
.. doxygenfunction:: sg_actor_detach()
.. group-tab:: C
- .. doxygenfunction:: sg_actor_by_PID(aid_t pid)
+ .. doxygenfunction:: sg_actor_by_pid(aid_t pid)
.. doxygenfunction:: sg_actor_self()
Querying info
.. group-tab:: C
.. doxygenfunction:: sg_actor_get_name(const_sg_actor_t actor)
- .. doxygenfunction:: sg_actor_get_PID(const_sg_actor_t actor)
- .. doxygenfunction:: sg_actor_get_PPID(const_sg_actor_t actor)
+ .. doxygenfunction:: sg_actor_get_pid(const_sg_actor_t actor)
+ .. doxygenfunction:: sg_actor_get_ppid(const_sg_actor_t actor)
.. doxygenfunction:: sg_actor_get_properties(const_sg_actor_t actor)
.. doxygenfunction:: sg_actor_get_property_value(const_sg_actor_t actor, const char *name)
.. group-tab:: C
+ .. doxygenfunction:: sg_actor_on_exit
.. doxygenfunction:: sg_actor_join(const_sg_actor_t actor, double timeout)
.. doxygenfunction:: sg_actor_set_auto_restart(sg_actor_t actor, int auto_restart)
.. autofunction:: simgrid.this_actor.exit
.. autofunction:: simgrid.this_actor.on_exit
+ .. group-tab:: c
+
+ See also :cpp:func:`sg_actor_on_exit`.
+
+ .. doxygenfunction:: sg_actor_exit
+
.. _API_s4u_Engine:
====================
.. group-tab:: Python
+ .. code-block:: C++
+
+ #include <simgrid/mailbox.h>
+
+ .. autoclass:: simgrid.Mailbox
+
.. automethod:: simgrid.Mailbox.by_name
+ .. group-tab:: C
+
.. code-block:: C
#include <simgrid/s4u/mailbox.h>
- .. doxygenfunction:: sg_mailbox_by_name(const char *alias)
+ .. doxygentypedef:: sg_mailbox_t
+ .. doxygentypedef:: const_sg_mailbox_t
- .. group-tab:: C
+ .. doxygenfunction:: sg_mailbox_by_name(const char *alias)
Querying info
-------------
Platform and routing
--------------------
+You can also start direct communications between two arbitrary hosts
+using :cpp:func:`Comm::sendto() <simgrid::s4u::Comm::sendto()>`.
+
.. tabs::
.. group-tab:: C++
.. 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::sendto(Host *dest, double byte_amount)
- .. doxygenfunction:: simgrid::s4u::Host::sendto_async(Host *dest, double byte_amount)
.. group-tab:: C
from simgrid import Comm
+ .. autoclass:: simgrid.Comm
+
+ .. group-tab:: c
+
+ .. code:: c
+
+ #include <simgrid/comm.h>
+
+ .. doxygentypedef:: sg_comm_t
+ .. doxygentypedef:: const_sg_comm_t
+
Querying info
-------------
.. doxygenfunction:: simgrid::s4u::Comm::set_dst_data(void **buff, size_t size)
.. doxygenfunction:: simgrid::s4u::Comm::detach()
.. doxygenfunction:: simgrid::s4u::Comm::detach(void(*clean_function)(void *))
+ .. doxygenfunction:: simgrid::s4u::Comm::set_payload_size(double bytes)
.. doxygenfunction:: simgrid::s4u::Comm::set_rate(double rate)
.. doxygenfunction:: simgrid::s4u::Comm::set_src_data(void *buff)
.. doxygenfunction:: simgrid::s4u::Comm::set_src_data(void *buff, size_t size)
Life cycle
----------
+Most communications are created using :ref:`s4u_mailbox`, but you can
+also start direct communications as shown below.
+
.. tabs::
.. group-tab:: C++
+ .. doxygenfunction:: simgrid::s4u::Comm::sendto
+ .. doxygenfunction:: simgrid::s4u::Comm::sendto_init
+ .. doxygenfunction:: simgrid::s4u::Comm::sendto_async
+
.. doxygenfunction:: simgrid::s4u::Comm::cancel
.. doxygenfunction:: simgrid::s4u::Comm::start
.. doxygenfunction:: simgrid::s4u::Comm::test
.. code:: Python
from simgrid import Exec
-
+
+ .. autoclass:: simgrid.Exec
+
.. group-tab:: C
.. code-block:: C
#include <simgrid/exec.h>
+ .. doxygentypedef:: sg_exec_t
+ .. doxygentypedef:: const_sg_exec_t
+
Querying info
-------------
#include <simgrid/cond.h>
.. doxygentypedef:: sg_cond_t
+ .. doxygentypedef:: const_sg_cond_t
.. doxygenfunction:: sg_cond_init
.. doxygenfunction:: sg_cond_destroy