eigen/run.sh

35 lines
778 B
Bash
Raw Normal View History

2021-05-13 01:09:33 +08:00
#!/bin/bash
2021-05-13 22:42:22 +08:00
function run() {
OLD=0
NEW=0
2021-05-13 22:48:40 +08:00
NEWP=0
2021-05-13 22:42:22 +08:00
EXECS=$1
SIZE=$2
RUNS=$3
for ((i = 0; i < $EXECS; i++)) do
SEL=$(A=$(shuf -i 0-10 -n 1); echo $(($A % 2)))
if [ $SEL -eq 0 ]; then
T_OLD=$(./gto $SIZE $RUNS)
T_NEW=$(./gt $SIZE $RUNS)
2021-05-13 22:48:40 +08:00
T_NEWP=$(./gtp $SIZE $RUNS)
2021-05-13 22:42:22 +08:00
else
T_NEW=$(./gt $SIZE $RUNS)
2021-05-13 22:48:40 +08:00
T_NEWP=$(./gtp $SIZE $RUNS)
2021-05-13 22:42:22 +08:00
T_OLD=$(./gto $SIZE $RUNS)
fi
NEW=$NEW+$T_NEW
2021-05-13 22:48:40 +08:00
OLD=$OLD+$T_OLD
NEWP=$NEWP+$T_NEWP
2021-05-13 22:42:22 +08:00
done
SPEED=$(echo "($OLD) / ($NEW)" | bc -l)
2021-05-13 22:48:40 +08:00
SPEEDP=$(echo "($OLD) / ($NEWP)" | bc -l)
echo "$SIZE -> $SPEED $SPEEDP"
2021-05-13 22:42:22 +08:00
}
run $1 16 500
run $1 32 500
2021-05-13 23:30:08 +08:00
run $1 64 100
run $1 128 50
run $1 256 10
run $1 1024 10