@@ -18,8 +18,8 @@ ARGS=$*
1818# scripts, and that this script resides in the repo dir!
1919REPODIR=$( cd $( dirname $0 ) ; pwd)
2020
21- VALIDARGS=" clean libcuvs python rust docs tests examples --uninstall -v -g -n --compile-static-lib --allgpuarch --no-nvtx --show_depr_warn --incl-cache-stats --time -h"
22- HELP=" $0 [<target> ...] [<flag> ...] [--cmake-args=\" <args>\" ] [--cache-tool=<tool>] [--limit-tests=<targets>] [--build-metrics=<filename>]
21+ VALIDARGS=" clean libcuvs python rust docs tests bench-ann examples --uninstall -v -g -n --compile-static-lib --allgpuarch --no-nvtx --show_depr_warn --incl-cache-stats --time -h"
22+ HELP=" $0 [<target> ...] [<flag> ...] [--cmake-args=\" <args>\" ] [--cache-tool=<tool>] [--limit-tests=<targets>] [--limit-bench-ann=<targets>] [-- build-metrics=<filename>]
2323 where <target> is:
2424 clean - remove all existing build artifacts and configuration (start over)
2525 libcuvs - build the cuvs C++ code only. Also builds the C-wrapper library
@@ -28,6 +28,7 @@ HELP="$0 [<target> ...] [<flag> ...] [--cmake-args=\"<args>\"] [--cache-tool=<to
2828 rust - build the cuvs Rust bindings
2929 docs - build the documentation
3030 tests - build the tests
31+ bench-ann - build end-to-end ann benchmarks
3132 examples - build the examples
3233
3334 and <flag> is:
@@ -37,6 +38,7 @@ HELP="$0 [<target> ...] [<flag> ...] [--cmake-args=\"<args>\"] [--cache-tool=<to
3738 --uninstall - uninstall files for specified targets which were built and installed prior
3839 --compile-static-lib - compile static library for all components
3940 --limit-tests - semicolon-separated list of test executables to compile (e.g. NEIGHBORS_TEST;CLUSTER_TEST)
41+ --limit-bench-ann - semicolon-separated list of ann benchmark executables to compute (e.g. HNSWLIB_ANN_BENCH;RAFT_IVF_PQ_ANN_BENCH)
4042 --allgpuarch - build for all supported GPU architectures
4143 --no-nvtx - disable nvtx (profiling markers), but allow enabling it in downstream projects
4244 --show_depr_warn - show cmake deprecation warnings
@@ -70,6 +72,7 @@ BUILD_REPORT_METRICS=""
7072BUILD_REPORT_INCL_CACHE_STATS=OFF
7173
7274TEST_TARGETS=" NEIGHBORS_ANN_CAGRA_TEST"
75+ ANN_BENCH_TARGETS=" CUVS_ANN_BENCH_ALL"
7376
7477CACHE_ARGS=" "
7578NVTX=ON
@@ -150,6 +153,21 @@ function limitTests {
150153 fi
151154}
152155
156+ function limitAnnBench {
157+ # Check for option to limit the set of test binaries to build
158+ if [[ -n $( echo $ARGS | { grep -E " \-\-limit\-bench-ann" || true ; } ) ]]; then
159+ # There are possible weird edge cases that may cause this regex filter to output nothing and fail silently
160+ # the true pipe will catch any weird edge cases that may happen and will cause the program to fall back
161+ # on the invalid option error
162+ LIMIT_ANN_BENCH_TARGETS=$( echo $ARGS | sed -e ' s/.*--limit-bench-ann=//' -e ' s/ .*//' )
163+ if [[ -n ${LIMIT_ANN_BENCH_TARGETS} ]]; then
164+ # Remove the full LIMIT_TEST_TARGETS argument from list of args so that it passes validArgs function
165+ ARGS=${ARGS// --limit-bench-ann=$LIMIT_ANN_BENCH_TARGETS / }
166+ ANN_BENCH_TARGETS=${LIMIT_ANN_BENCH_TARGETS}
167+ fi
168+ fi
169+ }
170+
153171function buildMetrics {
154172 # Check for multiple build-metrics options
155173 if [[ $( echo $ARGS | { grep -Eo " \-\-build\-metrics" || true ; } | wc -l ) -gt 1 ]]; then
@@ -179,6 +197,7 @@ if (( ${NUMARGS} != 0 )); then
179197 cmakeArgs
180198 cacheTool
181199 limitTests
200+ limitAnnBench
182201 buildMetrics
183202 for a in ${ARGS} ; do
184203 if ! (echo " ${VALIDARGS} " | grep -q " ${a} " ); then
@@ -255,6 +274,11 @@ if hasArg tests || (( ${NUMARGS} == 0 )); then
255274 fi
256275fi
257276
277+ if hasArg bench-ann || (( ${NUMARGS} == 0 )) ; then
278+ BUILD_ANN_BENCH=ON
279+ CMAKE_TARGET=" ${CMAKE_TARGET} ;${ANN_BENCH_TARGETS} "
280+ fi
281+
258282if hasArg --no-nvtx; then
259283 NVTX=OFF
260284fi
@@ -327,6 +351,7 @@ if (( ${NUMARGS} == 0 )) || hasArg libcuvs || hasArg docs || hasArg tests || has
327351 -DDISABLE_DEPRECATION_WARNINGS=${DISABLE_DEPRECATION_WARNINGS} \
328352 -DBUILD_TESTS=${BUILD_TESTS} \
329353 -DBUILD_C_TESTS=${BUILD_TESTS} \
354+ -DBUILD_ANN_BENCH=${BUILD_ANN_BENCH} \
330355 -DBUILD_CPU_ONLY=${BUILD_CPU_ONLY} \
331356 -DCMAKE_MESSAGE_LOG_LEVEL=${CMAKE_LOG_LEVEL} \
332357 ${CACHE_ARGS} \
0 commit comments