source: doc/theses/colby_parsons_MMAth/benchmarks/actors/run@ 9235192c

Last change on this file since 9235192c was 9235192c, checked in by caparsons <caparson@…>, 3 years ago

added support for missed gulps benchmark

  • Property mode set to 100755
File size: 17.2 KB
Line 
1#!/bin/bash -
2
3false=0; true=1
4
5# Usage: arch [ hostname ] returns hostname, cores, startcore
6#
7# Define machine architecture based on starting socket, CPUs (cores) per socket, number of
8# sockets, has hyperthreading.
9
10start=0
11
12arch() {
13 hostname=${1:-`hostname`} # return value
14 hashyper=${true} # assume machine has hyperthreads
15 if [ "${hostname}" = "plg2" ] ; then
16 startsocket=${start}
17 cps=16 # coresPerSocket
18 sockets=2
19 hashyper=${false} # has no hyperthreads
20 elif [ "${hostname}" = "nasus" ] ; then
21 startsocket=${start}
22 cps=64 # coresPerSocket
23 sockets=2
24 elif [ "${hostname}" = "pyke" ] ; then
25 startsocket=${start}
26 cps=24 # coresPerSocket
27 sockets=2
28 elif [ "${hostname}" = "jax" ] ; then
29 startsocket=${start}
30 cps=24 # coresPerSocket
31 sockets=4
32 else
33 echo "unsupported host" ${hostname}
34 exit 1
35 fi
36 cores=$(( ${cps} * ${sockets} ))
37 startcore=$(( ${startsocket} * ${cps} ))
38}
39
40# Usage: affinity (global cps, sockets, startsocket, hashyper, cores, startcore, wrap)
41# returns taskset argument
42#
43# This routine assumes hyperthreading has only 2 hyperthreads per core.
44#
45# If hyperthread scanning is used: processor units are assigned across the low-number hyperthreads
46# of the socket's cores. When the low-number hyperthreads are filled, the high-number hyperhtreads
47# are assigned across the socket's cores. Then the next socket is assigned.
48#
49# If hyperthread wrapping is used: processor units are assigned in low/high-number pairs of
50# hyperthreads across the socket's cores. Then the next socket is assigned.
51
52wrap=${false} # set to control hyperthread assignment across socket cores
53
54affinity() {
55 if [ ${wrap} -eq ${true} -a ${hashyper} -eq ${false} ] ; then
56 echo "architecture does not support hyperthreading for wrapping"
57 exit 1
58 fi
59 taskset="" # return value
60 set -- $(( ${1} - 1 )) # decrement $1
61 if [ ${1} -eq 0 ] ; then taskset="${startcore}-${startcore}"; return; fi
62 if [ ${1} -ge $(( ${cps} * ( ${sockets} - ${startsocket} ) * ( ${hashyper} + 1 ) )) ] ; then # error
63 echo "not enough cores $(( ${cores} * ${sockets} )) for $(( ${1} + 1 )) starting at ${startcore}"
64 exit 1
65 fi
66 if [ ${hashyper} -eq ${false} ] ; then taskset="${startcore}-$(( ${1} + ${startcore} ))"; return; fi # no hyperthreads
67 start2=$(( ${startcore} + ${cores} ))
68 if [ ${wrap} -eq ${true} ] ; then # hyperthread wrapping
69 end1=$(( ${1} / 2 + ${startcore} ))
70 end2=$(( ${end1} + ${cores} ))
71 if [ $(( ${1} % 2 )) -eq 0 ] ; then
72 end2=$(( ${end2} - 1 ))
73 fi
74 taskset="${startcore}-${end1},${start2}-${end2}"
75 else # hyperthread scanning
76 if [ ${1} -lt ${cps} ] ; then taskset="${startcore}-$(( ${1} + ${startcore} ))"; return; fi
77 filled=$(( ${1} / ( ${cps} * 2 ) * ${cps} ))
78 modulus=$(( ${1} % ( ${cps} * 2 ) )) # leftover cores added to saturated sockets
79 if [ ${modulus} -gt ${cps} ] ; then
80 taskset="${startcore}-$(( ${startcore} + ${filled} + ${cps} - 1 )),${start2}-$(( ${start2} + ${filled} + ${modulus} % ${cps} ))"
81 else
82 taskset="${startcore}-$(( ${startcore} + ${filled} + ${modulus} )),${start2}-$(( ${start2} + ${filled} - 1 ))"
83 fi
84 fi
85}
86
87#used for output formatting
88column_headers="proc\ttime (s)"
89
90# executor config
91batch='100'
92nRounds='400' #500
93
94# matrix config
95size='3072'
96
97# repeat config
98messages='100000'
99n_repeats='200' #200
100
101# balance config
102nOneRounds='2000'
103nMultiRounds='800'
104
105# static config
106n_static_sends='100000000'
107
108# dynamic config
109n_dynamic_sends='20000000'
110
111numtimes=5
112
113# bench_cores='1 2 4 8 16 24 32'
114bench_cores='1 2 4 8 16 24 32 48'
115# bench_cores='48'
116
117# toggle specific experiment configs
118missed_gulps=${true}
119
120# toggle benchmarks
121executor=${true}
122matrix=${true}
123repeat=${true}
124balance=${false}
125static=${false}
126dynamic=${false}
127
128# names=('CFA-LV' 'CFA-NS' 'CFA-R')
129# var_flags=('-D__STEAL=1 -DSEARCH=1' '' '-D__STEAL=1 -DRAND=1')
130
131# names=('CFA-NS')
132# var_flags=('')
133
134names=('CFA')
135var_flags=('-D__STEAL=1 -DSEARCH=1')
136
137# names=('CFA' 'CFA-STAT')
138# var_flags=('-D__STEAL=1 -DSEARCH=1' '-D__STEAL=1 -DSTATS')
139
140# names=()
141# var_flags=()
142
143runCAF=${true}
144runUCPP=${true}
145runPROTO=${true}
146runAKKA=${true}
147# runCAF=${false}
148# runUCPP=${false}
149# runPROTO=${false}
150# runAKKA=${false}
151
152if [ ${missed_gulps} -eq ${true} ] ; then
153 bench_cores='2 4 8 16 24 32 48'
154 column_headers="proc\tmissed\ttime (s)"
155 names=('CFA')
156 var_flags=('-D__STEAL=1 -DSEARCH=1 -DACTOR_STATS_QUEUE_MISSED')
157 runCAF=${false}
158 runUCPP=${false}
159 runPROTO=${false}
160 runAKKA=${false}
161fi
162
163cfa=~/cfa-cc/driver/cfa
164
165# Helpers to minimize code duplication
166
167# repeats a command ${numtimes}
168preprint=''
169repeat_command() {
170 t=1
171 while [ ${t} -le ${numtimes} ] ; do
172 echo -n -e ${preprint}
173 "${@}"
174 t=`expr ${t} + 1`
175 done
176}
177
178# prints the leading info for a given run of a variant
179print_header() {
180 echo ${1}':'
181 echo -e "proc\ttime (s)"
182}
183
184# runs the current benchmark with provided args
185# only works for standard-run benchmarks (not Akka)
186# must split into pre and post args to be able to supply val of p
187pre_args=''
188post_args=''
189single_run() {
190 affinity ${1}
191 preprint="${1}\t"
192 repeat_command taskset -c ${taskset} ./a.${hostname} ${pre_args} ${1} ${post_args}
193}
194
195# runs the current bench for all processor vals
196# works for standard benchs that dont need to set a config file (not Akka or CAF)
197run_bench() {
198 for p in ${bench_cores} ; do
199 single_run ${p}
200 done
201}
202
203set_akka_parallelism() {
204 sed -i "s/parallelism-min = .*/parallelism-min = ${1}/g" application.conf
205 sed -i "s/parallelism-max = .*/parallelism-max = ${1}/g" application.conf
206}
207
208arch # get hostname
209
210# set up leading info for python script
211echo $numtimes
212echo $bench_cores
213
214for i in ${!names[@]}; do
215 echo -n ${names[$i]}" "
216done
217if [ ${runCAF} -eq ${true} ] ; then
218 echo -n 'CAF '
219fi # done CAF
220if [ ${runAKKA} -eq ${true} ] ; then
221 echo -n 'Akka '
222fi # done AKKA
223if [ ${runUCPP} -eq ${true} ] ; then
224 echo -n 'uC++ '
225fi # done UCPP
226if [ ${runPROTO} -eq ${true} ] ; then
227 echo -n 'ProtoActor '
228fi
229echo ""
230
231# done printing header info for output
232
233# cfa flags
234cfa_flags='-quiet -O3 -nodebug -DNDEBUG'
235
236# CAF flags
237prefixCAF='-O3 -Wall -std=c++17 -I/home/pabuhr/software/nasus/Actors/experiments/CAF/actor-framework/libcaf_core -I/home/pabuhr/software/nasus/Actors/experiments/CAF/actor-framework/libcaf_core/caf -I/home/pabuhr/software/nasus/Actors/experiments/CAF/actor-framework/build/libcaf_core -L/home/pabuhr/software/nasus/Actors/experiments/CAF/actor-framework/build/libcaf_core -L/home/pabuhr/software/nasus/Actors/experiments/CAF/actor-framework/build/libcaf_io'
238suffixCAF='-lcaf_io -lcaf_core -Wl,-rpath=CAF/actor-framework/build/libcaf_core'
239
240# AKKA flags
241sbtflags="--warn -J-Xmx32g"
242
243# UCPP flags
244UCPPflags="-quiet -g -Wall -Wextra -O3 -nodebug -DNDEBUG -multi"
245UCPP=~/ucpp/u++-7.0.0/bin/u++
246
247# run the benchmarks
248
249# /usr/bin/time -f "%Uu %Ss %Er %Mkb"
250if [ ${executor} -eq ${true} ] ; then
251 echo "executor"
252 pre_args="40000 100 ${nRounds}"
253 post_args="${batch}"
254 cd cfa # CFA RUN
255 for i in ${!names[@]}; do
256 print_header ${names[$i]}
257 ${cfa} ${cfa_flags} ${var_flags[$i]} executor.cfa -o a.${hostname} > /dev/null 2>&1
258 run_bench
259 rm a.${hostname}
260 done
261 cd - > /dev/null # done CFA
262 if [ ${runCAF} -eq ${true} ] ; then # CAF RUN
263 cd caf
264 print_header 'CAF'
265 g++ ${prefixCAF} CAFExecutor.cpp ${suffixCAF} -o a.${hostname} > /dev/null 2>&1
266 for p in ${bench_cores} ; do
267 sed -i "s/max-threads = .*/max-threads = ${p}/g" caf-application.conf # set CAF parallelism
268 single_run ${p}
269 done
270 rm a.${hostname}
271 # set back parallelism
272 sed -i "s/max-threads = .*/max-threads = 1/g" caf-application.conf
273 cd - > /dev/null
274 fi # done CAF
275 if [ ${runAKKA} -eq ${true} ] ; then # AKKA RUN
276 cd akka/Executor
277 rm -rf project target # random out of memory errors without this
278 print_header 'Akka'
279 for p in ${bench_cores} ; do
280 set_akka_parallelism ${p}
281 affinity ${p}
282 taskset -c ${taskset} sbt ${sbtflags} "run ${pre_args} ${p} ${post_args} ${numtimes}" 2>&1 | grep -v "SLF4J:" | grep -v "Slf4jLogger started" | sed -e "s/\x1b\[0J//"
283 sbt clean > /dev/null
284 done
285 # set back parallelism
286 set_akka_parallelism 1
287 cd - > /dev/null
288 fi # done AKKA
289 if [ ${runUCPP} -eq ${true} ] ; then # UCPP RUN
290 cd ucpp
291 print_header 'uC++'
292 ${UCPP} ${UCPPflags} uC++Executor.cc -o a.${hostname} > /dev/null 2>&1
293 run_bench
294 rm a.${hostname}
295 cd - > /dev/null
296 fi # done UCPP
297 if [ ${runPROTO} -eq ${true} ] ; then # PROTO RUN
298 print_header 'ProtoActor'
299 cd proto/Executor
300 go build -o a.${hostname} > /dev/null 2>&1
301 run_bench
302 rm a.${hostname}
303 cd - > /dev/null
304 fi # done PROTO
305 echo ""
306fi
307
308if [ ${matrix} -eq ${true} ] ; then
309 echo "matrix"
310 pre_args="${size} ${size} ${size}"
311 post_args=""
312 cd cfa
313 for i in ${!names[@]}; do
314 print_header ${names[$i]}
315 ${cfa} ${cfa_flags} ${var_flags[$i]} matrix.cfa -o a.${hostname} > /dev/null 2>&1
316 run_bench
317 rm a.${hostname}
318 done
319 cd - > /dev/null
320 if [ ${runCAF} -eq ${true} ] ; then # CAF RUN
321 cd caf
322 print_header 'CAF'
323 g++ ${prefixCAF} CAFMatrix.cpp ${suffixCAF} -o a.${hostname} > /dev/null 2>&1
324 for p in ${bench_cores} ; do
325 sed -i "s/max-threads = .*/max-threads = ${p}/g" caf-application.conf # set CAF parallelism
326 single_run ${p}
327 done
328 rm a.${hostname}
329
330 # set back parallelism
331 sed -i "s/max-threads = .*/max-threads = 1/g" caf-application.conf
332 cd - > /dev/null
333 fi # done CAF
334 if [ ${runAKKA} -eq ${true} ] ; then # AKKA RUN
335 cd akka/Matrix
336 rm -rf project target # random out of memory errors without this
337 print_header 'Akka'
338 for p in ${bench_cores} ; do
339 set_akka_parallelism ${p}
340 affinity ${p}
341 repeat_command taskset -c ${taskset} sbt ${sbtflags} "run ${pre_args} ${p}" 2>&1 | grep -v "SLF4J:" | grep -v "Slf4jLogger started" | sed -e "s/\x1b\[0J//"
342 sbt clean > /dev/null
343 done
344 # set back parallelism
345 set_akka_parallelism 1
346 cd - > /dev/null
347 fi # done AKKA
348 if [ ${runUCPP} -eq ${true} ] ; then # UCPP RUN
349 cd ucpp
350 print_header 'uC++'
351 ${UCPP} ${UCPPflags} uC++Matrix.cc -o a.${hostname} > /dev/null 2>&1
352 run_bench
353 rm a.${hostname}
354 cd - > /dev/null
355 fi # done UCPP
356 if [ ${runPROTO} -eq ${true} ] ; then # PROTO RUN
357 cd proto/Matrix
358 print_header 'ProtoActor'
359 go build -o a.${hostname} > /dev/null 2>&1
360 run_bench
361 rm a.${hostname}
362 cd - > /dev/null
363 fi # done PROTO
364 echo ""
365fi
366
367if [ ${repeat} -eq ${true} ] ; then
368 echo "repeat"
369 pre_args="${messages}"
370 post_args="${n_repeats}"
371 cd cfa
372 for i in ${!names[@]}; do
373 print_header ${names[$i]}
374 ${cfa} ${cfa_flags} ${var_flags[$i]} repeat.cfa -o a.${hostname} > /dev/null 2>&1
375 run_bench
376 rm a.${hostname}
377 done
378 cd - > /dev/null
379 if [ ${runCAF} -eq ${true} ] ; then # CAF RUN
380 cd caf
381 print_header 'CAF'
382 g++ ${prefixCAF} CAFRepeat.cpp ${suffixCAF} -o a.${hostname} > /dev/null 2>&1
383 for p in ${bench_cores} ; do
384 sed -i "s/max-threads = .*/max-threads = ${p}/g" caf-application.conf # set CAF parallelism
385 single_run ${p}
386 done
387 rm a.${hostname}
388
389 # set back parallelism
390 sed -i "s/max-threads = .*/max-threads = 1/g" caf-application.conf
391 cd - > /dev/null
392 fi # done CAF
393 if [ ${runAKKA} -eq ${true} ] ; then # AKKA RUN
394 cd akka/Repeat
395 rm -rf project target # random out of memory errors without this
396 print_header 'Akka'
397 for p in ${bench_cores} ; do
398 set_akka_parallelism ${p}
399 affinity ${p}
400 repeat_command taskset -c ${taskset} sbt ${sbtflags} "run ${pre_args} ${p} ${post_args}" 2>&1 | grep -v "SLF4J:" | grep -v "Slf4jLogger started" | sed -e "s/\x1b\[0J//"
401 sbt clean > /dev/null
402 done
403 # set back parallelism
404 set_akka_parallelism 1
405 cd - > /dev/null
406 fi # done AKKA
407 if [ ${runUCPP} -eq ${true} ] ; then # UCPP RUN
408 cd ucpp
409 print_header 'uC++'
410 ${UCPP} ${UCPPflags} uC++Repeat.cc -o a.${hostname} > /dev/null 2>&1
411 run_bench
412 rm a.${hostname}
413 cd - > /dev/null
414 fi # done UCPP
415 if [ ${runPROTO} -eq ${true} ] ; then # PROTO RUN
416 print_header 'ProtoActor'
417 cd proto/Repeat
418 go build -o a.${hostname} > /dev/null 2>&1
419 run_bench
420 rm a.${hostname}
421 cd - > /dev/null
422 fi # done PROTO
423 echo ""
424fi
425
426
427if [ ${static} -eq ${true} ] ; then
428 echo "static"
429 preprint=''
430 cd cfa
431 for i in ${!names[@]}; do
432 echo ${names[$i]}
433 ${cfa} ${cfa_flags} ${var_flags[$i]} static.cfa -o a.${hostname} > /dev/null 2>&1
434 repeat_command taskset -c ${startcore} ./a.${hostname} ${n_static_sends}
435 rm a.${hostname}
436 done
437 cd - > /dev/null
438 if [ ${runCAF} -eq ${true} ] ; then # CAF RUN
439 cd caf
440 echo 'CAF:'
441 g++ ${prefixCAF} CAFSendStatic.cpp ${suffixCAF} -o a.${hostname} > /dev/null 2>&1
442 sed -i "s/max-threads = .*/max-threads = 1/g" caf-application.conf # set CAF parallelism
443 repeat_command taskset -c ${startcore} ./a.${hostname} 'd'
444 rm a.${hostname}
445 cd - > /dev/null
446 fi # done CAF
447 if [ ${runAKKA} -eq ${true} ] ; then # AKKA RUN
448 cd akka/SendStatic
449 rm -rf project target # random out of memory errors without this
450 echo 'Akka:'
451 set_akka_parallelism 1
452 taskset -c ${startcore} sbt ${sbtflags} "run ${n_static_sends} ${numtimes}" 2>&1 | grep -v "SLF4J:" | grep -v "Slf4jLogger started" | sed -e "s/\x1b\[0J//"
453 cd - > /dev/null
454 fi # done AKKA
455 if [ ${runUCPP} -eq ${true} ] ; then # UCPP RUN
456 cd ucpp
457 echo 'uC++:'
458 ${UCPP} ${UCPPflags} uC++SendStatic.cc -o a.${hostname} > /dev/null 2>&1
459 repeat_command taskset -c ${startcore} ./a.${hostname} ${n_static_sends}
460 rm a.${hostname}
461 cd - > /dev/null
462 fi # done UCPP
463 if [ ${runPROTO} -eq ${true} ] ; then # PROTO RUN
464 cd proto/SendStatic
465 echo 'ProtoActor:'
466 go build -o a.${hostname} > /dev/null 2>&1
467 repeat_command taskset -c ${startcore} ./a.${hostname} ${n_static_sends}
468 rm a.${hostname}
469 cd - > /dev/null
470 fi # done PROTO
471 echo ""
472fi
473
474if [ ${dynamic} -eq ${true} ] ; then
475 echo "dynamic"
476 cd cfa
477 for i in ${!names[@]}; do
478 echo ${names[$i]}
479 ${cfa} ${cfa_flags} ${var_flags[$i]} dynamic.cfa -o a.${hostname} > /dev/null 2>&1
480 repeat_command taskset -c ${startcore} ./a.${hostname} ${n_dynamic_sends}
481 rm a.${hostname}
482 done
483 cd - > /dev/null
484 if [ ${runCAF} -eq ${true} ] ; then # CAF RUN
485 cd caf
486 echo 'CAF:'
487 g++ ${prefixCAF} CAFSendDynamic.cpp ${suffixCAF} -o a.${hostname} > /dev/null 2>&1
488 sed -i "s/max-threads = .*/max-threads = 1/g" caf-application.conf # set CAF parallelism
489 repeat_command taskset -c ${startcore} ./a.${hostname} 'd'
490 rm a.${hostname}
491 cd - > /dev/null
492 fi # done CAF
493 if [ ${runAKKA} -eq ${true} ] ; then # AKKA RUN
494 cd akka/SendDynamic
495 rm -rf project target # random out of memory errors without this
496 echo 'Akka:'
497 set_akka_parallelism 1
498 taskset -c ${startcore} sbt ${sbtflags} "run d ${numtimes}" 2>&1 | grep -v "SLF4J:" | grep -v "Slf4jLogger started" | sed -e "s/\x1b\[0J//"
499 cd - > /dev/null
500 fi # done AKKA
501 if [ ${runUCPP} -eq ${true} ] ; then # UCPP RUN
502 cd ucpp
503 echo 'uC++:'
504 ${UCPP} ${UCPPflags} uC++SendDynamic.cc -o a.${hostname} > /dev/null 2>&1
505 repeat_command taskset -c ${startcore} ./a.${hostname} ${n_dynamic_sends}
506 rm a.${hostname}
507 cd - > /dev/null
508 fi # done UCPP
509 if [ ${runPROTO} -eq ${true} ] ; then # PROTO RUN
510 cd proto/SendDynamic
511 echo 'ProtoActor:'
512 go build -o a.${hostname} > /dev/null 2>&1
513 repeat_command taskset -c ${startcore} ./a.${hostname} 'd'
514 rm a.${hostname}
515 cd - > /dev/null
516 fi # done PROTO
517 echo ""
518fi
519
520
521if [ ${balance} -eq ${true} ] ; then
522 cd cfa
523 echo "balance_one"
524 for i in ${!names[@]}; do
525 echo ${names[$i]}':'
526 echo -e "proc\ttime (s)"
527 ${cfa} ${cfa_flags} ${var_flags[$i]} balance.cfa -o a.${hostname} > /dev/null 2>&1
528 for p in ${bench_cores} ; do
529 affinity ${p}
530 preprint="${p}\t"
531 repeat_command taskset -c ${taskset} ./a.${hostname} 32 32 ${nOneRounds} ${p}
532 done
533 rm a.${hostname}
534 done
535 echo ""
536 echo "balance_multi"
537 for i in ${!names[@]}; do
538 echo ${names[$i]}':'
539 echo -e "proc\ttime (s)"
540 ${cfa} ${cfa_flags} ${var_flags[$i]} -DMULTI balance.cfa -o a.${hostname} > /dev/null 2>&1
541 for p in ${bench_cores} ; do
542 affinity ${p}
543 preprint="${p}\t"
544 repeat_command taskset -c ${taskset} ./a.${hostname} 32 32 ${nMultiRounds} ${p}
545 done
546 rm a.${hostname}
547 done
548 echo ""
549 cd - > /dev/null
550fi
551
Note: See TracBrowser for help on using the repository browser.