]> AND Private Git Repository - loba-papers.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Finalize graph generation.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 5 Mar 2013 09:39:09 +0000 (10:39 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 5 Mar 2013 16:53:50 +0000 (17:53 +0100)
supercomp11/.gitignore
supercomp11/data/Makefile
supercomp11/data/all2.pdf [new file with mode: 0644]
supercomp11/data/all2.tex [new file with mode: 0644]
supercomp11/data/allgraphs.pdf [new file with mode: 0644]
supercomp11/data/genalltex2 [new file with mode: 0755]
supercomp11/data/script.r
supercomp11/data/split-allgraphs [new file with mode: 0755]

index 5c7f2f8ab8242e67d8cd1c2a257b2acb4b16ffa3..7bbf19fad707fdabf24b2dfe329a3806f2648653 100644 (file)
@@ -2,3 +2,6 @@ supercomp11.pdf
 supercomp11.ps
 
 data/results.done
 supercomp11.ps
 
 data/results.done
+data/results2.done
+
+data/graphs/[IR][1N]-1*:1*-[gc]*[dr]-[hlt]*[es].pdf
index 85cc01d5f16f080e7746d1833c2a4b15a5aa749a..afb1ba63e0102af6e78d6889a50711bb6ba1969f 100644 (file)
@@ -1,3 +1,9 @@
+SHELL = /bin/bash
+
+.PHONY: all
+
+all: all.pdf all2.pdf allgraphs.pdf
+
 all.pdf: all.tex results.done
        pdflatex all.tex
 
 all.pdf: all.tex results.done
        pdflatex all.tex
 
@@ -6,4 +12,19 @@ all.tex: genalltex
 
 results.done: alldata plot plotall
        ./plotall
 
 results.done: alldata plot plotall
        ./plotall
-       touch results.done
+       touch $@
+
+all2.pdf: all2.tex results2.done
+       pdflatex all2.tex
+
+all2.tex: genalltex2
+       ./genalltex2 > all2.tex
+
+results2.done: data.rda script.r
+       R --no-save < script.r
+       touch $@
+
+allgraphs.pdf: results2.done
+       pdfunite \
+         graphs/{R,I}{1,N}-{10:1,1:1,1:10}-{cluster,grid}-{line,torus,hcube}.pdf \
+         $@
diff --git a/supercomp11/data/all2.pdf b/supercomp11/data/all2.pdf
new file mode 100644 (file)
index 0000000..30ccad8
Binary files /dev/null and b/supercomp11/data/all2.pdf differ
diff --git a/supercomp11/data/all2.tex b/supercomp11/data/all2.tex
new file mode 100644 (file)
index 0000000..26b37b6
--- /dev/null
@@ -0,0 +1,152 @@
+\documentclass[a4paper]{article}
+
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{lmodern}
+\usepackage[margin=1.5cm]{geometry}
+\usepackage{graphicx}
+\usepackage[francais]{babel}
+
+%%% workaround warnings about PDF 1.5 not supported
+\pdfminorversion 5
+
+\AtBeginDocument{\shorthandoff{:}}
+
+\newcommand{\IG}[1]{%
+  \includegraphics[width=6cm]{#1}}
+
+\begin{document}
+
+\begin{figure}
+  \centering
+  \IG{graphs/R1-10:1-cluster-line.pdf}%
+  \IG{graphs/R1-10:1-cluster-torus.pdf}%
+  \IG{graphs/R1-10:1-cluster-hcube.pdf}%
+
+  \IG{graphs/R1-10:1-grid-line.pdf}%
+  \IG{graphs/R1-10:1-grid-torus.pdf}%
+  \IG{graphs/R1-10:1-grid-hcube.pdf}%
+
+  \IG{graphs/RN-10:1-cluster-line.pdf}%
+  \IG{graphs/RN-10:1-cluster-torus.pdf}%
+  \IG{graphs/RN-10:1-cluster-hcube.pdf}%
+
+  \IG{graphs/RN-10:1-grid-line.pdf}%
+  \IG{graphs/RN-10:1-grid-torus.pdf}%
+  \IG{graphs/RN-10:1-grid-hcube.pdf}%
+
+  \caption{Real mode, comp/comm ratio${} = 10:1$.}
+\end{figure}
+\clearpage
+
+\begin{figure}
+  \centering
+  \IG{graphs/R1-1:1-cluster-line.pdf}%
+  \IG{graphs/R1-1:1-cluster-torus.pdf}%
+  \IG{graphs/R1-1:1-cluster-hcube.pdf}%
+
+  \IG{graphs/R1-1:1-grid-line.pdf}%
+  \IG{graphs/R1-1:1-grid-torus.pdf}%
+  \IG{graphs/R1-1:1-grid-hcube.pdf}%
+
+  \IG{graphs/RN-1:1-cluster-line.pdf}%
+  \IG{graphs/RN-1:1-cluster-torus.pdf}%
+  \IG{graphs/RN-1:1-cluster-hcube.pdf}%
+
+  \IG{graphs/RN-1:1-grid-line.pdf}%
+  \IG{graphs/RN-1:1-grid-torus.pdf}%
+  \IG{graphs/RN-1:1-grid-hcube.pdf}%
+
+  \caption{Real mode, comp/comm ratio${} = 1:1$.}
+\end{figure}
+\clearpage
+
+\begin{figure}
+  \centering
+  \IG{graphs/R1-1:10-cluster-line.pdf}%
+  \IG{graphs/R1-1:10-cluster-torus.pdf}%
+  \IG{graphs/R1-1:10-cluster-hcube.pdf}%
+
+  \IG{graphs/R1-1:10-grid-line.pdf}%
+  \IG{graphs/R1-1:10-grid-torus.pdf}%
+  \IG{graphs/R1-1:10-grid-hcube.pdf}%
+
+  \IG{graphs/RN-1:10-cluster-line.pdf}%
+  \IG{graphs/RN-1:10-cluster-torus.pdf}%
+  \IG{graphs/RN-1:10-cluster-hcube.pdf}%
+
+  \IG{graphs/RN-1:10-grid-line.pdf}%
+  \IG{graphs/RN-1:10-grid-torus.pdf}%
+  \IG{graphs/RN-1:10-grid-hcube.pdf}%
+
+  \caption{Real mode, comp/comm ratio${} = 1:10$.}
+\end{figure}
+\clearpage
+
+\begin{figure}
+  \centering
+  \IG{graphs/I1-10:1-cluster-line.pdf}%
+  \IG{graphs/I1-10:1-cluster-torus.pdf}%
+  \IG{graphs/I1-10:1-cluster-hcube.pdf}%
+
+  \IG{graphs/I1-10:1-grid-line.pdf}%
+  \IG{graphs/I1-10:1-grid-torus.pdf}%
+  \IG{graphs/I1-10:1-grid-hcube.pdf}%
+
+  \IG{graphs/IN-10:1-cluster-line.pdf}%
+  \IG{graphs/IN-10:1-cluster-torus.pdf}%
+  \IG{graphs/IN-10:1-cluster-hcube.pdf}%
+
+  \IG{graphs/IN-10:1-grid-line.pdf}%
+  \IG{graphs/IN-10:1-grid-torus.pdf}%
+  \IG{graphs/IN-10:1-grid-hcube.pdf}%
+
+  \caption{Integer mode, comp/comm ratio${} = 10:1$.}
+\end{figure}
+\clearpage
+
+\begin{figure}
+  \centering
+  \IG{graphs/I1-1:1-cluster-line.pdf}%
+  \IG{graphs/I1-1:1-cluster-torus.pdf}%
+  \IG{graphs/I1-1:1-cluster-hcube.pdf}%
+
+  \IG{graphs/I1-1:1-grid-line.pdf}%
+  \IG{graphs/I1-1:1-grid-torus.pdf}%
+  \IG{graphs/I1-1:1-grid-hcube.pdf}%
+
+  \IG{graphs/IN-1:1-cluster-line.pdf}%
+  \IG{graphs/IN-1:1-cluster-torus.pdf}%
+  \IG{graphs/IN-1:1-cluster-hcube.pdf}%
+
+  \IG{graphs/IN-1:1-grid-line.pdf}%
+  \IG{graphs/IN-1:1-grid-torus.pdf}%
+  \IG{graphs/IN-1:1-grid-hcube.pdf}%
+
+  \caption{Integer mode, comp/comm ratio${} = 1:1$.}
+\end{figure}
+\clearpage
+
+\begin{figure}
+  \centering
+  \IG{graphs/I1-1:10-cluster-line.pdf}%
+  \IG{graphs/I1-1:10-cluster-torus.pdf}%
+  \IG{graphs/I1-1:10-cluster-hcube.pdf}%
+
+  \IG{graphs/I1-1:10-grid-line.pdf}%
+  \IG{graphs/I1-1:10-grid-torus.pdf}%
+  \IG{graphs/I1-1:10-grid-hcube.pdf}%
+
+  \IG{graphs/IN-1:10-cluster-line.pdf}%
+  \IG{graphs/IN-1:10-cluster-torus.pdf}%
+  \IG{graphs/IN-1:10-cluster-hcube.pdf}%
+
+  \IG{graphs/IN-1:10-grid-line.pdf}%
+  \IG{graphs/IN-1:10-grid-torus.pdf}%
+  \IG{graphs/IN-1:10-grid-hcube.pdf}%
+
+  \caption{Integer mode, comp/comm ratio${} = 1:10$.}
+\end{figure}
+\clearpage
+
+\end{document}
diff --git a/supercomp11/data/allgraphs.pdf b/supercomp11/data/allgraphs.pdf
new file mode 100644 (file)
index 0000000..ae2856d
Binary files /dev/null and b/supercomp11/data/allgraphs.pdf differ
diff --git a/supercomp11/data/genalltex2 b/supercomp11/data/genalltex2
new file mode 100755 (executable)
index 0000000..c8762c8
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+types=( R I )
+repartitions=( 1 N )
+ratios=( 10:1 1:1 1:10 )
+platforms=( cluster grid )
+topologies=( line torus hcube )
+
+cat <<EOF
+\\documentclass[a4paper]{article}
+
+\\usepackage[T1]{fontenc}
+\\usepackage[utf8]{inputenc}
+\\usepackage{lmodern}
+\\usepackage[margin=1.5cm]{geometry}
+\\usepackage{graphicx}
+\\usepackage[francais]{babel}
+
+%%% workaround warnings about PDF 1.5 not supported
+\\pdfminorversion 5
+
+\\AtBeginDocument{\\shorthandoff{:}}
+
+\\newcommand{\\IG}[1]{%
+  \\includegraphics[width=6cm]{#1}}
+
+\\begin{document}
+
+EOF
+
+for typ in "${types[@]}"; do
+    for rat in "${ratios[@]}"; do
+        cat <<EOF
+\\begin{figure}
+  \\centering
+EOF
+        for rep in "${repartitions[@]}"; do
+            for pla in "${platforms[@]}"; do
+                for top in "${topologies[@]}"; do
+                    cat <<EOF
+  \\IG{graphs/${typ}${rep}-${rat}-${pla}-${top}.pdf}%
+EOF
+                done
+                cat <<EOF
+
+EOF
+            done
+        done
+        case $typ in
+            I) m="Integer";;
+            R) m="Real";;
+            *) m="??? $typ ???";;
+        esac
+        cat <<EOF
+  \\caption{$m mode, comp/comm ratio\${} = $rat\$.}
+\\end{figure}
+\\clearpage
+
+EOF
+    done
+done
+
+cat <<EOF
+\end{document}
+EOF
\ No newline at end of file
index 3440b86ebe9f81b77a8a942f9ec8fab041f28b8b..52af905351a19e73c5c50cc17001ef0c0e68f0b5 100644 (file)
@@ -1,5 +1,9 @@
 ## Usage: launch R, and then: source("script.r")
 
 ## Usage: launch R, and then: source("script.r")
 
+## save, and chane default options
+osp <- options("scipen")
+options(scipen=3)
+
 ## load dataset (variable is "ds")
 load("data.rda")
 
 ## load dataset (variable is "ds")
 load("data.rda")
 
@@ -39,11 +43,6 @@ draw <- function(dset = ds,
   ## save the graphical parameters
   p <- par(no.readonly=TRUE)
 
   ## save the graphical parameters
   p <- par(no.readonly=TRUE)
 
-### TODO
-### - add some spacing between each size
-### - fill in empty rows (e.g. with large size)
-### - add a label telling the size
-
   par(mar=c(13, 4, 4, 4) + 0.1,         # change margins
       mgp=c(11, 1, 0))
 
   par(mar=c(13, 4, 4, 4) + 0.1,         # change margins
       mgp=c(11, 1, 0))
 
@@ -63,7 +62,7 @@ draw <- function(dset = ds,
 
   ## draw the time axis on the left
   axis(2, labels=TRUE)
 
   ## draw the time axis on the left
   axis(2, labels=TRUE)
-  mtext("Simulated Time (s)", side=2, line=2.5)
+  mtext("Simulated time (s)", side=2, line=2.5)
 
   title(xlab="Algorithms")
 
 
   title(xlab="Algorithms")
 
@@ -98,45 +97,64 @@ draw <- function(dset = ds,
   return(dset)
 }
 
   return(dset)
 }
 
-draw2 <- function(dset) {
-  ## Extract useful data
-  x.1 <- data.frame(Algo=dset$Algo, Size=dset$Size,
-                    Idle_avg=dset$Idle_avg,
-                    Conv_avg=dset$Conv_avg,
-                    Conv_max=dset$Conv_max)
+draw2 <- function(dset = ds,
+                 draw_mode = "R",
+                 draw_distrib = 1,
+                 draw_ratio = "1:1",
+                 draw_platform = "cluster",
+                 draw_topo = "hcube") {
+
+  ## extract desired data
+  dset <- subset(dset,
+                 Mode == draw_mode & Distrib == draw_distrib &
+                 Ratio == draw_ratio &
+                 Platform == draw_platform & Topo == draw_topo)
+
+  ## reorder lines (first "plain", then "bookkeeping")
+  dset <- rbind(subset(dset, grepl("plain", Algo)),
+                subset(dset, grepl("bookkeeping", Algo)))
+  dset <- dset[order(dset$Size), ]
+
+  ## keep only useful data
+  dset.long <- data.frame(Algo=dset$Algo, Size=dset$Size,
+                          Idle_avg=dset$Idle_avg,
+                          Conv_avg=dset$Conv_avg,
+                          Conv_max=dset$Conv_max)
 
 
-  ## Reshape data -> wide
-  x.2 <- reshape(x.1, direction="wide", idvar="Algo", timevar="Size")
+  ## reshape data -> wide
+  dset.wide <- reshape(dset.long, direction="wide",
+                       idvar="Algo", timevar="Size")
 
 
-  ## Rename rows
-  rownames(x.2) <- x.2$Algo
-  #colnames(x.2) <- sub("^[^.]*\\.", "", colnames(x.2))
+  ## rename rows
+  rownames(dset.wide) <- dset.wide$Algo
+  #colnames(dset.wide) <- sub("^[^.]*\\.", "", colnames(dset.wide))
 
 
-  ## Remove first column ("Algo")
-  x.3 <- as.matrix(x.2[-1])
+  ## remove first column (aka "Algo")
+  dset.mat <- as.matrix(dset.wide[-1])
 
 
-  x.4 <- x.3[, c(FALSE,FALSE,TRUE)]
-  barplot(x.4, beside=TRUE,
-          names.arg=sub("^[^.]*\\.", "", colnames(x.4)),
-          col=rainbow(nrow(x.3), s=.5))
+  dset.plot <- dset.mat[, c(FALSE,FALSE,TRUE)]
+  barplot(dset.plot, beside=TRUE,
+          names.arg=sub("^[^.]*\\.", "", colnames(dset.plot)),
+          col=rainbow(nrow(dset.mat), s=.5))
 
 
-  x.4 <- x.3[, c(FALSE,TRUE,FALSE)]
-  barplot(x.4, beside=TRUE,
+  dset.plot <- dset.mat[, c(FALSE,TRUE,FALSE)]
+  barplot(dset.plot, beside=TRUE,
           axes=FALSE, axisnames=FALSE, add=TRUE,
           legend.text=TRUE,
           axes=FALSE, axisnames=FALSE, add=TRUE,
           legend.text=TRUE,
-          col=rainbow(nrow(x.3)))
+          args.legend=list(x="topleft", inset=c(.02,0), title="Algorithms"),
+          col=rainbow(nrow(dset.mat)))
 
 
-  x.4 <- x.3[, c(TRUE,FALSE,FALSE)]
-  barplot(x.4, beside=TRUE,
+  dset.plot <- dset.mat[, c(TRUE,FALSE,FALSE)]
+  barplot(dset.plot, beside=TRUE,
           axes=FALSE, axisnames=FALSE, add=TRUE,
           axes=FALSE, axisnames=FALSE, add=TRUE,
-          col=rainbow(nrow(x.3), v=.5))
+          col=rainbow(nrow(dset.mat), v=.5))
 
   ## finally, set titles
   t <- paste0(dset$Mode[1], dset$Distrib[1], " / ",
               dset$Ratio[1], " / ",
               dset$Platform[1], " / ", dset$Topo[1])
 
   ## finally, set titles
   t <- paste0(dset$Mode[1], dset$Distrib[1], " / ",
               dset$Ratio[1], " / ",
               dset$Platform[1], " / ", dset$Topo[1])
-  title(xlab="Platform Size",
-        ylab="Simulated Time (s)",
+  title(xlab="Platform size",
+        ylab="Simulated time (s)",
         main=t)
 
 }
         main=t)
 
 }
@@ -148,22 +166,43 @@ msg <- function(text,
   message(text)
 }
 
   message(text)
 }
 
+if (FALSE) {
 msg("First test, with algorithms \"plain\"...", wait = FALSE);
 msg("First test, with algorithms \"plain\"...", wait = FALSE);
-xx <- draw(subset(ds, grepl("[lt]_plain", Algo)),
-           draw_distrib="N")
+draw(subset(ds, grepl("[lt]_plain", Algo)), draw_distrib="N")
 
 msg("... with draw2()...")
 
 msg("... with draw2()...")
-draw2(xx)
+draw2(subset(ds, grepl("[lt]_plain", Algo)), draw_distrib="N")
 
 msg("Second test, with algorithms \"bookkeeping\"...");
 
 msg("Second test, with algorithms \"bookkeeping\"...");
-xx <- draw(subset(ds, grepl("[lt]_bookkeeping", Algo)),
-           draw_distrib="N")
+draw(subset(ds, grepl("[lt]_bookkeeping", Algo)), draw_distrib="N")
 
 msg("... with draw2()...")
 
 msg("... with draw2()...")
-draw2(xx)
+draw2(subset(ds, grepl("[lt]_bookkeeping", Algo)), draw_distrib="N")
 
 msg("Third test, with all algorithms...");
 
 msg("Third test, with all algorithms...");
-xx <- draw(draw_distrib="N")
+draw(draw_distrib="N")
 
 msg("... with draw2()...")
 
 msg("... with draw2()...")
-draw2(xx)
+draw2(draw_distrib="N")
+}
+
+system("mkdir -pv graphs")
+for (m in c("R", "I")) {
+  for (d in c("1", "N")) {
+    for (r in c("10:1", "1:1", "1:10")) {
+      for (t in c("line", "torus", "hcube")) {
+        for (p in c("grid", "cluster")) {
+          message(sprintf(">>> Drawing: %s%s / %s / %s / %s", m, d, r, p, t))
+          pdf(file=sprintf("graphs/%s%s-%s-%s-%s.pdf", m, d, r, p, t))
+          draw2(#subset(ds, grepl("[lt]_plain", Algo)),
+                draw_mode=m, draw_distrib=d, draw_ratio=r,
+                draw_topo=t, draw_platform=p)
+          dev.off()
+        }
+      }
+    }
+  }
+}
+
+## restore default options
+options(scipen=osp)
diff --git a/supercomp11/data/split-allgraphs b/supercomp11/data/split-allgraphs
new file mode 100755 (executable)
index 0000000..b414175
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+
+make allgraphs.pdf
+
+mkdir -vp graphs
+cd graphs
+
+echo "Separate pages..."
+pdfseparate ../allgraphs.pdf g-%d.pdf || true
+
+for f in g-[0-9]*.pdf; do
+    n=$(pdftotext $f - | sed '\,/,!d;s, / ,-,g').pdf
+    mv -v $f $n
+done