-
Notifications
You must be signed in to change notification settings - Fork 44
/
run_all.sh
executable file
·67 lines (51 loc) · 1.79 KB
/
run_all.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
#!/bin/bash
set -e
BASE=${0%/*}
PROGRAM_NAME=$0
display_usage() {
echo -e "Build all benchmarks, create search indexes using the supplied document set, and run the supplied queries to benchmark."
echo -e "Output goes into the outputs/ directory."
echo -e ""
echo -e "Usage: ${PROGRAM_NAME} document_file query_directory"
echo -e ""
echo -e "Parameters:"
echo -e " document_file A JSON file containing one document per line, with \"url\", \"title\", and \"body\" fields"
echo -e " query_directory A .txt file or directory containing .txt files. Should have one query per line. Will be recursively searched."
echo -e " -h --help Display this usage guide"
}
if [ $# -le 1 ]
then
display_usage
exit 1
fi
if [[ ( $# == "--help") || $# == "-h" ]]
then
display_usage
exit 0
fi
echo Building base benchmark code
${BASE}/benchmark/build.sh
echo Building individual benchmark projects
${BASE}/preprocess_all.sh
TOP_LEVEL_OUTPUTS=${BASE}/outputs
mkdir ${TOP_LEVEL_OUTPUTS}
PIPE_FILE=${TOP_LEVEL_OUTPUTS}/.pipe
mkfifo ${PIPE_FILE}
INDEX_TYPES=`cat ${BASE}/INDEX_TYPES.txt`
for INDEX_TYPE in ${INDEX_TYPES} ; do
echo Processing ${INDEX_TYPE}
OUTPUT=${TOP_LEVEL_OUTPUTS}/${INDEX_TYPE}
mkdir ${OUTPUT}
INDEX_OUTPUT=${OUTPUT}/index
mkdir ${INDEX_OUTPUT}
echo Building index for ${INDEX_TYPE} into ${INDEX_OUTPUT}
start=`date +%s`
${BASE}/${INDEX_TYPE}/build_index.sh ${INDEX_OUTPUT} < $1
end=`date +%s`
runtime=$((end-start))
echo Building index for ${INDEX_TYPE} took ${runtime} seconds
echo ${runtime} > ${OUTPUT}/build_time.txt
echo Querying against ${INDEX_TYPE}
${BASE}/benchmark/drive.sh --queries $2 <${PIPE_FILE} 2>${OUTPUT}/query_output.txt | ${INDEX_TYPE}/query.sh ${INDEX_OUTPUT} >${PIPE_FILE}
done
rm ${PIPE_FILE}