-
Notifications
You must be signed in to change notification settings - Fork 5
/
ann_benchmark.sh
executable file
·64 lines (48 loc) · 2.03 KB
/
ann_benchmark.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
#!/bin/bash
set -e
dataset=${DATASET:-"sift-128-euclidean"}
distance=${DISTANCE:-"l2-squared"}
function wait_weaviate() {
echo "Wait for Weaviate to be ready"
for _ in {1..120}; do
if curl -sf -o /dev/null localhost:8080/v1/.well-known/ready; then
echo "Weaviate is ready"
return 0
fi
echo "Weaviate is not ready, trying again in 1s"
sleep 1
done
echo "ERROR: Weaviate is not ready after 120s"
exit 1
}
echo "Building all required containers"
( cd apps/ann-benchmarks/ && docker build -t ann_benchmarks . )
echo "Starting Weaviate..."
docker compose -f apps/weaviate-no-restart-on-crash/docker-compose.yml up -d
wait_weaviate
echo "Run benchmark script"
mkdir -p datasets
(
cd datasets;
if [ -f ${dataset}.hdf5 ]
then
echo "Datasets exists locally"
else
echo "Downloading dataset"
curl -LO http://ann-benchmarks.com/${dataset}.hdf5
fi
)
docker run --network host -t -v "$PWD/results:/workdir/results" -v "$PWD/datasets:/datasets" ann_benchmarks python3 run.py -v /datasets/${dataset}.hdf5 -d $distance -m 32 --labels "pq=false,after_restart=false,weaviate_version=$WEAVIATE_VERSION,cloud_provider=$CLOUD_PROVIDER,machine_type=$MACHINE_TYPE,os=$OS"
echo "Initial run complete, now restart Weaviate"
docker compose -f apps/weaviate-no-restart-on-crash/docker-compose.yml stop weaviate
docker compose -f apps/weaviate-no-restart-on-crash/docker-compose.yml start weaviate
wait_weaviate
echo "Weaviate ready, wait 30s for caches to be hot"
sleep 30
echo "Second run (query only)"
docker run --network host -t -v "$PWD/results:/workdir/results" -v "$PWD/datasets:/datasets" ann_benchmarks python3 run.py -v /datasets/${dataset}.hdf5 -d $distance -m 32 --query-only --labels "pq=false,after_restart=true,weaviate_version=$WEAVIATE_VERSION,cloud_provider=$CLOUD_PROVIDER,machine_type=$MACHINE_TYPE,os=$OS"
docker run --network host -t -v "$PWD/datasets:/datasets" \
-v "$PWD/results:/workdir/results" \
-e "REQUIRED_RECALL=$REQUIRED_RECALL" \
ann_benchmarks python3 analyze.py
echo "Passed!"