-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_and_run_benchmarks.sh
107 lines (90 loc) · 3.14 KB
/
setup_and_run_benchmarks.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
version=v1.1.1
runs=5
################### SETUP ###################
sudo apt install -y zip
if [ ! -d undreamai ];then
curl -o undreamai-$version-llamacpp.zip -L "https://github.com/undreamai/LlamaLib/releases/download/$version/undreamai-$version-llamacpp.zip"
curl -o undreamai-$version-server.zip -L "https://github.com/undreamai/LlamaLib/releases/download/$version/undreamai-$version-server.zip"
unzip undreamai-$version-llamacpp.zip -d undreamai.tmp
unzip undreamai-$version-server.zip -d undreamai.tmp
mv undreamai.tmp undreamai
fi
if [ ! -f model.gguf ];then
curl -o model.gguf -L "https://huggingface.co/TheBloke/phi-2-GGUF/resolve/main/phi-2.Q4_K_M.gguf?download=true"
fi
for lfv in 0.6.2 0.8.6;do
if [ -f llamafile-$lfv ];then continue; fi
curl -o llamafile-$lfv -L "https://github.com/Mozilla-Ocho/llamafile/releases/download/$lfv/llamafile-$lfv"
done
ape=ape-`uname -m`.elf
if [ ! -f $ape ];then
curl -o $ape https://cosmo.zip/pub/cosmos/bin/$ape
fi
mkdir -p undreamai/cuda/lib64
for cuda in 11.7.1 12.2.0;do
if [ -d cuda-$cuda-linux ];then continue; fi
curl -o cuda-$cuda-linux.zip -L "https://github.com/undreamai/LlamaLib/releases/download/$version/cuda-$cuda-linux.zip"
unzip cuda-$cuda-linux.zip -d cuda-$cuda-linux
for f in `pwd`/cuda-$cuda-linux/cuda/lib64/*;do ln -s $f undreamai/cuda/lib64;done
done
curl -o benchmark.sh -L "https://raw.githubusercontent.com/undreamai/LlamaLib/main/benchmark.sh"
chmod +x -R .
################### EXPERIMENTS ###################
lscpu > system_info.txt
nvidia-smi >> system_info.txt
rm -f benchmark.csv
archs="
noavx
avx
avx2
avx512
"
for arch in ${archs};do
if [ ! -f $arch.txt ];then
./benchmark.sh "./undreamai/linux-$arch/undreamai_server -ngl 0" $arch.txt.tmp $runs >/dev/null 2>/dev/null
mv $arch.txt.tmp $arch.txt
fi
results=`cat $arch.txt`
echo "$arch "`echo $results` >> benchmark.csv
done >> experiments.txt
archs="
clblast
cuda-cu11.7.1
cuda-cu12.2.0
"
for arch in ${archs};do
if [ ! -f $arch.txt ];then
./benchmark.sh "./undreamai/linux-$arch/undreamai_server -ngl 9999" $arch.txt.tmp $runs >/dev/null 2>/dev/null
mv $arch.txt.tmp $arch.txt
fi
results=`cat $arch.txt`
echo "$arch "`echo $results` >> benchmark.csv
done
for lfv in 0.6.2 0.8.6;do
arch=llamafile-$lfv-cpu
if [ ! -f $arch.txt ];then
./benchmark.sh "./$ape ./llamafile-$lfv --nobrowser --nocompile -ngl 0" $arch.txt.tmp $runs >/dev/null 2>/dev/null
mv $arch.txt.tmp $arch.txt
fi
results=`cat $arch.txt`
echo "$arch "`echo $results` >> benchmark.csv
done
for lfv in 0.6.2 0.8.6;do
arch=llamafile-$lfv-tinyblas
if [ ! -f $arch.txt ];then
./benchmark.sh "./$ape ./llamafile-$lfv --nobrowser --nocompile -ngl 9999" $arch.txt.tmp $runs >/dev/null 2>/dev/null
mv $arch.txt.tmp $arch.txt
fi
results=`cat $arch.txt`
echo "$arch "`echo $results` >> benchmark.csv
done
for lfv in 0.6.2 0.8.6;do
arch=llamafile-$lfv-cuda
if [ ! -f $arch.txt ];then
./benchmark.sh "./$ape ./llamafile-$lfv --nobrowser -ngl 9999" $arch.txt.tmp $runs >/dev/null 2>/dev/null
mv $arch.txt.tmp $arch.txt
fi
results=`cat $arch.txt`
echo "$arch "`echo $results` >> benchmark.csv
done