From 720f647c25385f8ab4a520f6084d065affa9b554 Mon Sep 17 00:00:00 2001 From: degomme Date: Fri, 8 Mar 2019 12:05:11 +0100 Subject: [PATCH] Switch s4u tuto to pajengr as well. --- docs/source/Tutorial_Algorithms.rst | 11 +++++++++-- docs/source/tuto_s4u/draw_gantt.R | 9 +++++---- tools/docker/Dockerfile.tuto-s4u | 6 ++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/source/Tutorial_Algorithms.rst b/docs/source/Tutorial_Algorithms.rst index 27552d58cf..e12657f691 100644 --- a/docs/source/Tutorial_Algorithms.rst +++ b/docs/source/Tutorial_Algorithms.rst @@ -345,6 +345,14 @@ Debian and Ubuntu for example, you can get them as follows: 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 @@ -408,8 +416,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: diff --git a/docs/source/tuto_s4u/draw_gantt.R b/docs/source/tuto_s4u/draw_gantt.R index 5fd230b83e..f3ab44d450 100644 --- a/docs/source/tuto_s4u/draw_gantt.R +++ b/docs/source/tuto_s4u/draw_gantt.R @@ -1,16 +1,17 @@ #!/usr/bin/env Rscript args = commandArgs(trailingOnly=TRUE) library(ggplot2) +library(pajengr) # Load and relabel the data -df = read.csv(args[1], header=F, strip.white=T) -names(df) = c("Type", "Actor", "Container", "Start", "End", "Duration", "Level", "State"); +df = pajeng_read(args[1]) +names(df$state) = c("Type", "Actor", "Container", "Start", "End", "Duration", "Level", "State"); # Actually draw the graph -p = ggplot(df) + geom_segment(aes(x=Start, xend=End, y=Actor, yend=Actor,color=State), size=5); +p = ggplot(df$state) + geom_segment(aes(x=Start, xend=End, y=Actor, yend=Actor,color=State), size=5); # Cosmetics to compact the resulting graph -p.height <- length(unique(df$Actor)) * 0.05 + 2; +p.height <- length(unique(df$state$Actor)) * 0.05 + 2; pdf(height = p.height) # Produce the pdf file diff --git a/tools/docker/Dockerfile.tuto-s4u b/tools/docker/Dockerfile.tuto-s4u index 022b01e1b5..ff7ddccb57 100644 --- a/tools/docker/Dockerfile.tuto-s4u +++ b/tools/docker/Dockerfile.tuto-s4u @@ -3,8 +3,10 @@ FROM simgrid/stable # - Clone simgrid-template-s4u, as it is needed by the tutorial # - Add an empty makefile advising to run cmake before make, just in case -RUN apt update && apt install -y pajeng r-base r-cran-ggplot2 r-cran-dplyr cmake g++ git libboost-all-dev&& \ +RUN apt update && apt install -y pajeng r-base r-cran-ggplot2 r-cran-dplyr r-cran-devtools cmake g++ git libboost-all-dev flex bison&& \ cd /source && \ git clone --depth=1 https://framagit.org/simgrid/simgrid-template-s4u.git simgrid-template-s4u.git && \ printf "master-workers ping-pong:\n\t@echo \"Please run the following command before make:\";echo \" cmake .\"; exit 1" > Makefile &&\ - apt autoremove -y && apt clean && apt autoclean \ No newline at end of file + apt autoremove -y && apt clean && apt autoclean + +RUN Rscript -e "library(devtools); install_github('schnorr/pajengr');" -- 2.20.1