Skip to content

Commit

Permalink
scripts : add helpers script for bench comparing commits (ggerganov#5521
Browse files Browse the repository at this point in the history
)

* 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]>
  • Loading branch information
ggerganov and slaren authored Feb 16, 2024
1 parent 4cb0727 commit d2819d5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions scripts/compare-commits.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

if [ $# -lt 2 ]; then
echo "usage: ./scripts/compare-commits.sh <commit1> <commit2> [additional llama-bench arguments]"
exit 1
fi

set -e
set -x

bench_args="${@:3}"

rm -f llama-bench.sqlite

backend="cpu"

if [[ "$OSTYPE" == "darwin"* ]]; then
backend="metal"
elif command -v nvcc &> /dev/null; then
backend="cuda"
fi

make_opts=""

if [[ "$backend" == "cuda" ]]; then
make_opts="LLAMA_CUBLAS=1"
fi

git checkout $1
make clean && make -j32 $make_opts llama-bench
./llama-bench -o sql $bench_args | tee /dev/tty | sqlite3 llama-bench.sqlite

git checkout $2
make clean && make -j32 $make_opts llama-bench
./llama-bench -o sql $bench_args | tee /dev/tty | sqlite3 llama-bench.sqlite

./scripts/compare-llama-bench.py -b $1 -c $2

0 comments on commit d2819d5

Please sign in to comment.