mini-volrend.org 6.27 KB
Newer Older
aumgn's avatar
aumgn committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#+TITLE: Mini-volrend pinning benchmark
#+AUTHOR: Christopher Ferreira

* Experiment
  :PROPERTIES:
  :tangle:   (concat "/" remote ":bench/mvolrend.sh")
  :shebang:  #!/bin/bash
  :results:  silent
  :eval:     never
  :END:

** Usage
This section describes a script which can be run remotely.
This script will run the application with multiple parameters and produce a csv file
'data' containing the results.

#+BEGIN_SRC sh
usage() {
  cat <<HD
Usage: $0 <cores> <policy> <threads> <iterations> <repeat>
     <cores>        list of number of cores
     <policy>       list of placement policy among { default, spread, pinned }
     <threads>      list of number of threads
     <iterations>   list of number of threads
     <repeat>       the number of time to run the application for each parameter combinations
HD
}
#+END_SRC

** Run

#+BEGIN_SRC sh
  run() {
      cores="$1"
      policy="$2"
      threads="$3"
      iterations="$4"
      repeat="$5"

      filebase="$LOGDIR/$cores.$policy.$threads.$iterations"
      for i in $(seq 1 $repeat); do
          out="$filebase.$i.out"
          err="$filebase.$i.err"
          echo "$SRCDIR/mvolrend $cores $policy $threads $iterations" >$out
          $SRCDIR/mvolrend $cores $policy $threads $iterations >>$out 2>>$err
          printf "%d,%s,%d,%d,%s\n" $cores $policy $threads $iterations $(tail -1 $err) >>$DATAFILE
      done
  }

  if [[ $# != 5 ]]; then
      usage $0
      exit 1
  fi

  SRCDIR="$HOME/bench/src/mini-volrend"
  BASEDIR="$HOME/bench/mini-volrend"
  LOGDIR="$BASEDIR/log"
  DATAFILE="$BASEDIR/data"

  rm -rf $LOGDIR
  mkdir $LOGDIR

  echo -n '' > $DATAFILE

aumgn's avatar
aumgn committed
65
66
67
  sudo cat /etc/os-release >> $LOGDIR/system
  sudo sysctl -a >> $LOGDIR/system 2>/dev/null

aumgn's avatar
aumgn committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
  old_autogroup=$(sudo sysctl -n kernel.sched_autogroup_enabled)
  old_migration_cost=$(sudo sysctl -n kernel.sched_migration_cost_ns)
  sudo sysctl -q kernel.sched_migration_cost_ns=500000
  sudo sysctl -q kernel.sched_autogroup_enabled=0

  make -C$SRCDIR >$LOGDIR/make 2>&1

  repeat=$5
  for cores in $1; do
  for policy in $2; do
  for threads in $3; do
  for iterations in $4; do
      run $cores $policy $iterations $threads $repeat
  done
  done
  done
  done

  sudo sysctl -q kernel.sched_migration_cost_ns=$old_migration_cost
  sudo sysctl -q kernel.sched_autogroup_enabled=$old_autogroup

  echo ''
  echo " => Data file $DATAFILE written"
#+END_SRC


* Retrieve data

** Retrieve

#+HEADER: :var remote=(identity remote)
#+BEGIN_SRC sh
  scp $remote:~/bench/mini-volrend/data ./data
  [ -f ./data ] && echo 'Ok !'
#+END_SRC

#+RESULTS:
: ok !


* Cycles Plot
  :PROPERTIES:
  :colnames: yes
  :session:  minivolrend-cycles
  :width:    800
  :height:   600
  :units:    px
  :END:

** Load libraries

#+BEGIN_SRC R :colnames no :results value verbatim
  library('dplyr')
  library('tidyr')
  library('ggplot2')
  library('ggthemes')
  library('ggthemr')

  flat_theme <- ggthemr('flat', set_theme = FALSE)

  'Ok !'
#+END_SRC

#+RESULTS:
: Ok !

** Load data

#+BEGIN_SRC R
  data <- read.csv('./data', header = FALSE)
  names(data) <- c('Cores', 'Policy', 'Threads', 'Size', 'Cycles')
  summary(data)
#+END_SRC

#+RESULTS:
| Cores      | Policy     | Threads    | Size          | Cycles            |
|------------+------------+------------+---------------+-------------------|
| Min.   :64 | default:19 | Min.   :64 | Min.   : 1000 | Min.   :1.554e+09 |
| 1st Qu.:64 | spread :19 | 1st Qu.:64 | 1st Qu.: 3125 | 1st Qu.:5.758e+09 |
| Median :64 | nil        | Median :64 | Median : 5500 | Median :9.206e+09 |
| Mean   :64 | nil        | Mean   :64 | Mean   : 5500 | Mean   :9.288e+09 |
| 3rd Qu.:64 | nil        | 3rd Qu.:64 | 3rd Qu.: 7875 | 3rd Qu.:1.272e+10 |
| Max.   :64 | nil        | Max.   :64 | Max.   :10000 | Max.   :1.654e+10 |

** Process Data

#+BEGIN_SRC R
   processed <- data %>%
     select(Policy, Size, Cycles) %>%
     group_by(Policy, Size) %>%
     summarise(
       CyclesMean = mean(Cycles / 100000),
       CyclesSd   = 0#sd(Cycles / 100000)
     )
#+END_SRC

#+RESULTS:
| Policy  |  Size |   CyclesMean | CyclesSd |
|---------+-------+--------------+----------|
| default |  1000 |  25685.30668 |        0 |
| default |  1500 |  30627.04361 |        0 |
| default |  2000 |  39943.30782 |        0 |
| default |  2500 |  48041.63686 |        0 |
| default |  3000 |  67411.58454 |        0 |
| default |  3500 |  59154.02262 |        0 |
| default |  4000 |  71082.23426 |        0 |
| default |  4500 |  80477.38867 |        0 |
| default |  5000 |  89751.58075 |        0 |
| default |  5500 |  94369.26848 |        0 |
| default |  6000 |  119222.4915 |        0 |
| default |  6500 | 113615.16234 |        0 |
| default |  7000 | 117116.01628 |        0 |
| default |  7500 | 124599.73915 |        0 |
| default |  8000 | 142570.63506 |        0 |
| default |  8500 | 144073.28981 |        0 |
| default |  9000 | 154863.23641 |        0 |
| default |  9500 | 158322.47428 |        0 |
| default | 10000 | 165420.82007 |        0 |
| spread  |  1000 |  15539.64408 |        0 |
| spread  |  1500 |  24126.24466 |        0 |
| spread  |  2000 |  31615.36301 |        0 |
| spread  |  2500 |  40234.70316 |        0 |
| spread  |  3000 |  47610.86413 |        0 |
| spread  |  3500 |  57054.43455 |        0 |
| spread  |  4000 |  64519.15229 |        0 |
| spread  |  4500 |  71161.51164 |        0 |
| spread  |  5000 |   81887.9691 |        0 |
| spread  |  5500 |  87057.85827 |        0 |
| spread  |  6000 |  96604.58059 |        0 |
| spread  |  6500 | 104183.25773 |        0 |
| spread  |  7000 | 114112.07064 |        0 |
| spread  |  7500 | 120278.94233 |        0 |
| spread  |  8000 |  128000.6926 |        0 |
| spread  |  8500 | 136402.62409 |        0 |
| spread  |  9000 | 146934.27596 |        0 |
| spread  |  9500 | 151672.42884 |        0 |
| spread  | 10000 | 163932.05907 |        0 |

** Plot

#+BEGIN_SRC R :results output graphics :file output.png
  ggplot(processed
    x = Size,
    y = CyclesMean
  ) +
    geom_line(aes(
      x = Size,
      y = CyclesMean,
      colour = Policy
    )) +
    geom_pointrange(aes(
      x = Size,
      y = CyclesMean,
      ymin = CyclesMean - CyclesSd,
      ymax = CyclesMean + CyclesSd,
      colour = Policy
    )) +
    flat_theme$theme +
    theme(legend.position = "bottom")
#+END_SRC

#+RESULTS:
[[file:output.png]]

* Footer
# Local Variables:
# remote: "mc2"
# End: