X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9743125a19f37e432ea09bedd4667b9bebd2e46f..0d81d17213741458279a3ba09ac0ce75fa868089:/docs/source/Tutorial_Algorithms.rst diff --git a/docs/source/Tutorial_Algorithms.rst b/docs/source/Tutorial_Algorithms.rst index 622aeb1c17..11eebf7d41 100644 --- a/docs/source/Tutorial_Algorithms.rst +++ b/docs/source/Tutorial_Algorithms.rst @@ -22,41 +22,40 @@ actors, but posted onto a |Mailbox|_ that serve as rendez-vous point between communicating actors. .. |Actors| replace:: **Actors** -.. _Actors: api/classsimgrid_1_1s4u_1_1Actor.html +.. _Actors: app_s4u.html#s4u-actor .. |Activities| replace:: **Activities** -.. _Activities: api/classsimgrid_1_1s4u_1_1Activity.html +.. _Activities: app_s4u.html#s4u-activity .. |Hosts| replace:: **Hosts** -.. _Hosts: api/classsimgrid_1_1s4u_1_1Host.html +.. _Hosts: app_s4u.html#s4u-host .. |Links| replace:: **Links** -.. _Links: api/classsimgrid_1_1s4u_1_1Link.html +.. _Links: app_s4u.html#s4u-link .. |Storages| replace:: **Storages** -.. _Storages: api/classsimgrid_1_1s4u_1_1Storage.html +.. _Storages: app_s4u.html#s4u-storage .. |VirtualMachines| replace:: **VirtualMachines** -.. _VirtualMachines: api/classsimgrid_1_1s4u_1_1VirtualMachine.html +.. _VirtualMachines: app_s4u.html#s4u-virtualmachine .. |Host| replace:: **Host** -.. _Host: api/classsimgrid_1_1s4u_1_1Host.html +.. _Host: app_s4u.html#s4u-host .. |Link| replace:: **Link** -.. _Link: api/classsimgrid_1_1s4u_1_1Link.html +.. _Link: app_s4u.html#s4u-link .. |Mailbox| replace:: **Mailbox** -.. _Mailbox: api/classsimgrid_1_1s4u_1_1Mailbox.html +.. _Mailbox: app_s4u.html#s4u-mailbox .. |Barrier| replace:: **Barrier** -.. _Barrier: api/classsimgrid_1_1s4u_1_1Barrier.html +.. _Barrier: app_s4u.html#s4u-barrier .. |ConditionVariable| replace:: **ConditionVariable** -.. _ConditionVariable: api/classsimgrid_1_1s4u_1_1ConditionVariable.html +.. _ConditionVariable: app_s4u.html#s4u-conditionvariable .. |Mutex| replace:: **Mutex** -.. _Mutex: api/classsimgrid_1_1s4u_1_1Mutex.html - +.. _Mutex: app_s4u.html#s4u-mutex **In the remainder of this tutorial**, you will discover a simple yet fully functioning example of SimGrid simulation: the Master/Workers @@ -174,12 +173,12 @@ examples of platforms in the archive under ``examples/platforms``. .. |api_s4u_NetZone| image:: /img/extlink.png :align: middle :width: 12 -.. _api_s4u_NetZone: api/classsimgrid_1_1s4u_1_1NetZone.html#class-documentation +.. _api_s4u_NetZone: app_s4u.html#s4u-netzone .. |api_s4u_Link| image:: /img/extlink.png :align: middle :width: 12 -.. _api_s4u_Link: api/classsimgrid_1_1s4u_1_1Link.html#class-documentation +.. _api_s4u_Link: app_s4u.html#s4u-link .. literalinclude:: ../../examples/platforms/small_platform.xml :language: xml @@ -203,6 +202,8 @@ This time, we have all parts: once the program is compiled, we can execute it as follows. Note how the XBT_INFO() requests turned into informative messages. +.. "WARNING: Over dedent has detected" is expected here as we remove the $ marker this way + .. literalinclude:: ../../examples/s4u/app-masterworkers/s4u-app-masterworkers.tesh :language: shell :start-after: s4u-app-masterworkers-fun @@ -320,9 +321,9 @@ All needed dependencies are already installed in this container optional in this tutorial, it is not installed to reduce the image size. -The code template is available under ``/source/simgrid-template-s4u.git`` +The code template is available under ``/source/simgrid-template-s4u.git`` in the image. You should copy it to your working directory and -recompile it when you first log in: +recompile it when you first log in: .. code-block:: shell @@ -334,17 +335,25 @@ recompile it when you first log in: Using your Computer Natively ............................ -To take the tutorial on your machine, you first need to :ref:`install -SimGrid `, a C++ compiler and also ``pajeng`` to visualize -the traces. You may want to install `Vite -`_ to get a first glance at the -traces. The provided code template requires cmake to compile. On -Debian and Ubuntu for example, you can get them as follows: +To take the tutorial on your machine, you first need to :ref:`install +a recent version of SimGrid `, a C++ compiler and also +``pajeng`` to visualize the traces. You may want to install `Vite +`_ to get a first glance at the traces. +The provided code template requires cmake to compile. On Debian and +Ubuntu for example, you can get them as follows: .. code-block:: shell sudo apt install simgrid pajeng cmake g++ vite +For R analysis of the produced traces, you may want to install R, +and the `pajengr `_ package. + +.. code-block:: shell + + sudo apt install r-base r-cran-devtools cmake flex bison + Rscript -e "library(devtools); install_github('schnorr/pajengr');" + An initial version of the source code is provided on framagit. This template compiles with cmake. If SimGrid is correctly installed, you should be able to clone the `repository @@ -353,10 +362,12 @@ everything as follows: .. code-block:: shell - git clone git@framagit.org:simgrid/simgrid-template-s4u.git + # (exporting SimGrid_PATH is only needed if SimGrid is installed in a non-standard path) + export SimGrid_PATH=/where/to/simgrid + + git clone https://framagit.org/simgrid/simgrid-template-s4u.git cd simgrid-template-s4u/ - SimGrid_PATH=/where/to/simgrid cmake . - # (SimGrid_PATH is only needed if SimGrid is installed in a non-standard path) + cmake . make If you struggle with the compilation, then you should double check @@ -406,8 +417,7 @@ and use it as follows: .. code-block:: shell ./master-workers small_platform.xml master-workers_d.xml --cfg=tracing:yes --cfg=tracing/msg/process:yes - pj_dump --ignore-incomplete-links simgrid.trace | grep STATE > gantt.csv - Rscript draw_gantt.R gantt.csv + Rscript draw_gantt.R simgrid.trace It produces a ``Rplots.pdf`` with the following content: @@ -452,7 +462,7 @@ messages to all workers based on their number, for example as follows: for (int i = 0; i < tasks_count; i++) { std::string worker_rank = std::to_string(i % workers_count); std::string mailbox_name = std::string("worker-") + worker_rank; - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name); + simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name); mailbox->put(...); @@ -472,9 +482,8 @@ timing. ``put()`` and ``get()`` are matched regardless of their initiators' location and then the real communication occures between the involved parties. -Please refer to the full `API of Mailboxes -`_ for -more details. +Please refer to the full `Mailboxes' documentation +`_ for more details. Lab 2: Using the Whole Platform @@ -643,7 +652,7 @@ Visualizing the result vite is not enough to understand the situation, because it does not deal with categorization. This time, you absolutely must switch to R, as explained on `this page -`_. +`_. .. todo::