]> AND Private Git Repository - loba-papers.git/blob - supercomp11/data/script.r
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Updated script.r
[loba-papers.git] / supercomp11 / data / script.r
1 # Usage: launch R, and then: source("script.r")
2
3 # load dataset (variable is "ds")
4 load("data.rda")
5
6 # extract data for plain algorithms, in real mode
7 ds.base <- subset(ds, Mode == "R" & grepl("[lt]_plain", Algo))
8
9 # extract data for one experiment
10 #xx <- subset(ds,
11 #             Mode == "R" & Distrib == 1 & Ratio == "1:1" &
12 #             Platform == "cluster" & Size == 16 & Topo == "line")
13
14 xx <- subset(ds,
15              Mode == "R" & Distrib == "N" & Ratio == "1:1" &
16              Platform == "cluster" & Topo == "hcube")
17
18 # only keep plain algorithms with default value for k...
19 xx <- subset(xx, grepl("[lt]_plain", Algo))
20
21 # reorder lines (first "plain", then "bookkeeping")
22 xx <- rbind(subset(xx, grepl("plain", Algo)),
23             subset(xx, grepl("bookkeeping", Algo)))
24 xx <- xx[order(xx$Size), ]
25
26 # finally, add an "Index" attribute(, for further processing
27 xx <- cbind(xx, Index=c(1:length(xx$Size)))
28
29 # save the graphical parameters
30 p <- par(no.readonly=TRUE)
31
32
33 ### TODO
34 ### - add some spacing between each size
35 ### - fill in empty rows (e.g. with large size)
36 ### - add a label telling the size
37
38 par(mar=c(13, 4, 4, 4) + 0.1,           # change margins
39     mgp=c(11, 1, 0))
40
41 par(las=3)                              # always draw labels vertically
42
43 # compute the time range: 0..max+20%
44 time_range <- c(0, range(xx$Conv_max)[2] * 1.2)
45
46 # first draw the bars
47 barplot(xx$Conv_max, axes=FALSE, col="red",
48         names=xx$Algo,
49         ylim=time_range)
50 barplot(xx$Conv_avg, axes=FALSE, col="green",
51         add=TRUE)
52 barplot(xx$Idle_avg, axes=FALSE, col="blue",
53         add=TRUE)
54
55 # draw the time axis on the left
56 axis(2, labels=TRUE)
57 mtext("Time (s)", side=2, line=2.5)
58
59 title(xlab="Algorithms")
60
61 # start a new graph, but drawn on the same device
62
63 # compute the data range
64 x_data_range <- c(0.6, length(xx$Algo) + 0.4)
65 data_range <- c(0, range(xx$Data_amnt)[2] * 1.04)
66
67 # draw the data amnt line graph
68 #par(new=TRUE)
69 #plot(xx$Data_amnt, axes=FALSE, xlab="", type="b",
70 #     xlim=x_data_range,
71 #     yaxs="i", ylim=data_range)
72
73 for (alg in unique(xx$Algo)) {
74   print(alg);
75   yy <- subset(xx, Algo == alg)
76   par(new=TRUE)
77   plot(yy$Index, yy$Data_amnt, axes=FALSE, xlab="", type="b",
78        xlim=x_data_range,
79        yaxs="i", ylim=data_range)
80 }
81
82 # draw the data amnt axis on the right
83 axis(4, labels=TRUE)
84 mtext("Data amount (relative)", side=4, line=2.5)
85
86 # finally, set title
87 t <- paste0(xx$Mode[1], xx$Distrib[1], " / ", xx$Ratio[1], " / ",
88             xx$Platform[1], " / ", xx$Topo[1])
89 title(main=t)
90
91 # restore the graphical parameters
92 par(p)