Delete run_diskann.sh
Browse files- run_diskann.sh +0 -132
run_diskann.sh
DELETED
|
@@ -1,132 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
# zhujiadong
|
| 3 |
-
|
| 4 |
-
# sift-10k / sift-100k / sift-1m / sift-100m / sift-1b / gist-1m
|
| 5 |
-
dataset=$1
|
| 6 |
-
|
| 7 |
-
# trans / gt / build / search /clean
|
| 8 |
-
cmd=$2
|
| 9 |
-
|
| 10 |
-
# disk / memory
|
| 11 |
-
isdisk=$3
|
| 12 |
-
|
| 13 |
-
#--max_degree
|
| 14 |
-
R="64"
|
| 15 |
-
#--Lbuild
|
| 16 |
-
L="100"
|
| 17 |
-
#--build_DRAM_budget
|
| 18 |
-
M="512"
|
| 19 |
-
#--num_threads(default is to get_omp_num_procs())
|
| 20 |
-
T="48"
|
| 21 |
-
#--beamwidth
|
| 22 |
-
W="1"
|
| 23 |
-
|
| 24 |
-
test_name="${dataset}_${isdisk}_${(date "+%Y%m%d%H%M%S")}"
|
| 25 |
-
diskann_dir="../../"
|
| 26 |
-
datasets_dir="${diskann_dir}data/"
|
| 27 |
-
|
| 28 |
-
case ${dataset} in
|
| 29 |
-
sift-10k)
|
| 30 |
-
data_dir="${datasets_dir}siftsmall/"
|
| 31 |
-
data_name="siftsmall_base"
|
| 32 |
-
query_name="siftsmall_query"
|
| 33 |
-
B="0.0003"
|
| 34 |
-
;;
|
| 35 |
-
sift-100k)
|
| 36 |
-
data_dir="${datasets_dir}sift/"
|
| 37 |
-
data_name="sift_learn"
|
| 38 |
-
query_name="sift_query"
|
| 39 |
-
B="0.003"
|
| 40 |
-
;;
|
| 41 |
-
sift-1m)
|
| 42 |
-
data_dir="${datasets_dir}sift/"
|
| 43 |
-
data_name="sift_base"
|
| 44 |
-
query_name="sift_query"
|
| 45 |
-
B="0.03"
|
| 46 |
-
;;
|
| 47 |
-
sift-100m)
|
| 48 |
-
data_dir="${datasets_dir}bigann/"
|
| 49 |
-
data_name="bigann_learn"
|
| 50 |
-
query_name="bigann_query"
|
| 51 |
-
B="3"
|
| 52 |
-
;;
|
| 53 |
-
sift-1b)
|
| 54 |
-
data_dir="${datasets_dir}bigann/"
|
| 55 |
-
data_name="bigann_base"
|
| 56 |
-
query_name="bigann_query"
|
| 57 |
-
B="30"
|
| 58 |
-
;;
|
| 59 |
-
gist-1m)
|
| 60 |
-
data_dir="${datasets_dir}gist/"
|
| 61 |
-
data_name="gist_base"
|
| 62 |
-
query_name="gist_query"
|
| 63 |
-
;;
|
| 64 |
-
*)
|
| 65 |
-
echo "No such dataset"
|
| 66 |
-
exit 1
|
| 67 |
-
;;
|
| 68 |
-
esac
|
| 69 |
-
|
| 70 |
-
gt_name=$dataset
|
| 71 |
-
data_type="float"
|
| 72 |
-
data_fn="l2"
|
| 73 |
-
origin_format=".fvecs"
|
| 74 |
-
format=".fbin"
|
| 75 |
-
res_dir="${diskann_dir}res/$test_name/"
|
| 76 |
-
data_file="${data_dir}${data_name}${format}"
|
| 77 |
-
query_file="${data_dir}${query_name}${format}"
|
| 78 |
-
gt_file="${res_dir}${gt_name}_gt"
|
| 79 |
-
index_path_prefex="${res_dir}index_${data_name}_R${R}_L${L}_M${M}_B${B}_T${T}"
|
| 80 |
-
|
| 81 |
-
if [ -d "${res_dir}" ]; then
|
| 82 |
-
echo "dir ${res_dir} exists."
|
| 83 |
-
else
|
| 84 |
-
mkdir -p ${res_dir}
|
| 85 |
-
fi
|
| 86 |
-
|
| 87 |
-
case ${cmd} in
|
| 88 |
-
trans)
|
| 89 |
-
${diskann_dir}/build/apps/utils/fvecs_to_bin $data_type ${data_dir}${data_name}${origin_format} $data_file
|
| 90 |
-
${diskann_dir}/build/apps/utils/fvecs_to_bin $data_type ${data_dir}${query_name}${origin_format} $query_file
|
| 91 |
-
;;
|
| 92 |
-
gt)
|
| 93 |
-
echo "Compute groundtruth --K 100"
|
| 94 |
-
${diskann_dir}/build/apps/utils/compute_groundtruth \
|
| 95 |
-
--data_type $data_type --dist_fn $data_fn --data_file $data_file --query_file $query_file --gt_file $gt_file --K 100
|
| 96 |
-
;;
|
| 97 |
-
build)
|
| 98 |
-
echo "Building -R $R -L $L -B $B -M $M"
|
| 99 |
-
${diskann_dir}/build/apps/build_memory_index \
|
| 100 |
-
--data_type $data_type --dist_fn $data_fn --data_path $data_file --index_path_prefix $index_path_prefex \
|
| 101 |
-
-R $R -L $L -B $B -M $M
|
| 102 |
-
;;
|
| 103 |
-
search)
|
| 104 |
-
search_K="10"
|
| 105 |
-
search_L="10 20 30 40 50 100"
|
| 106 |
-
echo "Searching -K $search_K -L $search_L -T $T"
|
| 107 |
-
${diskann_dir}/build/apps/search_memory_index \
|
| 108 |
-
--data_type $data_type --dist_fn $data_fn --index_path_prefix $index_path_prefex --query_file $query_file --gt_file $gt_file \
|
| 109 |
-
-K ${search_K} -L ${search_L} -T $T \
|
| 110 |
-
--result_path ${res_dir}res
|
| 111 |
-
;;
|
| 112 |
-
clean)
|
| 113 |
-
read -r -p "Clean All Results? [Y/n]" input
|
| 114 |
-
case $input in
|
| 115 |
-
[yY][eE][sS]|[yY])
|
| 116 |
-
echo "rm -rf $res_dir"
|
| 117 |
-
rm -rf $res_dir
|
| 118 |
-
;;
|
| 119 |
-
[nN][oO]|[nN])
|
| 120 |
-
echo "No"
|
| 121 |
-
exit 1
|
| 122 |
-
;;
|
| 123 |
-
*)
|
| 124 |
-
echo "Invalid input"
|
| 125 |
-
exit 1
|
| 126 |
-
;;
|
| 127 |
-
esac
|
| 128 |
-
;;
|
| 129 |
-
*)
|
| 130 |
-
echo "Invalid input. Usage: trans / gt / build / search / clean"
|
| 131 |
-
;;
|
| 132 |
-
esac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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