From 00a4ab627ddca1ccd4680798c77a5831a5745dee Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Fri, 16 Feb 2024 10:48:25 +0200 Subject: [PATCH] scripts : detect CUDA --- scripts/compare-commits.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/compare-commits.sh b/scripts/compare-commits.sh index 6f61ac422..763d5ef56 100755 --- a/scripts/compare-commits.sh +++ b/scripts/compare-commits.sh @@ -12,12 +12,26 @@ 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 + +opts="" + +if [[ "$backend" == "cuda" ]]; then + opts="LLAMA_CUBLAS=1" +fi + git checkout $1 -make clean && LLAMA_CUBLAS=1 make -j32 llama-bench +make clean && $opts make -j32 llama-bench ./llama-bench -o sql $bench_args | tee /dev/tty | sqlite3 llama-bench.sqlite git checkout $2 -make clean && LLAMA_CUBLAS=1 make -j32 llama-bench +make clean && $opts make -j32 llama-bench ./llama-bench -o sql $bench_args | tee /dev/tty | sqlite3 llama-bench.sqlite ./scripts/compare-llama-bench.py -b $1 -c $2