2024-02-16 13:14:40 +00:00
|
|
|
#!/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
|
|
|
|
|
2024-09-18 15:34:32 +00:00
|
|
|
# verify at the start that the compare script has all the necessary dependencies installed
|
|
|
|
./scripts/compare-llama-bench.py --check
|
|
|
|
|
2024-02-16 13:14:40 +00:00
|
|
|
bench_args="${@:3}"
|
|
|
|
|
2024-06-04 12:32:42 +00:00
|
|
|
rm -f llama-bench.sqlite > /dev/null
|
2024-02-16 13:14:40 +00:00
|
|
|
|
2024-06-26 15:33:02 +00:00
|
|
|
# to test a backend, call the script with the corresponding environment variable (e.g. GGML_CUDA=1 ./scripts/compare-commits.sh ...)
|
2024-12-02 19:22:53 +00:00
|
|
|
if [ -n "$GGML_CUDA" ]; then
|
|
|
|
cmake_opts="-DGGML_CUDA=ON"
|
|
|
|
fi
|
|
|
|
|
|
|
|
function run {
|
|
|
|
rm -fr build > /dev/null
|
|
|
|
cmake -B build -S . $cmake_opts > /dev/null
|
|
|
|
cmake --build build -t llama-bench > /dev/null
|
|
|
|
build/bin/llama-bench -o sql -oe md $bench_args | sqlite3 llama-bench.sqlite
|
|
|
|
}
|
2024-02-16 13:14:40 +00:00
|
|
|
|
2024-06-04 12:32:42 +00:00
|
|
|
git checkout $1 > /dev/null
|
2024-12-02 19:22:53 +00:00
|
|
|
run
|
2024-02-16 13:14:40 +00:00
|
|
|
|
2024-06-04 12:32:42 +00:00
|
|
|
git checkout $2 > /dev/null
|
2024-12-02 19:22:53 +00:00
|
|
|
run
|
2024-02-16 13:14:40 +00:00
|
|
|
|
|
|
|
./scripts/compare-llama-bench.py -b $1 -c $2
|