parallel/doc/boxplot-overhead
2020-11-22 16:22:54 +01:00

65 lines
2.1 KiB
Bash

#!/bin/bash
# Create a boxplot of running 1000 jobs 10 times on all released
# versions of GNU Parallel
# test
# --cpus-as-cores (virker ikke)
# hvor stor forskel mlm 2 run
# hvor stor forskel mlm 1000/3000/10000
# hvor stor forskel mlm 10/30/100
# Non-fixed cpu-speed: 50% spread=1-2 ms
# Fixed cpu-speed: 50% spread=0.7-1.5 ms
# 4-cpu: 30% faster: 9 ms -> 6 ms
if ! /tmp/bin/parallel-20140722 --version; then
wget -c ftp://ftp.gnu.org/old-gnu/parallel/p*
wget -c ftp://ftp.uni-kl.de/pub/gnu/parallel/p*
parallel 'gpg --auto-key-locate keyserver --keyserver-options auto-key-retrieve {}' ::: *.sig
parallel --plus 'tar xvf {.} && cd {...} && ./configure --prefix /tmp/{.}-bin && make && make install' ::: *sig
perl -i -pe 's/qw\(keys/(keys/' parallel*/src/parallel
mkdir /tmp/bin
parallel cp {} /tmp/bin/'{=s:/.*::=}' ::: parallel*/src/parallel
fi
measure() {
# 100: Much jumping
# 300: Same sort order every time
# 1000: Same sort order every time
OUTER=$1
INNER=$2
CORES=$3
VERSION=$4
MHZ=1700
# Force cpuspeed at 1.7GHz - seems to give tighter results
forever 'parallel sudo cpufreq-set -g performance -u '$MHZ'MHz -d '$MHZ'MHz -c{} ::: {0..3};sleep 10' &
PATH=/tmp/bin:$PATH
cd /tmp/bin
ls parallel-* |
parallel --shuf -j$CORES --joblog ~/tmp/joblog$CORES-$INNER-$OUTER.csv 'seq '$INNER' | {2} true' :::: <(seq $OUTER) -
killall forever
Rscript - <<_
jl<-read.csv("$HOME/tmp/joblog$CORES-$INNER-$OUTER.csv",sep="\t");
jl\$Command <- as.factor(substr(jl\$Command,
nchar(as.character(jl\$Command))-23,
nchar(as.character(jl\$Command))-5))
pdf("/tmp/boxplot.pdf");
par(cex.axis=0.5);
boxplot(JobRuntime/$INNER*1000~Command,data=jl,las=2,outline=F,
ylab="milliseconds/job",main="GNU Parallel overhead for different versions\n$OUTER trials each running $INNER jobs");
_
cp /tmp/boxplot.pdf $HOME/tmp/boxplot-j$CORES-${MHZ}MHz-$OUTER-${INNER}v$VERSION.pdf
evince /tmp/boxplot.pdf
}
#measure 3000 1000 2 1
measure 30 10 2 1
measure 300 100 2 1
measure 3000 1000 2 1