X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a3ff2d592d10a66e48ab08baad136bd993241f11..472cf2ae0b7d14830217c5a0024c5c27c2336af4:/docs/source/app_s4u.rst diff --git a/docs/source/app_s4u.rst b/docs/source/app_s4u.rst index 1cb35ad7eb..014a1e96ed 100644 --- a/docs/source/app_s4u.rst +++ b/docs/source/app_s4u.rst @@ -598,6 +598,7 @@ Reacting to the end of actors .. doxygenfunction:: simgrid::s4u::Actor::join() const .. doxygenfunction:: simgrid::s4u::Actor::join(double timeout) const .. doxygenfunction:: simgrid::s4u::Actor::set_auto_restart(bool autorestart) + .. doxygenfunction:: simgrid::s4u::Actor::get_restart_count .. group-tab:: Python @@ -701,6 +702,7 @@ Logging messages .. autofunction:: simgrid.this_actor.debug .. autofunction:: simgrid.this_actor.info + .. autofunction:: simgrid.this_actor.warning .. autofunction:: simgrid.this_actor.error Sleeping @@ -741,9 +743,11 @@ the execution, or start an asynchronous activity. .. doxygenfunction:: simgrid::s4u::this_actor::execute(double flop) .. doxygenfunction:: simgrid::s4u::this_actor::execute(double flop, double priority) .. doxygenfunction:: simgrid::s4u::this_actor::parallel_execute(const std::vector< s4u::Host * > &hosts, const std::vector< double > &flops_amounts, const std::vector< double > &bytes_amounts) + .. doxygenfunction:: simgrid::s4u::this_actor::thread_execute .. group-tab:: Python + .. autofunction:: simgrid.this_actor.exec_async .. autofunction:: simgrid.this_actor.exec_init .. autofunction:: simgrid.this_actor.execute @@ -807,7 +811,7 @@ Engin initialization .. group-tab:: Python .. automethod:: simgrid.Engine.__init__ - .. automethod:: simgrid.Engine.instance + .. autoattribute:: simgrid.Engine.instance .. group-tab:: C @@ -864,7 +868,7 @@ Run the simulation .. group-tab:: Python - .. automethod:: simgrid.Engine.get_clock + .. autoattribute:: simgrid.Engine.clock .. automethod:: simgrid.Engine.run .. automethod:: simgrid.Engine.run_until @@ -904,7 +908,8 @@ Retrieving hosts .. group-tab:: Python - .. automethod:: simgrid.Engine.get_all_hosts + .. autoattribute:: simgrid.Engine.all_hosts + .. automethod:: simgrid.Engine.host_by_name .. group-tab:: C @@ -925,7 +930,7 @@ Retrieving links .. group-tab:: Python - .. automethod:: simgrid.Engine.get_all_links + .. autoattribute:: simgrid.Engine.all_links Interacting with the routing ---------------------------- @@ -939,15 +944,13 @@ Interacting with the routing .. 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 - .. automethod:: simgrid.Engine.get_all_netpoints - .. automethod:: simgrid.Engine.get_netzone_root + .. autoattribute:: simgrid.Engine.all_netpoints + .. autoattribute:: simgrid.Engine.netzone_root .. automethod:: simgrid.Engine.netpoint_by_name .. automethod:: simgrid.Engine.netzone_by_name - .. automethod:: simgrid.Engine.set_netzone_root Signals ------- @@ -959,6 +962,7 @@ Signals .. 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_start_cb .. doxygenfunction:: simgrid::s4u::Engine::on_simulation_end_cb .. doxygenfunction:: simgrid::s4u::Engine::on_time_advance_cb @@ -1048,6 +1052,7 @@ Sending data .. automethod:: simgrid.Mailbox.put .. automethod:: simgrid.Mailbox.put_async + .. automethod:: simgrid.Mailbox.put_init .. group-tab:: C @@ -1069,7 +1074,7 @@ Receiving data .. doxygenfunction:: simgrid::s4u::Mailbox::get(double timeout) .. doxygenfunction:: simgrid::s4u::Mailbox::get_async(T **data) .. doxygenfunction:: simgrid::s4u::Mailbox::get_init() - .. doxygenfunction:: simgrid::s4u::Mailbox::iprobe(int type, bool(*match_fun)(void *, void *, kernel::activity::CommImpl *), void *data) + .. doxygenfunction:: simgrid::s4u::Mailbox::iprobe(int type, const std::function& match_fun, void *data) .. doxygenfunction:: simgrid::s4u::Mailbox::listen .. doxygenfunction:: simgrid::s4u::Mailbox::ready @@ -1077,6 +1082,7 @@ Receiving data .. automethod:: simgrid.Mailbox.get .. automethod:: simgrid.Mailbox.get_async + .. autoattribute:: simgrid.Mailbox.ready .. group-tab:: C @@ -1169,7 +1175,7 @@ Querying info .. doxygenfunction:: simgrid::s4u::Disk::get_read_bandwidth() const .. doxygenfunction:: simgrid::s4u::Disk::get_write_bandwidth() const .. doxygenfunction:: simgrid::s4u::Disk::set_property(const std::string &, const std::string &value) - .. doxygenfunction:: simgrid::s4u::Disk::set_sharing_policy(Operation op, SharingPolicy policy, const s4u::NonLinearResourceCb& cb = {}) + .. doxygenfunction:: simgrid::s4u::Disk::set_sharing_policy .. group-tab:: Python @@ -1276,7 +1282,7 @@ Retrieving hosts .. 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 @@ -1296,11 +1302,12 @@ Modifying characteristics .. doxygenfunction:: simgrid::s4u::Host::set_core_count(int core_count) .. doxygenfunction:: simgrid::s4u::Host::set_coordinates(const std::string& coords) - .. doxygenfunction:: simgrid::s4u::Host::set_sharing_policy(SharingPolicy policy, const s4u::NonLinearResourceCb& cb = {}) + .. doxygenfunction:: simgrid::s4u::Host::set_sharing_policy .. group-tab:: Python - .. automethod:: simgrid.Host.set_core_count + .. autoattribute:: simgrid.Host.core_count + :noindex: .. automethod:: simgrid.Host.set_coordinates .. automethod:: simgrid.Host.set_sharing_policy @@ -1321,15 +1328,14 @@ Querying info .. 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:: sg_host_core_count(const_sg_host_t host) - .. doxygenfunction:: sg_host_dump(const_sg_host_t ws) .. doxygenfunction:: sg_host_get_name(const_sg_host_t host) .. doxygenfunction:: sg_host_get_load(const_sg_host_t host) .. doxygenfunction:: sg_host_get_speed(const_sg_host_t host) @@ -1406,8 +1412,9 @@ DVFS .. group-tab:: Python - .. automethod:: simgrid.Host.get_pstate_count - .. automethod:: simgrid.Host.get_pstate_speed + .. autoattribute:: simgrid.Host.pstate + .. autoattribute:: simgrid.Host.pstate_count + .. automethod:: simgrid.Host.pstate_speed .. group-tab:: C @@ -1462,7 +1469,7 @@ using :cpp:func:`Comm::sendto() `. .. group-tab:: Python - .. automethod:: simgrid.Host.get_netpoint + .. autoattribute:: simgrid.Host.netpoint .. automethod:: simgrid.Host.create_disk .. automethod:: simgrid.Host.route_to @@ -1555,7 +1562,7 @@ Retrieving links .. group-tab:: Python - See also :py:func:`simgrid.Engine.get_all_links`. + See also :py:attr:`simgrid.Engine.all_links`. .. automethod:: simgrid.Link.by_name .. autoattribute:: simgrid.Link.name @@ -1604,7 +1611,7 @@ Modifying characteristics .. doxygenfunction:: simgrid::s4u::Link::set_latency(double value) .. doxygenfunction:: simgrid::s4u::Link::set_latency(const std::string& value) .. doxygenfunction:: simgrid::s4u::Link::set_concurrency_limit(int limit) - .. doxygenfunction:: simgrid::s4u::Link::set_sharing_policy(SharingPolicy policy, const NonLinearResourceCb& cb = {}) + .. doxygenfunction:: simgrid::s4u::Link::set_sharing_policy .. group-tab:: Python @@ -1781,7 +1788,7 @@ Querying info .. group-tab:: Python .. autoattribute:: simgrid.NetZone.name - .. automethod:: simgrid.NetZone.get_netpoint + .. autoattribute:: simgrid.NetZone.netpoint .. group-tab:: C @@ -1863,16 +1870,16 @@ Zones .. group-tab:: C++ - .. doxygenfunction:: simgrid::s4u::create_full_zone(const std::string& name) - .. doxygenfunction:: simgrid::s4u::create_empty_zone(const std::string& name) - .. doxygenfunction:: simgrid::s4u::create_star_zone(const std::string& name) - .. doxygenfunction:: simgrid::s4u::create_dijkstra_zone(const std::string& name, bool cache) - .. doxygenfunction:: simgrid::s4u::create_floyd_zone(const std::string& name) - .. doxygenfunction:: simgrid::s4u::create_vivaldi_zone(const std::string& name) - .. doxygenfunction:: simgrid::s4u::create_wifi_zone(const std::string& name) + .. doxygenfunction:: simgrid::s4u::create_full_zone + .. doxygenfunction:: simgrid::s4u::create_empty_zone + .. doxygenfunction:: simgrid::s4u::create_star_zone + .. doxygenfunction:: simgrid::s4u::create_dijkstra_zone + .. doxygenfunction:: simgrid::s4u::create_floyd_zone + .. doxygenfunction:: simgrid::s4u::create_vivaldi_zone + .. doxygenfunction:: simgrid::s4u::create_wifi_zone .. doxygenfunction:: simgrid::s4u::create_torus_zone - .. doxygenfunction:: simgrid::s4u::create_fatTree_zone(const std::string& name, const NetZone* parent, const FatTreeParams& parameters, const ClusterCallbacks& set_callbacks, double bandwidth, double latency, Link::SharingPolicy sharing_policy) - .. doxygenfunction:: simgrid::s4u::create_dragonfly_zone(const std::string& name, const NetZone* parent, const DragonflyParams& parameters, const ClusterCallbacks& set_callbacks, double bandwidth, double latency, Link::SharingPolicy sharing_policy) + .. doxygenfunction:: simgrid::s4u::create_fatTree_zone + .. doxygenfunction:: simgrid::s4u::create_dragonfly_zone .. group-tab:: Python @@ -2120,6 +2127,17 @@ Suspending and resuming an activity .. doxygenfunction:: simgrid::s4u::Activity::resume .. doxygenfunction:: simgrid::s4u::Activity::is_suspended +Signals +------- + +.. tabs:: + + .. group-tab:: C++ + + .. doxygenfunction:: simgrid::s4u::Activity::on_completion_cb + .. doxygenfunction:: simgrid::s4u::Activity::on_suspended_cb + .. doxygenfunction:: simgrid::s4u::Activity::on_resumed_cb + .. _API_s4u_Comm: ============= @@ -2162,7 +2180,6 @@ Basic management #include .. doxygentypedef:: sg_comm_t - .. doxygentypedef:: const_sg_comm_t Querying info ------------- @@ -2177,13 +2194,23 @@ Querying info .. doxygenfunction:: simgrid::s4u::Comm::set_dst_data(void **buff) .. 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::detach(const std::function& clean_function) .. doxygenfunction:: simgrid::s4u::Comm::set_payload_size(uint64_t 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) .. doxygenfunction:: simgrid::s4u::Comm::set_src_data_size(size_t size) + .. group-tab:: Python + + .. autoattribute:: simgrid.Comm.dst_data_size + .. autoattribute:: simgrid.Comm.mailbox + .. autoattribute:: simgrid.Comm.sender + .. autoattribute:: simgrid.Comm.state_str + .. automethod:: simgrid.Comm.detach + .. automethod:: simgrid.Comm.set_payload_size + .. automethod:: simgrid.Comm.set_rate + Life cycle ---------- @@ -2209,13 +2236,25 @@ also start direct communications as shown below. .. doxygenfunction:: simgrid::s4u::Comm::wait_any(const std::vector< CommPtr >& comms) .. doxygenfunction:: simgrid::s4u::Comm::wait_any_for(const std::vector< CommPtr >& comms, double timeout) .. doxygenfunction:: simgrid::s4u::Comm::wait_for + .. doxygenfunction:: simgrid::s4u::Comm::wait_until .. group-tab:: Python + .. automethod:: simgrid.Comm.sendto + .. automethod:: simgrid.Comm.sendto_init + .. automethod:: simgrid.Comm.sendto_async + + .. automethod:: simgrid.Comm.cancel + .. automethod:: simgrid.Comm.start .. automethod:: simgrid.Comm.test + .. automethod:: simgrid.Comm.test_any .. automethod:: simgrid.Comm.wait + .. automethod:: simgrid.Comm.wait_for .. automethod:: simgrid.Comm.wait_all + .. automethod:: simgrid.Comm.wait_all_for .. automethod:: simgrid.Comm.wait_any + .. automethod:: simgrid.Comm.wait_any_for + .. automethod:: simgrid.Comm.wait_until .. group-tab:: C @@ -2406,8 +2445,8 @@ Life cycle .. doxygenfunction:: simgrid::s4u::Io::test .. doxygenfunction:: simgrid::s4u::Io::wait .. doxygenfunction:: simgrid::s4u::Io::wait_for - .. doxygenfunction:: simgrid::s4u::Io::wait_any - .. doxygenfunction:: simgrid::s4u::Io::wait_any_for + .. doxygenfunction:: simgrid::s4u::Io::wait_any(const std::vector &ios) + .. doxygenfunction:: simgrid::s4u::Io::wait_any_for(const std::vector &ios, double timeout) .. group-tab:: Python @@ -2438,7 +2477,15 @@ Synchronization Objects ⁣  Mutex ============== -.. doxygenclass:: simgrid::s4u::Mutex +.. tabs:: + + .. group-tab:: C++ + + .. doxygenclass:: simgrid::s4u::Mutex + + .. group-tab:: Python + + .. autoclass:: simgrid.Mutex Basic management ---------------- @@ -2455,6 +2502,21 @@ Basic management .. doxygenfunction:: simgrid::s4u::Mutex::create() + .. group-tab:: Python + + .. code-block:: Python + + from simgrid import Mutex + mutex = Mutex() + + # Use a context manager to acquire and automatically release the mutex + # when leaving the scope. + with mutex: + # Access shared resource ... + pass + + .. automethod:: simgrid.Mutex.__init__ + .. group-tab:: C .. code-block:: C @@ -2480,6 +2542,12 @@ Locking .. doxygenfunction:: simgrid::s4u::Mutex::try_lock() .. doxygenfunction:: simgrid::s4u::Mutex::unlock() + .. group-tab:: Python + + .. automethod:: simgrid.Mutex.lock + .. automethod:: simgrid.Mutex.try_lock + .. automethod:: simgrid.Mutex.unlock + .. group-tab:: C .. doxygenfunction:: sg_mutex_lock(sg_mutex_t mutex) @@ -2492,7 +2560,15 @@ Locking ⁣  Barrier ================ -.. doxygenclass:: simgrid::s4u::Barrier +.. tabs:: + + .. group-tab:: C++ + + .. doxygenclass:: simgrid::s4u::Barrier + + .. group-tab:: Python + + .. autoclass:: simgrid.Barrier .. tabs:: @@ -2504,10 +2580,19 @@ Locking .. doxygentypedef:: BarrierPtr - .. doxygenfunction:: simgrid::s4u::Barrier::Barrier(unsigned int expected_actors) .. doxygenfunction:: simgrid::s4u::Barrier::create(unsigned int expected_actors) .. doxygenfunction:: simgrid::s4u::Barrier::wait() + .. group-tab:: Python + + .. code-block:: Python + + from simgrid import Barrier + barrier = Barrier(2) + + .. automethod:: simgrid.Barrier.__init__ + .. automethod:: simgrid.Barrier.wait + .. group-tab:: C .. code-block:: C @@ -2515,10 +2600,9 @@ Locking #include .. doxygentypedef:: sg_bar_t - .. doxygentypedef:: const_sg_bar_t .. doxygenfunction:: sg_barrier_init(unsigned int count) - .. doxygenfunction:: sg_barrier_destroy(const_sg_bar_t bar) + .. doxygenfunction:: sg_barrier_destroy(sg_bar_t bar) .. doxygenfunction:: sg_barrier_wait(sg_bar_t bar) @@ -2590,8 +2674,15 @@ Waiting and notifying ⁣  Semaphore ================== -.. doxygenclass:: simgrid::s4u::Semaphore +.. tabs:: + + .. group-tab:: C++ + + .. doxygenclass:: simgrid::s4u::Semaphore + + .. group-tab:: Python + .. autoclass:: simgrid.Semaphore Basic management ---------------- @@ -2607,6 +2698,19 @@ Basic management .. doxygentypedef:: SemaphorePtr .. doxygenfunction:: simgrid::s4u::Semaphore::create(unsigned int initial_capacity) + .. group-tab:: Python + + .. code-block:: Python + + from simgrid import Semaphore + semaphore = Semaphore(1) + # Automatically acquire the semaphore, and release it after leaving the scope. + with semaphore: + # Do something with the shared resource + pass + + .. automethod:: simgrid.Semaphore.__init__ + .. group-tab:: C .. code-block:: C @@ -2634,6 +2738,14 @@ Locking .. doxygenfunction:: simgrid::s4u::Semaphore::release() .. doxygenfunction:: simgrid::s4u::Semaphore::would_block() const + .. group-tab:: Python + + .. automethod:: simgrid.Semaphore.acquire + .. automethod:: simgrid.Semaphore.acquire_timeout + .. autoattribute:: simgrid.Semaphore.capacity + .. automethod:: simgrid.Semaphore.release + .. autoattribute:: simgrid.Semaphore.would_block + .. group-tab:: C .. doxygenfunction:: sg_sem_acquire(sg_sem_t sem)