From: Martin Quinson Date: Sat, 21 Jan 2023 17:04:34 +0000 (+0100) Subject: Move an example to the right section, and document it X-Git-Tag: v3.34~606 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b8591d2706cfe9126731bcde7e6ac1c4ff67b13e Move an example to the right section, and document it It was called comm-serialize, but it's more about using Link::set_concurrency_limit() so it's now called platform-comm-serialize Also document another example (was supposed to be in previous commit but anyway) --- diff --git a/MANIFEST.in b/MANIFEST.in index 4cc016d37a..fdc7ae4430 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -181,8 +181,6 @@ include examples/cpp/comm-pingpong/s4u-comm-pingpong.cpp include examples/cpp/comm-pingpong/s4u-comm-pingpong.tesh include examples/cpp/comm-ready/s4u-comm-ready.cpp include examples/cpp/comm-ready/s4u-comm-ready.tesh -include examples/cpp/comm-serialize/s4u-comm-serialize.cpp -include examples/cpp/comm-serialize/s4u-comm-serialize.tesh include examples/cpp/comm-suspend/s4u-comm-suspend.cpp include examples/cpp/comm-suspend/s4u-comm-suspend.tesh include examples/cpp/comm-testany/s4u-comm-testany.cpp @@ -333,6 +331,8 @@ include examples/cpp/network-ns3/s4u-network-ns3.cpp include examples/cpp/network-ns3/s4u-network-ns3.tesh include examples/cpp/network-wifi/s4u-network-wifi.cpp include examples/cpp/network-wifi/s4u-network-wifi.tesh +include examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp +include examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.tesh include examples/cpp/platform-failures/s4u-platform-failures.cpp include examples/cpp/platform-failures/s4u-platform-failures.tesh include examples/cpp/platform-failures/s4u-platform-failures_d.xml @@ -414,8 +414,6 @@ include examples/python/comm-pingpong/comm-pingpong.py include examples/python/comm-pingpong/comm-pingpong.tesh include examples/python/comm-ready/comm-ready.py include examples/python/comm-ready/comm-ready.tesh -include examples/python/comm-serialize/comm-serialize.py -include examples/python/comm-serialize/comm-serialize.tesh include examples/python/comm-suspend/comm-suspend.py include examples/python/comm-suspend/comm-suspend.tesh include examples/python/comm-testany/comm-testany.py @@ -450,6 +448,8 @@ include examples/python/io-degradation/io-degradation.py include examples/python/io-degradation/io-degradation.tesh include examples/python/network-nonlinear/network-nonlinear.py include examples/python/network-nonlinear/network-nonlinear.tesh +include examples/python/platform-comm-serialize/platform-comm-serialize.py +include examples/python/platform-comm-serialize/platform-comm-serialize.tesh include examples/python/platform-failures/platform-failures.py include examples/python/platform-failures/platform-failures.tesh include examples/python/platform-profile/platform-profile.py diff --git a/examples/README.rst b/examples/README.rst index eff074bb03..16b544b295 100644 --- a/examples/README.rst +++ b/examples/README.rst @@ -323,7 +323,6 @@ the simulators (as detailed in Section :ref:`options`). .. example-tab:: examples/c/comm-pingpong/comm-pingpong.c - Basic asynchronous communications ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -431,6 +430,24 @@ The ``test_any()`` returns whether at least one activity of the set has complete See also :py:func:`simgrid.Comm.test_any()`. +.. _s4u_ex_comm_host2host: + +Direct host-to-host communication +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This example demonstrates the direct communication mechanism, that allows to send data from one host to another without +relying on the mailbox mechanism. + +.. tabs:: + + .. example-tab:: examples/cpp/comm-host2host/s4u-comm-host2host.cpp + + See also :cpp:func:`simgrid::s4u::Comm::sendto_init()` and :cpp:func:`simgrid::s4u::Comm::sendto_async()`. + + .. example-tab:: examples/python/comm-host2host/comm-host2host.py + + See also :py:func:`simgrid.Comm.sendto_init()` and :py:func:`simgrid.Comm.sendto_async()`. + .. _s4u_ex_execution: Executions on the CPU @@ -544,6 +561,8 @@ This allows simulating malleable tasks. See also :ref:`simgrid.this_actor.parallel_execute()` +.. _s4u_ex_dvfs: + DVFS and pstates ^^^^^^^^^^^^^^^^ @@ -566,6 +585,10 @@ of a host can then be accessed and changed from the program. .. example-tab:: examples/platforms/energy_platform.xml + The important parts are in the :ref:`pf_tag_host` tag. The ``pstate`` attribute is the initial pstate while the ``speed`` attribute must + be a comma-separated list of values: the speed at each pstate. This platform file also describes the ``wattage_per_state`` and + ``wattage_off`` properties, that are used by the :ref:`plugin_host_energy` plugin. + .. _s4u_ex_disk_io: I/O on Disks and Files @@ -776,6 +799,28 @@ Shows how to specify an external load to resources, variating their peak speed o .. showfile:: examples/platforms/profiles/link1_latency.profile +Modifying the platform +---------------------- + +Serializing communications +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This example shows how to limit the amount of communications going through a given link. +It is very similar to the other asynchronous communication examples, but messages get serialized by the platform. +Without this call to ``Link::set_concurrency_limit(2)``, all messages would be received at the exact same timestamp since +they are initiated at the same instant and are of the same size. But with this extra configuration to the link, at most 2 +messages can travel through the link at the same time. + +.. tabs:: + + .. example-tab:: examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp + + See also :cpp:func:`simgrid::s4u::Link::set_concurrency_limit()`. + + .. example-tab:: examples/python/platform-comm-serialize/platform-comm-serialize.py + + See also :py:func:`simgrid.Link.set_concurrency_limit()`. + ================= Energy Simulation ================= diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt index 232d3d1026..cea4755a76 100644 --- a/examples/cpp/CMakeLists.txt +++ b/examples/cpp/CMakeLists.txt @@ -116,7 +116,7 @@ foreach (example activity-testany activity-waitany actor-create actor-daemon actor-exiting actor-join actor-kill actor-lifetime actor-migrate actor-suspend actor-yield actor-stacksize app-bittorrent app-chainsend app-token-ring - comm-pingpong comm-ready comm-serialize comm-suspend comm-testany comm-wait comm-waitany comm-waitall comm-waituntil + comm-pingpong comm-ready comm-suspend comm-testany comm-wait comm-waitany comm-waitall comm-waituntil comm-dependent comm-host2host comm-failure comm-throttling cloud-capping cloud-migration cloud-simple dag-comm dag-from-dax dag-from-dot dag-failure dag-io dag-scheduling dag-simple @@ -129,7 +129,7 @@ foreach (example activity-testany activity-waitany mc-bugged1 mc-bugged1-liveness mc-bugged2 mc-bugged2-liveness mc-centralized-mutex mc-electric-fence mc-failing-assert network-ns3 network-ns3-wifi network-wifi io-async io-priority io-degradation io-file-system io-file-remote io-disk-raw io-dependent - platform-failures platform-profile platform-properties + platform-comm-serialize platform-failures platform-profile platform-properties plugin-host-load plugin-link-load plugin-prodcons replay-comm replay-io routing-get-clusters diff --git a/examples/cpp/comm-serialize/s4u-comm-serialize.cpp b/examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp similarity index 87% rename from examples/cpp/comm-serialize/s4u-comm-serialize.cpp rename to examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp index 2a8397ae5a..3fe272d415 100644 --- a/examples/cpp/comm-serialize/s4u-comm-serialize.cpp +++ b/examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp @@ -3,16 +3,12 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -/* This example shows how to serialize a set of communications going through a link +/* This example shows how to serialize a set of communications going through a link using Link::set_concurrency_limit() * - * As for the other asynchronous examples, the sender initiates all the messages it wants to send and - * pack the resulting simgrid::s4u::CommPtr objects in a vector. - * At the same time, the receiver starts receiving all messages asynchronously. Without serialization, - * all messages would be received at the same timestamp in the receiver. - * - * However, as they will be serialized in a link of the platform, the messages arrive 2 by 2. - * - * The sender then blocks until all ongoing communication terminate, using simgrid::s4u::Comm::wait_all() + * This example is very similar to the other asynchronous communication examples, but messages get serialized by the platform. + * Without this call to Link::set_concurrency_limit(2) in main, all messages would be received at the exact same timestamp since + * they are initiated at the same instant and are of the same size. But with this extra configuration to the link, at most 2 + * messages can travel through the link at the same time. */ #include "simgrid/s4u.hpp" diff --git a/examples/cpp/comm-serialize/s4u-comm-serialize.tesh b/examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.tesh similarity index 94% rename from examples/cpp/comm-serialize/s4u-comm-serialize.tesh rename to examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.tesh index dee2d01923..3c88222a91 100644 --- a/examples/cpp/comm-serialize/s4u-comm-serialize.tesh +++ b/examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.tesh @@ -1,6 +1,6 @@ #!/usr/bin/env tesh -$ ${bindir:=.}/s4u-comm-serialize "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" +$ ${bindir:=.}/s4u-platform-comm-serialize "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" > [ 0.000000] (1:receiver@receiver) Wait for 10 messages asynchronously > [ 0.000000] (2:sender@sender) Send 'Message 0' to 'receiver' > [ 0.000000] (2:sender@sender) Send 'Message 1' to 'receiver' diff --git a/examples/python/CMakeLists.txt b/examples/python/CMakeLists.txt index 1efe8e23b6..168af9559a 100644 --- a/examples/python/CMakeLists.txt +++ b/examples/python/CMakeLists.txt @@ -1,9 +1,9 @@ foreach(example actor-create actor-daemon actor-join actor-kill actor-migrate actor-suspend actor-yield actor-lifetime app-masterworkers comm-wait comm-waitall comm-waitallfor comm-waitany comm-waitfor comm-failure comm-host2host comm-pingpong - comm-ready comm-serialize comm-suspend comm-testany comm-throttling comm-waitallfor comm-waituntil + comm-ready comm-suspend comm-testany comm-throttling comm-waitallfor comm-waituntil exec-async exec-basic exec-dvfs exec-remote exec-ptask - platform-profile platform-failures + platform-comm-serialize platform-profile platform-failures network-nonlinear clusters-multicpu io-degradation exec-cpu-nonlinear synchro-barrier synchro-mutex synchro-semaphore) set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/${example}.tesh) diff --git a/examples/python/comm-serialize/comm-serialize.py b/examples/python/platform-comm-serialize/platform-comm-serialize.py similarity index 100% rename from examples/python/comm-serialize/comm-serialize.py rename to examples/python/platform-comm-serialize/platform-comm-serialize.py diff --git a/examples/python/comm-serialize/comm-serialize.tesh b/examples/python/platform-comm-serialize/platform-comm-serialize.tesh similarity index 91% rename from examples/python/comm-serialize/comm-serialize.tesh rename to examples/python/platform-comm-serialize/platform-comm-serialize.tesh index 0a0174850e..f889c935e8 100644 --- a/examples/python/comm-serialize/comm-serialize.tesh +++ b/examples/python/platform-comm-serialize/platform-comm-serialize.tesh @@ -1,6 +1,6 @@ #!/usr/bin/env tesh -$ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/comm-serialize.py "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" +$ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/platform-comm-serialize.py "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" >[ 0.000000] (1:receiver@receiver) Wait for 10 messages asynchronously >[ 0.000000] (2:sender@sender) Send 'Message 0' to 'receiver' >[ 0.000000] (2:sender@sender) Send 'Message 1' to 'receiver'