aboutsummaryrefslogtreecommitdiff
path: root/deeptagger/bench.sh
blob: 6b6279195e5f4bd83c9a8d7543abbbd50aaa350c (plain)
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
#!/bin/sh -e
if [ $# -lt 2 ] || ! [ -x "$1" ]
then
	echo "Usage: $0 DEEPTAGGER FILE..."
	echo "Run this after using download.sh, from the same directory."
	exit 1
fi

runner=$1
shift
log=bench.out
: >$log

run() {
	opts=$1 batch=$2 model=$3
	shift 3

	for i in $(seq 1 3)
	do
		start=$(date +%s)
		"$runner" $opts -b "$batch" -t 0.75 "$model" "$@" >/dev/null || :
		end=$(date +%s)
		printf '%s\t%s\t%s\t%s\t%s\n' \
			"$name" "$model" "$opts" "$batch" "$((end - start))" | tee -a $log
	done
}

for model in models/*.model
do
	name=$(sed -n 's/^name=//p' "$model")
	run ""     1 "$model" "$@"
	run ""     4 "$model" "$@"
	run ""    16 "$model" "$@"

	run --cpu  1 "$model" "$@"
	run --cpu  4 "$model" "$@"
	run --cpu 16 "$model" "$@"
done