From e1a7029d4ff3b5a021e9c31bd3f8543c2e195224 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Fri, 30 Jun 2023 19:07:07 -0400 Subject: [PATCH] Fixing ann bench cmake (and docs) --- cpp/bench/ann/CMakeLists.txt | 51 ++++++++++++++++++++-------- cpp/bench/ann/src/raft/raft_cagra.cu | 4 --- docs/source/cuda_ann_benchmarks.md | 4 +-- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index b3198de984..8981085d14 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -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) @@ -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 ) @@ -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 $<$:bench/ann/src/raft/raft_ivf_pq.cu> - $<$:bench/ann/src/raft/raft_ivf_flat.cu> - $<$:bench/ann/src/raft/raft_cagra.cu> LINKS raft::compiled ) - add_compile_definitions( - RAFT $<$:RAFT_ANN_BENCH_USE_RAFT_IVF_PQ> - ) - add_compile_definitions( - RAFT $<$: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 + $<$:bench/ann/src/raft/raft_ivf_flat.cu> + LINKS + raft::compiled ) - add_compile_definitions( - RAFT $<$: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 + $<$: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( diff --git a/cpp/bench/ann/src/raft/raft_cagra.cu b/cpp/bench/ann/src/raft/raft_cagra.cu index b375af0526..be18af7f2c 100644 --- a/cpp/bench/ann/src/raft/raft_cagra.cu +++ b/cpp/bench/ann/src/raft/raft_cagra.cu @@ -15,10 +15,6 @@ */ #include "raft_cagra_wrapper.h" -#ifdef RAFT_COMPILED -#include -#endif - namespace raft::bench::ann { template class RaftCagra; template class RaftCagra; diff --git a/docs/source/cuda_ann_benchmarks.md b/docs/source/cuda_ann_benchmarks.md index 708f5f7dba..c9547e7d77 100644 --- a/docs/source/cuda_ann_benchmarks.md +++ b/docs/source/cuda_ann_benchmarks.md @@ -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: @@ -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.