From: Martin Quinson Date: Tue, 21 Aug 2018 04:43:15 +0000 (+0200) Subject: tuto_s4u: improve part on initial visualization X-Git-Tag: v3_21~234 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5ed5698f8045a03bb3a8dac94146f1ccdcd440c1?hp=06fb23775d9c37e19f357bea5c6dad37483553a0 tuto_s4u: improve part on initial visualization --- diff --git a/docs/source/tuto_s4u.rst b/docs/source/tuto_s4u.rst index 1ebea6b0a0..a6b54d319a 100644 --- a/docs/source/tuto_s4u.rst +++ b/docs/source/tuto_s4u.rst @@ -52,7 +52,7 @@ simple application is composed of two kind of actors: the **master** is in charge of distributing some computational tasks to a set of **workers** that execute them. -.. image:: /images/tuto-masterworkers-intro.svg +.. image:: /tuto_s4u/img/intro.svg :align: center We first present a round-robin version of this application, where the @@ -198,7 +198,7 @@ the simulation prints things, but the truth is that we have no idea of whether this is a good algorithm to dispatch tasks to the workers. This very simple setting raises many interesting questions: -.. image:: /images/tuto-masterworkers-question.svg +.. image:: /tuto_s4u/img/question.svg :align: center - Which algorithm should the master use? Or should the worker decide @@ -266,20 +266,22 @@ applications (one in light gray and the other in dark gray) running in concurrence and showing resource usage over a long period of time. It was obtained with the Triva software. -.. image:: /images/tuto-masterworkers-result.png +.. image:: /tuto_s4u/img/result.png :align: center Prerequisite ............ Before your proceed, you need to :ref:`install SimGrid `, a -C++ compiler and also ``pajeng`` to visualize the traces. The provided -code template requires cmake to compile. On Debian and Ubuntu for -example, you can get them as follows: +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++ + sudo apt install simgrid pajeng cmake g++ vite An initial version of the source code is provided on framagit. This template compiles with cmake. If SimGrid is correctly installed, you @@ -321,9 +323,33 @@ specify the full path to simgrid-colorizer on the above line, such as ``/opt/simgrid/bin/simgrid-colorizer``. If you did not install it at all, you can find it in /bin/colorize. -.. todo:: +For a classical Gantt-Chart vizualisation, you can use `Vite +`_ as follows: + +.. code-block:: shell + + ./master-workers small_platform.xml master-workers_d.xml --cfg=tracing:yes --cfg=tracing/msg/process:yes + vite simgrid.trace + +.. image:: /tuto_s4u/img/vite-screenshot.png + :align: center + +But if you want the full power to visualize SimGrid traces, you need +to use R. As a start, you can download this `starter script +`_ +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 + +It produces a ``Rplots.pdf`` with the following content: + +.. image:: /tuto_s4u/img/Rscript-screenshot.png + :align: center - Explain how to generate a Gantt-Chart with S4U and pajeng. Lab 1: Simpler deployments -------------------------- @@ -388,7 +414,7 @@ Please refer to the full `API of Mailboxes Lab 2: Using the whole platform -------------------------- +------------------------------- It is now easier to add a new worker, but you still has to do it manually. It would be much easier if the master could start the diff --git a/docs/source/tuto_s4u/draw_gantt.R b/docs/source/tuto_s4u/draw_gantt.R new file mode 100644 index 0000000000..2d0c4e4df1 --- /dev/null +++ b/docs/source/tuto_s4u/draw_gantt.R @@ -0,0 +1,23 @@ +#!/usr/bin/env Rscript +args = commandArgs(trailingOnly=TRUE) +library(ggplot2) +df = read.csv(args[1], header=F, strip.white=T) +names(df) = c("Type", "Actor", "Container", "Start", "End", "Duration", "Level", "State"); +ggplot(df) + + geom_segment(aes(x=Start, xend=End, + y=Actor, yend=Actor,color=State), size=5) + + scale_fill_brewer(palette="Set1") + + theme_bw() + + theme ( + plot.margin = unit(c(0,0,0,0), "cm"), + legend.spacing = unit(1, "mm"), + panel.grid = element_blank(), + legend.position = "top", + legend.justification = "left", + legend.box.spacing = unit(0, "pt"), + legend.box.margin = margin(0,0,0,0)) -> p; + +p.height <- length(unique(df$Actor)) * 0.05 + 2; +pdf(height = p.height) +plot(p) +dev.off() diff --git a/docs/source/tuto_s4u/img/Rscript-screenshot.png b/docs/source/tuto_s4u/img/Rscript-screenshot.png new file mode 100644 index 0000000000..c3859f4e68 Binary files /dev/null and b/docs/source/tuto_s4u/img/Rscript-screenshot.png differ diff --git a/docs/source/images/tuto-masterworkers-intro.svg b/docs/source/tuto_s4u/img/intro.svg similarity index 100% rename from docs/source/images/tuto-masterworkers-intro.svg rename to docs/source/tuto_s4u/img/intro.svg diff --git a/docs/source/images/tuto-masterworkers-question.svg b/docs/source/tuto_s4u/img/question.svg similarity index 100% rename from docs/source/images/tuto-masterworkers-question.svg rename to docs/source/tuto_s4u/img/question.svg diff --git a/docs/source/images/tuto-masterworkers-result.png b/docs/source/tuto_s4u/img/result.png similarity index 100% rename from docs/source/images/tuto-masterworkers-result.png rename to docs/source/tuto_s4u/img/result.png diff --git a/docs/source/tuto_s4u/img/vite-screenshot.png b/docs/source/tuto_s4u/img/vite-screenshot.png new file mode 100644 index 0000000000..b4051b99a2 Binary files /dev/null and b/docs/source/tuto_s4u/img/vite-screenshot.png differ