Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing ann bench cmake (and docs) #1630

Merged
merged 1 commit into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 36 additions & 15 deletions cpp/bench/ann/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
option(RAFT_ANN_BENCH_USE_FAISS_BFKNN "Include faiss' brute-force knn algorithm in benchmark" ON)
option(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT "Include faiss' ivf flat algorithm in benchmark" ON)
option(RAFT_ANN_BENCH_USE_FAISS_IVF_PQ "Include faiss' ivf pq algorithm in benchmark" ON)
option(RAFT_ANN_BENCH_USE_RAFT_BFKNN "Include raft's brute-force knn algorithm in benchmark" ON)
option(RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT "Include raft's ivf flat algorithm in benchmark" ON)
option(RAFT_ANN_BENCH_USE_RAFT_IVF_PQ "Include raft's ivf pq algorithm in benchmark" ON)
option(RAFT_ANN_BENCH_USE_RAFT_CAGRA "Include raft's CAGRA in benchmark" ON)
Expand All @@ -36,8 +35,7 @@ if(RAFT_ANN_BENCH_USE_FAISS_BFKNN
endif()

set(RAFT_ANN_BENCH_USE_RAFT OFF)
if(RAFT_ANN_BENCH_USE_RAFT_BFKNN
OR RAFT_ANN_BENCH_USE_RAFT_IVF_PQ
if(RAFT_ANN_BENCH_USE_RAFT_IVF_PQ
OR RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT
OR RAFT_ANN_BENCH_USE_RAFT_CAGRA
)
Expand Down Expand Up @@ -135,35 +133,58 @@ if(RAFT_ANN_BENCH_USE_HNSWLIB)
)
endif()

if(RAFT_ANN_BENCH_USE_RAFT)
if(RAFT_ANN_BENCH_USE_RAFT_IVF_PQ)
ConfigureAnnBench(
NAME
RAFT
RAFT_IVF_PQ
PATH
bench/ann/src/raft/raft_benchmark.cu
$<$<BOOL:${RAFT_ANN_BENCH_USE_RAFT_IVF_PQ}>:bench/ann/src/raft/raft_ivf_pq.cu>
$<$<BOOL:${RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT}>:bench/ann/src/raft/raft_ivf_flat.cu>
$<$<BOOL:${RAFT_ANN_BENCH_USE_RAFT_CAGRA}>:bench/ann/src/raft/raft_cagra.cu>
LINKS
raft::compiled
)
add_compile_definitions(
RAFT $<$<BOOL:${RAFT_ANN_BENCH_USE_RAFT_IVF_PQ}>:RAFT_ANN_BENCH_USE_RAFT_IVF_PQ>
)
add_compile_definitions(
RAFT $<$<BOOL:${RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT}>:RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT>
endif()

if(RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT)
ConfigureAnnBench(
NAME
RAFT_IVF_FLAT
PATH
bench/ann/src/raft/raft_benchmark.cu
$<$<BOOL:${RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT}>:bench/ann/src/raft/raft_ivf_flat.cu>
LINKS
raft::compiled
)
add_compile_definitions(
RAFT $<$<BOOL:${RAFT_ANN_BENCH_USE_RAFT_CAGRA}>:RAFT_ANN_BENCH_USE_RAFT_CAGRA>
endif()

if(RAFT_ANN_BENCH_USE_RAFT_CAGRA)
ConfigureAnnBench(
NAME
RAFT_CAGRA
PATH
bench/ann/src/raft/raft_benchmark.cu
$<$<BOOL:${RAFT_ANN_BENCH_USE_RAFT_CAGRA}>:bench/ann/src/raft/raft_cagra.cu>
LINKS
raft::compiled
)
endif()

if(RAFT_ANN_BENCH_USE_FAISS)
if(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT)
ConfigureAnnBench(
NAME FAISS_IVF_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS faiss::faiss
)
endif()

if(RAFT_ANN_BENCH_USE_FAISS_IVF_PQ)
ConfigureAnnBench(
NAME FAISS_IVF_PQ PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS faiss::faiss
)
endif()

if(RAFT_ANN_BENCH_USE_FAISS_BFKNN)
ConfigureAnnBench(NAME FAISS_BFKNN PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS faiss::faiss)
endif()

if(RAFT_ANN_BENCH_USE_GGNN)
include(cmake/thirdparty/get_glog.cmake)
ConfigureAnnBench(
Expand Down
4 changes: 0 additions & 4 deletions cpp/bench/ann/src/raft/raft_cagra.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
*/
#include "raft_cagra_wrapper.h"

#ifdef RAFT_COMPILED
#include <raft/neighbors/specializations.cuh>
#endif

namespace raft::bench::ann {
template class RaftCagra<uint8_t, uint32_t>;
template class RaftCagra<int8_t, uint32_t>;
Expand Down
4 changes: 2 additions & 2 deletions docs/source/cuda_ann_benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ After the needed dependencies are satisfied, the easiest way to compile ANN benc

You can limit the algorithms that are built by providing a semicolon-delimited list of executable names (each algorithm is suffixed with `_ANN_BENCH`):
```bash
./build.sh bench-ann --limit-bench-ann=HNSWLIB_ANN_BENCH;RAFT_IVF_PQ_ANN_BENCH
./build.sh bench-ann -n --limit-bench-ann=HNSWLIB_ANN_BENCH;RAFT_IVF_PQ_ANN_BENCH
```

Available targets to use with `--limit-bench-ann` are:
Expand All @@ -47,9 +47,9 @@ Available targets to use with `--limit-bench-ann` are:
- FAISS_BFKNN_ANN_BENCH
- GGNN_ANN_BENCH
- HNSWLIB_ANN_BENCH
- RAFT_CAGRA_ANN_BENCH
- RAFT_IVF_PQ_ANN_BENCH
- RAFT_IVF_FLAT_ANN_BENCH
- RAFT_BFKNN_ANN_BENCH

By default, the `*_ANN_BENCH` executables program infer the dataset's datatype from the filename's extension. For example, an extension of `fbin` uses a `float` datatype, `f16bin` uses a `float16` datatype, extension of `i8bin` uses `int8_t` datatype, and `u8bin` uses `uint8_t` type. Currently, only `float`, `float16`, int8_t`, and `unit8_t` are supported.

Expand Down