-
Notifications
You must be signed in to change notification settings - Fork 40
/
configure
executable file
·190 lines (175 loc) · 5.92 KB
/
configure
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/bash
# Copyright (c) 2020-present, UMD Database Group.
#
# This program is free software: you can use, redistribute, and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# or later ("AGPL"), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
source scripts/rainbow.sh
############################################################
# Help #
############################################################
Help() {
# Display Help
echo $(echogreen "A Benchmark Script for Flock")
echo
echo "Syntax: flock_bench [-g|-h|-c|-r|-a]"
echo "options:"
echo "g Print the GPL license notification."
echo "h Print this Help."
echo "c Compile and deploy the benchmark."
echo "r Run the benchmark."
echo "a Build the benchmark with specific architechture. x86_64 or arm64. Default is x86_64."
echo "n Disable handwritten arrow kernels that explicitly use SIMD intrinsics."
echo
}
############################################################
# License #
############################################################
AGPLV3() {
# Display GPL license
echo "A Benchmark Script for Flock"
echo
echo "Copyright (c) 2020-present, UMD Database Group."
echo
echo "This program is free software: you can redistribute it and/or modify"
echo "it under the terms of the GNU Affero General Public License, version 3"
echo "or later, as published by the Free Software Foundation."
echo
echo "This program is distributed in the hope that it will be useful, but"
echo "WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY"
echo "or FITNESS FOR A PARTICULAR PURPOSE."
echo
echo "You should have received a copy of the GNU Affero General Public License"
echo "along with this program. If not, see <https://www.gnu.org/licenses/>."
echo
}
############################################################
# Compile and Deploy Benchmarks #
############################################################
Build_and_Deploy() {
# Compile and Deploy
echo $(echogreen "============================================================")
echo $(echogreen " Compiling and Deploying Benchmarks ")
echo $(echogreen "============================================================")
echo
echo $(echogreen "Building $target_arch")
echo
echo $(echogreen "[1/3]") $(echoblue "Compiling Flock Lambda Function...")
echo
cd flock-function
echo "Building with features: $features"
cargo build --target $target_arch --release --features "$features"
cd ..
echo
echo $(echogreen "[2/3]") $(echoblue "Compiling Flock CLI...")
echo
cd flock-cli
cargo build --target $host_arch --release
cd ..
echo
echo $(echogreen "[3/3]") $(echoblue "Deploying Flock Lambda Function...")
echo
./target/$host_arch/release/flock-cli s3 put -p ./target/$target_arch/release/flock -k flock_$target
echo
echo $(echogreen "============================================================")
echo
}
############################################################
# Run Benchmarks #
############################################################
Run() {
echo $(echogreen "============================================================")
echo $(echogreen " Running the benchmarks ")
echo $(echogreen "============================================================")
echo
echo $(echored "[Error] If you want to run the benchmark, please use \"flock-cli [nexmark|ysb] run\".")
echo
echo $(echoblue "$ ./target/$arch/release/flock-cli nexmark run -h")
echo
./target/$arch/release/flock-cli nexmark run -h
echo
}
############################################################
# Process the input options. Add options as needed. #
############################################################
target="unknown"
compile=false
run=false
handwritten_arrow_kernels=true
rustup install nightly-2022-01-20
rustup default nightly-2022-01-20
# Get the options
while getopts "hgcra:n" option; do
case $option in
h) # display Help
Help
exit
;;
g) # display GPL license
AGPLV3
exit
;;
c) # compile and deploy the benchmark
compile=true
;;
r) # run the benchmark
run=true
;;
a) # build the benchmark with specific architechture.
target=$OPTARG
;;
n) # disable handwritten arrow kernels that explicitly use SIMD intrinsics.
handwritten_arrow_kernels=false
;;
\?) # Invalid option
echo $(echored "Error: Invalid option")
echo
Help
exit
;;
esac
done
host=$(uname -m)
if [ "$host" = "x86_64" ]; then
host_arch="x86_64-unknown-linux-gnu"
elif [ "$host" = "aarch64" ]; then
host_arch="aarch64-unknown-linux-gnu"
fi
if [ "$target" != "x86_64" ] && [ "$target" != "arm64" ]; then
target_arch="$host_arch"
if [ "$host" = "x86_64" ]; then
target="x86_64"
elif [ "$host" = "aarch64" ]; then
target="arm64"
fi
elif [ "$target" == "x86_64" ]; then
target_arch="x86_64-unknown-linux-gnu"
elif [ "$target" == "arm64" ]; then
target_arch="aarch64-unknown-linux-gnu"
fi
if [ "$target_arch" != "$host_arch" ]; then
export PKG_CONFIG_ALLOW_CROSS=1
fi
if [ "$handwritten_arrow_kernels" = true ]; then
features="simd mimalloc"
else
features="mimalloc"
fi
if [ "$compile" = true ]; then
Build_and_Deploy
fi
if [ "$run" = true ]; then
Run
fi
if [ "$compile" = false ] && [ "$run" = false ]; then
echo
echo $(echored "Error: incomplete command line arguments, please use '-h' for help.")
echo
fi