Skip to content

Commit c97dc69

Browse files
ggerganovslaren
authored andcommitted
scripts : add helpers script for bench comparing commits (ggml-org#5521)
* scripts : add helpers script for bench comparing commits * scripts : detect CUDA * set flags after checking the command line * fix make flags --------- Co-authored-by: slaren <[email protected]>
1 parent 5535523 commit c97dc69

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

scripts/compare-commits.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
if [ $# -lt 2 ]; then
4+
echo "usage: ./scripts/compare-commits.sh <commit1> <commit2> [additional llama-bench arguments]"
5+
exit 1
6+
fi
7+
8+
set -e
9+
set -x
10+
11+
bench_args="${@:3}"
12+
13+
rm -f llama-bench.sqlite
14+
15+
backend="cpu"
16+
17+
if [[ "$OSTYPE" == "darwin"* ]]; then
18+
backend="metal"
19+
elif command -v nvcc &> /dev/null; then
20+
backend="cuda"
21+
fi
22+
23+
make_opts=""
24+
25+
if [[ "$backend" == "cuda" ]]; then
26+
make_opts="LLAMA_CUBLAS=1"
27+
fi
28+
29+
git checkout $1
30+
make clean && make -j32 $make_opts llama-bench
31+
./llama-bench -o sql $bench_args | tee /dev/tty | sqlite3 llama-bench.sqlite
32+
33+
git checkout $2
34+
make clean && make -j32 $make_opts llama-bench
35+
./llama-bench -o sql $bench_args | tee /dev/tty | sqlite3 llama-bench.sqlite
36+
37+
./scripts/compare-llama-bench.py -b $1 -c $2

0 commit comments

Comments
 (0)