From bded6749736d6de3daaba265d5da20946be1a80e Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 11 Sep 2023 16:21:01 -0400 Subject: [PATCH 01/34] Adding FAISS cpu to raft-ann-bench --- build.sh | 2 +- cpp/bench/ann/CMakeLists.txt | 27 ++ .../ann/src/faiss/faiss_cpu_benchmark.cpp | 161 +++++++++ cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h | 329 ++++++++++++++++++ cpp/bench/ann/src/faiss/faiss_wrapper.h | 6 +- .../ann/src/hnswlib/hnswlib_benchmark.cpp | 1 - cpp/cmake/thirdparty/get_faiss.cmake | 2 +- 7 files changed, 520 insertions(+), 8 deletions(-) create mode 100644 cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp create mode 100644 cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h diff --git a/build.sh b/build.sh index 071820ba93..b2f3c15365 100755 --- a/build.sh +++ b/build.sh @@ -67,7 +67,7 @@ BUILD_DIRS="${LIBRAFT_BUILD_DIR} ${PYLIBRAFT_BUILD_DIR} ${RAFT_DASK_BUILD_DIR}" # Set defaults for vars modified by flags to this script CMAKE_LOG_LEVEL="" VERBOSE_FLAG="" -BUILD_ALL_GPU_ARCH=0 +BUILD_ALL_GPU_ARCH=1 BUILD_TESTS=OFF BUILD_TYPE=Release BUILD_PRIMS_BENCH=OFF diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index 8985be328b..55e0838acd 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -18,6 +18,13 @@ 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_FAISS_CPU_BFKNN + "Include faiss' cpu brute-force knn algorithm in benchmark" ON +) +option(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT "Include faiss' cpu ivf flat algorithm in benchmark" + ON +) +option(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_PQ "Include faiss' cpu ivf pq 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) @@ -58,6 +65,14 @@ if(RAFT_ANN_BENCH_USE_FAISS_BFKNN set(RAFT_ANN_BENCH_USE_FAISS ON) endif() +set(RAFT_ANN_BENCH_USE_FAISS_CPU OFF) +if(RAFT_ANN_BENCH_USE_FAISS_CPU_BFKNN + OR RAFT_ANN_BENCH_USE_FAISS_CPU_IVFPQ + OR RAFT_ANN_BENCH_USE_FAISS_CPU_IFFLAT +) + set(RAFT_ANN_BENCH_USE_FAISS_CPU ON) +endif() + set(RAFT_ANN_BENCH_USE_RAFT OFF) if(RAFT_ANN_BENCH_USE_RAFT_IVF_PQ OR RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT @@ -219,6 +234,18 @@ if(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT) ) endif() +if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT) + ConfigureAnnBench( + NAME FAISS_CPU_IVF_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cpp LINKS faiss::faiss + ) +endif() + +if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT) + ConfigureAnnBench( + NAME FAISS_CPU_IVF_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cpp 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 diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp new file mode 100644 index 0000000000..1be39b3de2 --- /dev/null +++ b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2023, NVIDIA CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "../common/ann_types.hpp" +#include "faiss_cpu_wrapper.h" +#define JSON_DIAGNOSTICS 1 +#include + +namespace raft::bench::ann { + +template +void parse_base_build_param(const nlohmann::json& conf, + typename raft::bench::ann::Faiss::BuildParam& param) +{ + param.nlist = conf.at("nlist"); + if (conf.contains("ratio")) { param.ratio = conf.at("ratio"); } +} + +template +void parse_build_param(const nlohmann::json& conf, + typename raft::bench::ann::FaissIVFFlat::BuildParam& param) +{ + parse_base_build_param(conf, param); +} + +template +void parse_build_param(const nlohmann::json& conf, + typename raft::bench::ann::FaissIVFPQ::BuildParam& param) +{ + parse_base_build_param(conf, param); + param.M = conf.at("M"); + if (conf.contains("usePrecomputed")) { + param.usePrecomputed = conf.at("usePrecomputed"); + } else { + param.usePrecomputed = false; + } + if (conf.contains("useFloat16")) { + param.useFloat16 = conf.at("useFloat16"); + } else { + param.useFloat16 = false; + } +} + +template +void parse_build_param(const nlohmann::json& conf, + typename raft::bench::ann::FaissIVFSQ::BuildParam& param) +{ + parse_base_build_param(conf, param); + param.quantizer_type = conf.at("quantizer_type"); +} + +template +void parse_search_param(const nlohmann::json& conf, + typename raft::bench::ann::Faiss::SearchParam& param) +{ + param.nprobe = conf.at("nprobe"); + if (conf.contains("refine_ratio")) { param.refine_ratio = conf.at("refine_ratio"); } +} + +template class Algo> +std::unique_ptr> make_algo(raft::bench::ann::Metric metric, + int dim, + const nlohmann::json& conf) +{ + typename Algo::BuildParam param; + parse_build_param(conf, param); + return std::make_unique>(metric, dim, param); +} + +template class Algo> +std::unique_ptr> make_algo(raft::bench::ann::Metric metric, + int dim, + const nlohmann::json& conf, + const std::vector& dev_list) +{ + typename Algo::BuildParam param; + parse_build_param(conf, param); + + (void)dev_list; + return std::make_unique>(metric, dim, param); +} + +template +std::unique_ptr> create_algo(const std::string& algo, + const std::string& distance, + int dim, + const nlohmann::json& conf, + const std::vector& dev_list) +{ + // stop compiler warning; not all algorithms support multi-GPU so it may not be used + (void)dev_list; + + std::unique_ptr> ann; + + if constexpr (std::is_same_v) { + raft::bench::ann::Metric metric = parse_metric(distance); + if (algo == "faiss_ivf_flat") { + ann = make_algo(metric, dim, conf, dev_list); + } else if (algo == "faiss_ivf_pq") { + ann = make_algo(metric, dim, conf); + } else if (algo == "faiss_ivf_sq") { + ann = make_algo(metric, dim, conf); + } else if (algo == "faiss_flat") { + ann = std::make_unique>(metric, dim); + } + } + + if constexpr (std::is_same_v) {} + + if (!ann) { throw std::runtime_error("invalid algo: '" + algo + "'"); } + + return ann; +} + +template +std::unique_ptr::AnnSearchParam> create_search_param( + const std::string& algo, const nlohmann::json& conf) +{ + if (algo == "faiss_ivf_flat" || algo == "faiss_ivf_pq" || algo == "faiss_ivf_sq") { + auto param = std::make_unique::SearchParam>(); + parse_search_param(conf, *param); + return param; + } else if (algo == "faiss_flat") { + auto param = std::make_unique::AnnSearchParam>(); + return param; + } + // else + throw std::runtime_error("invalid algo: '" + algo + "'"); +} + +} // namespace raft::bench::ann + +REGISTER_ALGO_INSTANCE(float); +REGISTER_ALGO_INSTANCE(std::int8_t); +REGISTER_ALGO_INSTANCE(std::uint8_t); + +#ifdef ANN_BENCH_BUILD_MAIN +#include "../common/benchmark.hpp" +int main(int argc, char** argv) { return raft::bench::ann::run_main(argc, argv); } +#endif diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h new file mode 100644 index 0000000000..7c62e34204 --- /dev/null +++ b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h @@ -0,0 +1,329 @@ +/* + * Copyright (c) 2023, NVIDIA CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "../common/ann_types.hpp" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace { + +faiss::MetricType parse_metric_type(raft::bench::ann::Metric metric) +{ + if (metric == raft::bench::ann::Metric::kInnerProduct) { + return faiss::METRIC_INNER_PRODUCT; + } else if (metric == raft::bench::ann::Metric::kEuclidean) { + return faiss::METRIC_L2; + } else { + throw std::runtime_error("faiss supports only metric type of inner product and L2"); + } +} + +// note BLAS library can still use multi-threading, and +// setting environment variable like OPENBLAS_NUM_THREADS can control it +class OmpSingleThreadScope { + public: + OmpSingleThreadScope() + { + max_threads_ = omp_get_max_threads(); + omp_set_num_threads(1); + } + ~OmpSingleThreadScope() + { + // the best we can do + omp_set_num_threads(max_threads_); + } + + private: + int max_threads_; +}; + +} // namespace + +namespace raft::bench::ann { + +template +class Faiss : public ANN { + public: + using typename ANN::AnnSearchParam; + struct SearchParam : public AnnSearchParam { + int nprobe; + float refine_ratio = 1.0; + }; + + struct BuildParam { + int nlist = 1; + int ratio = 2; + }; + + Faiss(Metric metric, int dim, const BuildParam& param) + : ANN(metric, dim), + metric_type_(parse_metric_type(metric)), + nlist_{param.nlist}, + training_sample_fraction_{1.0 / double(param.ratio)} + { + static_assert(std::is_same_v, "faiss support only float type"); + } + + virtual ~Faiss() noexcept {} + + void build(const T* dataset, size_t nrow, cudaStream_t stream = 0) final; + + void set_search_param(const AnnSearchParam& param) override; + + // TODO: if the number of results is less than k, the remaining elements of 'neighbors' + // will be filled with (size_t)-1 + void search(const T* queries, + int batch_size, + int k, + size_t* neighbors, + float* distances, + cudaStream_t stream = 0) const final; + + AlgoProperty get_preference() const override + { + AlgoProperty property; + // to enable building big dataset which is larger than memory + property.dataset_memory_type = MemoryType::Host; + property.query_memory_type = MemoryType::Host; + return property; + } + + protected: + template + void save_(const std::string& file) const; + + template + void load_(const std::string& file); + + std::unique_ptr index_; + std::unique_ptr index_refine_; + faiss::MetricType metric_type_; + int nlist_; + double training_sample_fraction_; +}; + +template +void Faiss::build(const T* dataset, size_t nrow, cudaStream_t stream) +{ + OmpSingleThreadScope omp_single_thread; + auto index_ivf = dynamic_cast(index_.get()); + if (index_ivf != nullptr) { + // set the min/max training size for clustering to use the whole provided training set. + double trainset_size = training_sample_fraction_ * static_cast(nrow); + double points_per_centroid = trainset_size / static_cast(nlist_); + int max_ppc = std::ceil(points_per_centroid); + int min_ppc = std::floor(points_per_centroid); + if (min_ppc < index_ivf->cp.min_points_per_centroid) { + RAFT_LOG_WARN( + "The suggested training set size %zu (data size %zu, training sample ratio %f) yields %d " + "points per cluster (n_lists = %d). This is smaller than the FAISS default " + "min_points_per_centroid = %d.", + static_cast(trainset_size), + nrow, + training_sample_fraction_, + min_ppc, + nlist_, + index_ivf->cp.min_points_per_centroid); + } + index_ivf->cp.max_points_per_centroid = max_ppc; + index_ivf->cp.min_points_per_centroid = min_ppc; + } + index_->train(nrow, dataset); // faiss::IndexFlat::train() will do nothing + assert(index_->is_trained); + index_->add(nrow, dataset); + stream_wait(stream); +} + +template +void Faiss::set_search_param(const AnnSearchParam& param) +{ + auto search_param = dynamic_cast(param); + int nprobe = search_param.nprobe; + assert(nprobe <= nlist_); + dynamic_cast(index_.get())->setNumProbes(nprobe); + + if (search_param.refine_ratio > 1.0) { + this->index_refine_ = std::make_unique(this->index_.get()); + this->index_refine_.get()->k_factor = search_param.refine_ratio; + } +} + +template +void Faiss::search(const T* queries, + int batch_size, + int k, + size_t* neighbors, + float* distances, + cudaStream_t stream) const +{ + static_assert(sizeof(size_t) == sizeof(faiss::Index::idx_t), + "sizes of size_t and faiss::Index::idx_t are different"); + index_->search( + batch_size, queries, k, distances, reinterpret_cast(neighbors)); +} + +template +template +void Faiss::save_(const std::string& file) const +{ + OmpSingleThreadScope omp_single_thread; + + auto cpu_index = std::make_unique(); + dynamic_cast(index_.get())->copyTo(cpu_index.get()); + faiss::write_index(cpu_index.get(), file.c_str()); +} + +template +template +void Faiss::load_(const std::string& file) +{ + OmpSingleThreadScope omp_single_thread; + + index_ = std::make_unique(dynamic_cast(faiss::read_index(file.c_str()))); +} + +template +class FaissIVFFlat : public Faiss { + public: + using typename Faiss::BuildParam; + + FaissIVFFlat(Metric metric, int dim, const BuildParam& param) : Faiss(metric, dim, param) + { + faiss::IndexIVFFlatConfig config; + config.device = this->device_; + this->index_ = std::make_unique( + &(this->_resource_), dim, param.nlist, this->metric_type_, config); + } + + void save(const std::string& file) const override + { + this->template save_(file); + } + void load(const std::string& file) override + { + this->template load_(file); + } +}; + +template +class FaissIVFPQ : public Faiss { + public: + struct BuildParam : public Faiss::BuildParam { + int M; + bool useFloat16; + bool usePrecomputed; + }; + + FaissIVFPQ(Metric metric, int dim, const BuildParam& param) : Faiss(metric, dim, param) + { + faiss::IndexIVFPQConfig config; + config.useFloat16LookupTables = param.useFloat16; + config.usePrecomputedTables = param.usePrecomputed; + config.device = this->device_; + this->index_ = std::make_unique(&(this->_resource_), + dim, + param.nlist, + param.M, + 8, // FAISS only supports bitsPerCode=8 + this->metric_type_, + config); + } + + void save(const std::string& file) const override + { + this->template save_(file); + } + void load(const std::string& file) override + { + this->template load_(file); + } +}; + +template +class FaissIVFSQ : public Faiss { + public: + struct BuildParam : public Faiss::BuildParam { + std::string quantizer_type; + }; + + FaissIVFSQ(Metric metric, int dim, const BuildParam& param) : Faiss(metric, dim, param) + { + faiss::ScalarQuantizer::QuantizerType qtype; + if (param.quantizer_type == "fp16") { + qtype = faiss::ScalarQuantizer::QT_fp16; + } else if (param.quantizer_type == "int8") { + qtype = faiss::ScalarQuantizer::QT_8bit; + } else { + throw std::runtime_error("FaissIVFSQ supports only fp16 and int8 but got " + + param.quantizer_type); + } + + faiss::IndexIVFScalarQuantizerConfig config; + config.device = this->device_; + this->index_ = std::make_unique( + &(this->_resource_), dim, param.nlist, qtype, this->metric_type_, true, config); + } + + void save(const std::string& file) const override + { + this->template save_(file); + } + void load(const std::string& file) override + { + this->template load_(file); + } +}; + +template +class FaissFlat : public Faiss { + public: + FaissFlat(Metric metric, int dim) : Faiss(metric, dim, typename Faiss::BuildParam{}) + { + faiss::IndexFlatConfig config; + config.device = this->device_; + this->index_ = + std::make_unique(&(this->_resource_), dim, this->metric_type_, config); + } + + // class Faiss is more like a IVF class, so need special treating here + void set_search_param(const typename ANN::AnnSearchParam&) override{}; + + void save(const std::string& file) const override + { + this->template save_(file); + } + void load(const std::string& file) override + { + this->template load_(file); + } +}; + +} // namespace raft::bench::ann diff --git a/cpp/bench/ann/src/faiss/faiss_wrapper.h b/cpp/bench/ann/src/faiss/faiss_wrapper.h index 672c685b1f..a426ad2df7 100644 --- a/cpp/bench/ann/src/faiss/faiss_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_wrapper.h @@ -13,9 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef FAISS_WRAPPER_H_ -#define FAISS_WRAPPER_H_ - +#pragma once #include "../common/ann_types.hpp" #include @@ -355,5 +353,3 @@ class FaissGpuFlat : public FaissGpu { }; } // namespace raft::bench::ann - -#endif diff --git a/cpp/bench/ann/src/hnswlib/hnswlib_benchmark.cpp b/cpp/bench/ann/src/hnswlib/hnswlib_benchmark.cpp index 7d96e54989..1af19a22cb 100644 --- a/cpp/bench/ann/src/hnswlib/hnswlib_benchmark.cpp +++ b/cpp/bench/ann/src/hnswlib/hnswlib_benchmark.cpp @@ -24,7 +24,6 @@ #include #include -#undef WARP_SIZE #include "hnswlib_wrapper.h" #define JSON_DIAGNOSTICS 1 #include diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index b7c132f2f1..6cdad23c69 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -84,4 +84,4 @@ find_and_configure_faiss(VERSION 1.7.0 REPOSITORY ${RAFT_FAISS_GIT_REPOSITORY} PINNED_TAG ${RAFT_FAISS_GIT_TAG} BUILD_STATIC_LIBS ${RAFT_USE_FAISS_STATIC} - EXCLUDE_FROM_ALL ${RAFT_EXCLUDE_FAISS_FROM_ALL}) \ No newline at end of file + EXCLUDE_FROM_ALL ${RAFT_EXCLUDE_FAISS_FROM_ALL}) From f0e3c8f69e932d3f96a36ef5fe0bb3effeb6573f Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 12 Sep 2023 16:33:11 -0400 Subject: [PATCH 02/34] Adding faiss cpu indexes and build --- cpp/bench/ann/CMakeLists.txt | 19 ++-- .../ann/src/faiss/faiss_cpu_benchmark.cpp | 6 +- cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h | 88 ++++++++----------- cpp/cmake/thirdparty/get_faiss.cmake | 8 +- 4 files changed, 53 insertions(+), 68 deletions(-) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index 55e0838acd..bbceba8bd3 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -40,6 +40,7 @@ option(RAFT_ANN_BENCH_SINGLE_EXE find_package(Threads REQUIRED) if(BUILD_CPU_ONLY) + set(RAFT_FAISS_ENABLE_GPU OFF) set(RAFT_ANN_BENCH_USE_FAISS_BFKNN OFF) set(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_IVF_PQ OFF) @@ -51,9 +52,12 @@ else() # Disable faiss benchmarks on CUDA 12 since faiss is not yet CUDA 12-enabled. # https://github.com/rapidsai/raft/issues/1627 if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL 12.0.0) + set(RAFT_FAISS_ENABLE_GPU OFF) set(RAFT_ANN_BENCH_USE_FAISS_BFKNN OFF) set(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_IVF_PQ OFF) + else() + set(RAFT_FAISS_ENABLE_GPU ON) endif() endif() @@ -61,16 +65,11 @@ set(RAFT_ANN_BENCH_USE_FAISS OFF) if(RAFT_ANN_BENCH_USE_FAISS_BFKNN OR RAFT_ANN_BENCH_USE_FAISS_IVFPQ OR RAFT_ANN_BENCH_USE_FAISS_IFFLAT -) - set(RAFT_ANN_BENCH_USE_FAISS ON) -endif() - -set(RAFT_ANN_BENCH_USE_FAISS_CPU OFF) -if(RAFT_ANN_BENCH_USE_FAISS_CPU_BFKNN + OR RAFT_ANN_BENCH_USE_FAISS_CPU_BFKNN OR RAFT_ANN_BENCH_USE_FAISS_CPU_IVFPQ OR RAFT_ANN_BENCH_USE_FAISS_CPU_IFFLAT ) - set(RAFT_ANN_BENCH_USE_FAISS_CPU ON) + set(RAFT_ANN_BENCH_USE_FAISS ON) endif() set(RAFT_ANN_BENCH_USE_RAFT OFF) @@ -236,13 +235,13 @@ endif() if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT) ConfigureAnnBench( - NAME FAISS_CPU_IVF_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cpp LINKS faiss::faiss + NAME FAISS_CPU_IVF_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS faiss::faiss ) endif() -if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT) +if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_PQ) ConfigureAnnBench( - NAME FAISS_CPU_IVF_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cpp LINKS faiss::faiss + NAME FAISS_CPU_IVF_PQ PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS faiss::faiss ) endif() diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp index 1be39b3de2..7d1ba726bb 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp +++ b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp @@ -55,10 +55,10 @@ void parse_build_param(const nlohmann::json& conf, } else { param.usePrecomputed = false; } - if (conf.contains("useFloat16")) { - param.useFloat16 = conf.at("useFloat16"); + if (conf.contains("bitsPerCode")) { + param.bitsPerCode = conf.at("bitsPerCode"); } else { - param.useFloat16 = false; + param.bitsPerCode = 8; } } diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h index 7c62e34204..4ebd22ec0f 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h @@ -17,6 +17,7 @@ #include "../common/ann_types.hpp" +#define FMT_HEADER_ONLY #include #include @@ -98,6 +99,15 @@ class Faiss : public ANN { void set_search_param(const AnnSearchParam& param) override; + void init_quantizer(int dim) + { + if (this->metric_type_ == faiss::MetricType::METRIC_L2) { + this->quantizer_ = std::make_unique(dim); + } else if (this->metric_type_ == faiss::MetricType::METRIC_INNER_PRODUCT) { + this->quantizer_ = std::make_unique(dim); + } + } + // TODO: if the number of results is less than k, the remaining elements of 'neighbors' // will be filled with (size_t)-1 void search(const T* queries, @@ -117,13 +127,14 @@ class Faiss : public ANN { } protected: - template + template void save_(const std::string& file) const; - template + template void load_(const std::string& file); std::unique_ptr index_; + std::unique_ptr quantizer_; std::unique_ptr index_refine_; faiss::MetricType metric_type_; int nlist_; @@ -159,7 +170,6 @@ void Faiss::build(const T* dataset, size_t nrow, cudaStream_t stream) index_->train(nrow, dataset); // faiss::IndexFlat::train() will do nothing assert(index_->is_trained); index_->add(nrow, dataset); - stream_wait(stream); } template @@ -168,7 +178,7 @@ void Faiss::set_search_param(const AnnSearchParam& param) auto search_param = dynamic_cast(param); int nprobe = search_param.nprobe; assert(nprobe <= nlist_); - dynamic_cast(index_.get())->setNumProbes(nprobe); + dynamic_cast(index_.get())->nprobe = nprobe; if (search_param.refine_ratio > 1.0) { this->index_refine_ = std::make_unique(this->index_.get()); @@ -191,14 +201,11 @@ void Faiss::search(const T* queries, } template -template +template void Faiss::save_(const std::string& file) const { OmpSingleThreadScope omp_single_thread; - - auto cpu_index = std::make_unique(); - dynamic_cast(index_.get())->copyTo(cpu_index.get()); - faiss::write_index(cpu_index.get(), file.c_str()); + faiss::write_index(index_.get(), file.c_str()); } template @@ -206,8 +213,7 @@ template void Faiss::load_(const std::string& file) { OmpSingleThreadScope omp_single_thread; - - index_ = std::make_unique(dynamic_cast(faiss::read_index(file.c_str()))); + index_ = std::unique_ptr(dynamic_cast(faiss::read_index(file.c_str()))); } template @@ -217,20 +223,16 @@ class FaissIVFFlat : public Faiss { FaissIVFFlat(Metric metric, int dim, const BuildParam& param) : Faiss(metric, dim, param) { - faiss::IndexIVFFlatConfig config; - config.device = this->device_; - this->index_ = std::make_unique( - &(this->_resource_), dim, param.nlist, this->metric_type_, config); + this->init_quantizer(dim); + this->index_ = std::make_unique( + this->quantizer_.get(), dim, param.nlist, this->metric_type_); } void save(const std::string& file) const override { - this->template save_(file); - } - void load(const std::string& file) override - { - this->template load_(file); + this->template save_(file); } + void load(const std::string& file) override { this->template load_(file); } }; template @@ -238,33 +240,22 @@ class FaissIVFPQ : public Faiss { public: struct BuildParam : public Faiss::BuildParam { int M; - bool useFloat16; + int bitsPerCode; bool usePrecomputed; }; FaissIVFPQ(Metric metric, int dim, const BuildParam& param) : Faiss(metric, dim, param) { - faiss::IndexIVFPQConfig config; - config.useFloat16LookupTables = param.useFloat16; - config.usePrecomputedTables = param.usePrecomputed; - config.device = this->device_; - this->index_ = std::make_unique(&(this->_resource_), - dim, - param.nlist, - param.M, - 8, // FAISS only supports bitsPerCode=8 - this->metric_type_, - config); + this->init_quantizer(dim); + this->index_ = std::make_unique( + this->quantizer_.get(), dim, param.nlist, param.M, param.bitsPerCode, this->metric_type_); } void save(const std::string& file) const override { - this->template save_(file); - } - void load(const std::string& file) override - { - this->template load_(file); + this->template save_(file); } + void load(const std::string& file) override { this->template load_(file); } }; template @@ -286,19 +277,18 @@ class FaissIVFSQ : public Faiss { param.quantizer_type); } - faiss::IndexIVFScalarQuantizerConfig config; - config.device = this->device_; - this->index_ = std::make_unique( - &(this->_resource_), dim, param.nlist, qtype, this->metric_type_, true, config); + this->init_quantizer(dim); + this->index_ = std::make_unique( + this->quantizer_.get(), dim, param.nlist, qtype, this->metric_type_, true); } void save(const std::string& file) const override { - this->template save_(file); + this->template save_(file); } void load(const std::string& file) override { - this->template load_(file); + this->template load_(file); } }; @@ -307,10 +297,7 @@ class FaissFlat : public Faiss { public: FaissFlat(Metric metric, int dim) : Faiss(metric, dim, typename Faiss::BuildParam{}) { - faiss::IndexFlatConfig config; - config.device = this->device_; - this->index_ = - std::make_unique(&(this->_resource_), dim, this->metric_type_, config); + this->index_ = std::make_unique(dim, this->metric_type_); } // class Faiss is more like a IVF class, so need special treating here @@ -318,12 +305,9 @@ class FaissFlat : public Faiss { void save(const std::string& file) const override { - this->template save_(file); - } - void load(const std::string& file) override - { - this->template load_(file); + this->template save_(file); } + void load(const std::string& file) override { this->template load_(file); } }; } // namespace raft::bench::ann diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index 6cdad23c69..183dd0007a 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -15,7 +15,7 @@ #============================================================================= function(find_and_configure_faiss) - set(oneValueArgs VERSION REPOSITORY PINNED_TAG BUILD_STATIC_LIBS EXCLUDE_FROM_ALL) + set(oneValueArgs VERSION REPOSITORY PINNED_TAG BUILD_STATIC_LIBS EXCLUDE_FROM_ALL ENABLE_GPU) cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) @@ -39,7 +39,7 @@ function(find_and_configure_faiss) OPTIONS "FAISS_ENABLE_PYTHON OFF" "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" - "FAISS_ENABLE_GPU ON" + "FAISS_ENABLE_GPU ${PKG_ENABLE_GPU}" "BUILD_TESTING OFF" "CMAKE_MESSAGE_LOG_LEVEL VERBOSE" "FAISS_USE_CUDA_TOOLKIT_STATIC ${CUDA_STATIC_RUNTIME}" @@ -84,4 +84,6 @@ find_and_configure_faiss(VERSION 1.7.0 REPOSITORY ${RAFT_FAISS_GIT_REPOSITORY} PINNED_TAG ${RAFT_FAISS_GIT_TAG} BUILD_STATIC_LIBS ${RAFT_USE_FAISS_STATIC} - EXCLUDE_FROM_ALL ${RAFT_EXCLUDE_FAISS_FROM_ALL}) + EXCLUDE_FROM_ALL ${RAFT_EXCLUDE_FAISS_FROM_ALL} + ENABLE_GPU ${RAFT_FAISS_ENABLE_GPU}) + From f66fd21f80c025515b5f40cebc572d86483697cc Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 12 Sep 2023 16:43:50 -0400 Subject: [PATCH 03/34] Docs updates --- docs/source/ann_benchmarks_param_tuning.md | 34 ++++++++++++++++++++++ docs/source/raft_ann_benchmarks.md | 13 +++++---- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/docs/source/ann_benchmarks_param_tuning.md b/docs/source/ann_benchmarks_param_tuning.md index ca8ffa5e18..c59675067a 100644 --- a/docs/source/ann_benchmarks_param_tuning.md +++ b/docs/source/ann_benchmarks_param_tuning.md @@ -5,6 +5,10 @@ This guide outlines the various parameter settings that can be specified in [RAF ## RAFT Indexes +### `raft_brute_force` + +Use RAFT brute-force index for exact search. Brute-force has no further build or search parameters. + ### `raft_ivf_flat` IVF-flat uses an inverted-file index, which partitions the vectors into a series of clusters, or lists, storing them in an interleaved format which is optimized for fast distance computation. The searching of an IVF-flat index reduces the total vectors in the index to those within some user-specified nearest clusters called probes. @@ -52,6 +56,10 @@ CAGRA uses a graph-based index, which creates an intermediate, approximate kNN g ## FAISS Indexes +### `faiss_gpu_flat` + +Use FAISS flat index on the GPU, which performs an exact search using brute-force and doesn't have any further build or search parameters. + ### `faiss_gpu_ivf_flat` IVF-flat uses an inverted-file index, which partitions the vectors into a series of clusters, or lists, storing them in an interleaved format which is optimized for fast distance computation. The searching of an IVF-flat index reduces the total vectors in the index to those within some user-specified nearest clusters called probes. @@ -78,7 +86,33 @@ IVF-pq is an inverted-file index, which partitions the vectors into a series of | `numProbes` | `search_params` | Y | Positive Integer >0 | | The closest number of clusters to search for each query vector. Larger values will improve recall but will search more points in the index. | | `refine_ratio` | `search_params` | N| Positive Number >=0 | 0 | `refine_ratio * k` nearest neighbors are queried from the index initially and an additional refinement step improves recall by selecting only the best `k` neighbors. | +### `faiss_flat` + +Use FAISS flat index on the CPU, which performs an exact search using brute-force and doesn't have any further build or search parameters. + +### `faiss_ivf_flat` + +Use FAISS IVF-Flat index on CPU + +| Parameter | Type | Required | Data Type | Default | Description | +|-----------|----------------|----------|---------------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `nlists` | `build_param` | Y | Positive Integer >0 | | Number of clusters to partition the vectors into. Larger values will put less points into each cluster but this will impact index build time as more clusters need to be trained. | +| `ratio` | `build_param` | N | Positive Integer >0 | 2 | `1/ratio` is the number of training points which should be used to train the clusters. | +| `nprobe` | `search_params` | Y | Positive Integer >0 | | The closest number of clusters to search for each query vector. Larger values will improve recall but will search more points in the index. | + +### `faiss_ivf_pq` + +Use FAISS IVF-PQ index on CPU +| Parameter | Type | Required | Data Type | Default | Description | +|------------------|----------------|----------|------------------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `nlists` | `build_param` | Y | Positive Integer >0 | | Number of clusters to partition the vectors into. Larger values will put less points into each cluster but this will impact index build time as more clusters need to be trained. | +| `ratio` | `build_param` | N | Positive Integer >0 | 2 | `1/ratio` is the number of training points which should be used to train the clusters. | +| `M` | `build_param` | Y | Positive Integer Power of 2 [8-64] | | Number of chunks or subquantizers for each vector. | +| `usePrecomputed` | `build_param` | N | Boolean. Default=`false` | `false` | Use pre-computed lookup tables to speed up search at the cost of increased memory usage. | +| `bitsPerCode` | `build_param` | N | Positive Integer [4-8] | 8 | Number of bits to use for each code. | +| `numProbes` | `search_params` | Y | Positive Integer >0 | | The closest number of clusters to search for each query vector. Larger values will improve recall but will search more points in the index. | +| `refine_ratio` | `search_params` | N| Positive Number >=0 | 0 | `refine_ratio * k` nearest neighbors are queried from the index initially and an additional refinement step improves recall by selecting only the best `k` neighbors. | ## HNSW diff --git a/docs/source/raft_ann_benchmarks.md b/docs/source/raft_ann_benchmarks.md index af0b040d34..4cda258ed3 100644 --- a/docs/source/raft_ann_benchmarks.md +++ b/docs/source/raft_ann_benchmarks.md @@ -268,12 +268,13 @@ The `index` section will contain a list of index objects, each of which will hav The table below contains the possible settings for the `algo` field. Each unique algorithm will have its own set of `build_param` and `search_params` settings. The [ANN Algorithm Parameter Tuning Guide](ann_benchmarks_param_tuning.md) contains detailed instructions on choosing build and search parameters for each supported algorithm. -| Library | Algorithms | -|-----------|----------------------------------------------| -| FAISS | `faiss_gpu_ivf_flat`, `faiss_gpu_ivf_pq` | -| GGNN | `ggnn` | -| HNSWlib | `hnswlib` | -| RAFT | `raft_cagra`, `raft_ivf_flat`, `raft_ivf_pq` | +| Library | Algorithms | +|-----------|-------------------------------------------------------| +| FAISS GPU | `faiss_flat`, `faiss_gpu_ivf_flat`, `faiss_gpu_ivf_pq` | +| FAISS CPU | `faiss_flat`, `faiss_ivf_flat`, `faiss_ivf_pq` | +| GGNN | `ggnn` | +| HNSWlib | `hnswlib` | +| RAFT | `raft_cagra`, `raft_ivf_flat`, `raft_ivf_pq` | From 6d7f390d0a7c62328c89779d3e650c95acd137dc Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 12 Sep 2023 16:45:02 -0400 Subject: [PATCH 04/34] Resetting build all gpu arch to 0 --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index b2f3c15365..071820ba93 100755 --- a/build.sh +++ b/build.sh @@ -67,7 +67,7 @@ BUILD_DIRS="${LIBRAFT_BUILD_DIR} ${PYLIBRAFT_BUILD_DIR} ${RAFT_DASK_BUILD_DIR}" # Set defaults for vars modified by flags to this script CMAKE_LOG_LEVEL="" VERBOSE_FLAG="" -BUILD_ALL_GPU_ARCH=1 +BUILD_ALL_GPU_ARCH=0 BUILD_TESTS=OFF BUILD_TYPE=Release BUILD_PRIMS_BENCH=OFF From c9569a5e5ab1a71f69b0a64e0ceb271e8431c1de Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 12 Sep 2023 16:48:44 -0400 Subject: [PATCH 05/34] Doc updates --- cpp/bench/ann/src/raft/raft_benchmark.cu | 2 +- cpp/bench/ann/src/raft/raft_wrapper.h | 2 ++ docs/source/raft_ann_benchmarks.md | 14 +++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cpp/bench/ann/src/raft/raft_benchmark.cu b/cpp/bench/ann/src/raft/raft_benchmark.cu index 7ba381ab0a..f2636e5e7b 100644 --- a/cpp/bench/ann/src/raft/raft_benchmark.cu +++ b/cpp/bench/ann/src/raft/raft_benchmark.cu @@ -225,7 +225,7 @@ std::unique_ptr::AnnSearchParam> create_search const std::string& algo, const nlohmann::json& conf) { #ifdef RAFT_ANN_BENCH_USE_RAFT_BFKNN - if (algo == "raft_bfknn") { + if (algo == "raft_brute_force") { auto param = std::make_unique::AnnSearchParam>(); return param; } diff --git a/cpp/bench/ann/src/raft/raft_wrapper.h b/cpp/bench/ann/src/raft/raft_wrapper.h index c8d98460b7..499bdf29a1 100644 --- a/cpp/bench/ann/src/raft/raft_wrapper.h +++ b/cpp/bench/ann/src/raft/raft_wrapper.h @@ -134,6 +134,8 @@ void RaftGpu::search(const T* queries, float* distances, cudaStream_t stream) const { + // TODO: Integrate new `raft::brute_force::index` (from + // https://github.com/rapidsai/raft/pull/1817) raft::spatial::knn::detail::fusedL2Knn(this->dim_, reinterpret_cast(neighbors), distances, diff --git a/docs/source/raft_ann_benchmarks.md b/docs/source/raft_ann_benchmarks.md index d3c3e65f14..132e38984c 100644 --- a/docs/source/raft_ann_benchmarks.md +++ b/docs/source/raft_ann_benchmarks.md @@ -267,13 +267,13 @@ The `index` section will contain a list of index objects, each of which will hav The table below contains the possible settings for the `algo` field. Each unique algorithm will have its own set of `build_param` and `search_params` settings. The [ANN Algorithm Parameter Tuning Guide](ann_benchmarks_param_tuning.md) contains detailed instructions on choosing build and search parameters for each supported algorithm. -| Library | Algorithms | -|-----------|-------------------------------------------------------| -| FAISS GPU | `faiss_flat`, `faiss_gpu_ivf_flat`, `faiss_gpu_ivf_pq` | -| FAISS CPU | `faiss_flat`, `faiss_ivf_flat`, `faiss_ivf_pq` | -| GGNN | `ggnn` | -| HNSWlib | `hnswlib` | -| RAFT | `raft_cagra`, `raft_ivf_flat`, `raft_ivf_pq` | +| Library | Algorithms | +|-----------|-----------------------------------------------------------------| +| FAISS GPU | `faiss_flat`, `faiss_gpu_ivf_flat`, `faiss_gpu_ivf_pq` | +| FAISS CPU | `faiss_flat`, `faiss_ivf_flat`, `faiss_ivf_pq` | +| GGNN | `ggnn` | +| HNSWlib | `hnswlib` | +| RAFT | `raft_brute_force`, `raft_cagra`, `raft_ivf_flat`, `raft_ivf_pq` | From 28bee2b083747e8c50863fabb2bbd536293bbb5e Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 12 Sep 2023 16:57:57 -0400 Subject: [PATCH 06/34] More updates --- cpp/bench/ann/CMakeLists.txt | 35 +++++++++++++------ cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h | 7 ++++ .../src/raft-ann-bench/run/algos.yaml | 21 +++++++---- 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index bbceba8bd3..2b6f1c1520 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -15,12 +15,14 @@ # ################################################################################################## # * benchmark options ------------------------------------------------------------------------------ -option(RAFT_ANN_BENCH_USE_FAISS_BFKNN "Include faiss' brute-force knn algorithm in benchmark" ON) +option(RAFT_ANN_BENCH_USE_FAISS_FLAT "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_FAISS_CPU_BFKNN +option(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT "Include faiss' cpu brute-force knn algorithm in benchmark" ON ) +option(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT "Include faiss' cpu brute-force algorithm in benchmark" ON) + option(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT "Include faiss' cpu ivf flat algorithm in benchmark" ON ) @@ -41,7 +43,7 @@ find_package(Threads REQUIRED) if(BUILD_CPU_ONLY) set(RAFT_FAISS_ENABLE_GPU OFF) - set(RAFT_ANN_BENCH_USE_FAISS_BFKNN OFF) + set(RAFT_ANN_BENCH_USE_FAISS_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_IVF_PQ OFF) set(RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT OFF) @@ -53,7 +55,7 @@ else() # https://github.com/rapidsai/raft/issues/1627 if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL 12.0.0) set(RAFT_FAISS_ENABLE_GPU OFF) - set(RAFT_ANN_BENCH_USE_FAISS_BFKNN OFF) + set(RAFT_ANN_BENCH_USE_FAISS_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_IVF_PQ OFF) else() @@ -62,10 +64,10 @@ else() endif() set(RAFT_ANN_BENCH_USE_FAISS OFF) -if(RAFT_ANN_BENCH_USE_FAISS_BFKNN +if(RAFT_ANN_BENCH_USE_FAISS_FLAT OR RAFT_ANN_BENCH_USE_FAISS_IVFPQ OR RAFT_ANN_BENCH_USE_FAISS_IFFLAT - OR RAFT_ANN_BENCH_USE_FAISS_CPU_BFKNN + OR RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT OR RAFT_ANN_BENCH_USE_FAISS_CPU_IVFPQ OR RAFT_ANN_BENCH_USE_FAISS_CPU_IFFLAT ) @@ -74,6 +76,7 @@ endif() set(RAFT_ANN_BENCH_USE_RAFT OFF) if(RAFT_ANN_BENCH_USE_RAFT_IVF_PQ + OR RAFT_ANN_BENCH_USE_RAFT_BRUTE_FORCE OR RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT OR RAFT_ANN_BENCH_USE_RAFT_CAGRA ) @@ -215,6 +218,12 @@ if(RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT) ) endif() +if(RAFT_ANN_BENCH_USE_RAFT_BRUTE_FORCE) + ConfigureAnnBench( + NAME RAFT_BRUTE_FORCE PATH bench/ann/src/raft/raft_benchmark.cu LINKS raft::compiled + ) +endif() + if(RAFT_ANN_BENCH_USE_RAFT_CAGRA) ConfigureAnnBench( NAME @@ -227,9 +236,9 @@ if(RAFT_ANN_BENCH_USE_RAFT_CAGRA) ) endif() -if(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT) +if(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT) ConfigureAnnBench( - NAME FAISS_IVF_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS faiss::faiss + NAME FAISS_CPU_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS faiss::faiss ) endif() @@ -245,14 +254,20 @@ if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_PQ) ) endif() +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) +if(RAFT_ANN_BENCH_USE_FAISS_FLAT) + ConfigureAnnBench(NAME FAISS_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS faiss::faiss) endif() if(RAFT_ANN_BENCH_USE_GGNN) diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h index 4ebd22ec0f..05a50c9803 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h @@ -17,7 +17,10 @@ #include "../common/ann_types.hpp" +#ifndef FMT_HEADER_ONLY +#define FMT_HEADER_ONLY_DEF #define FMT_HEADER_ONLY +#endif #include #include @@ -311,3 +314,7 @@ class FaissFlat : public Faiss { }; } // namespace raft::bench::ann + +#ifdef FMT_HEADER_ONLY_DEF +#undef FMT_HEADER_ONLY +#endif \ No newline at end of file diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/algos.yaml b/python/raft-ann-bench/src/raft-ann-bench/run/algos.yaml index 30abe0dda6..247e2cc4a4 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/algos.yaml +++ b/python/raft-ann-bench/src/raft-ann-bench/run/algos.yaml @@ -1,7 +1,7 @@ -faiss_gpu_ivf_flat: - executable: FAISS_IVF_FLAT_ANN_BENCH - requires_gpu: true faiss_gpu_flat: + executable: FAISS_FLAT_ANN_BENCH + requires_gpu: true +faiss_gpu_ivf_flat: executable: FAISS_IVF_FLAT_ANN_BENCH requires_gpu: true faiss_gpu_ivf_pq: @@ -10,9 +10,15 @@ faiss_gpu_ivf_pq: faiss_gpu_ivf_sq: executable: FAISS_IVF_PQ_ANN_BENCH requires_gpu: true -faiss_gpu_bfknn: - executable: FAISS_BFKNN_ANN_BENCH - requires_gpu: true +faiss_flat: + executable: FAISS_CPU_FLAT_ANN_BENCH + requires_gpu: false +faiss_ivf_flat: + executable: FAISS_CPU_IVF_FLAT_ANN_BENCH + requires_gpu: false +faiss_ivf_pq: + executable: FAISS_CPU_IVF_PQ_ANN_BENCH + requires_gpu: false raft_ivf_flat: executable: RAFT_IVF_FLAT_ANN_BENCH requires_gpu: true @@ -22,6 +28,9 @@ raft_ivf_pq: raft_cagra: executable: RAFT_CAGRA_ANN_BENCH requires_gpu: true +raft_brute_force: + executable: RAFT_BRUTE_FORCE_ANN_BENCH + requires_gpu: true ggnn: executable: GGNN_ANN_BENCH requires_gpu: true From 1e7ba4ffa05a28a12fbbfd2442995cc628ee8f8a Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 12 Sep 2023 17:04:12 -0400 Subject: [PATCH 07/34] Cleaning up includes --- cpp/bench/ann/src/raft/raft_cagra_wrapper.h | 25 ++++++++----------- .../ann/src/raft/raft_ivf_flat_wrapper.h | 1 - cpp/bench/ann/src/raft/raft_ivf_pq_wrapper.h | 4 +-- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/cpp/bench/ann/src/raft/raft_cagra_wrapper.h b/cpp/bench/ann/src/raft/raft_cagra_wrapper.h index 02aa2ea28b..727a6ed830 100644 --- a/cpp/bench/ann/src/raft/raft_cagra_wrapper.h +++ b/cpp/bench/ann/src/raft/raft_cagra_wrapper.h @@ -23,13 +23,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include @@ -107,19 +105,16 @@ class RaftCagra : public ANN { template void RaftCagra::build(const T* dataset, size_t nrow, cudaStream_t) { - switch (raft::spatial::knn::detail::utils::check_pointer_residency(dataset)) { - case raft::spatial::knn::detail::utils::pointer_residency::host_only: { - auto dataset_view = - raft::make_host_matrix_view(dataset, IdxT(nrow), dimension_); - index_.emplace(raft::neighbors::cagra::build(handle_, index_params_, dataset_view)); - return; - } - default: { - auto dataset_view = - raft::make_device_matrix_view(dataset, IdxT(nrow), dimension_); - index_.emplace(raft::neighbors::cagra::build(handle_, index_params_, dataset_view)); - return; - } + if (raft::get_device_for_address(dataset) == -1) { + auto dataset_view = + raft::make_host_matrix_view(dataset, IdxT(nrow), dimension_); + index_.emplace(raft::neighbors::cagra::build(handle_, index_params_, dataset_view)); + return; + } else { + auto dataset_view = + raft::make_device_matrix_view(dataset, IdxT(nrow), dimension_); + index_.emplace(raft::neighbors::cagra::build(handle_, index_params_, dataset_view)); + return; } } diff --git a/cpp/bench/ann/src/raft/raft_ivf_flat_wrapper.h b/cpp/bench/ann/src/raft/raft_ivf_flat_wrapper.h index da457e32f1..b6df7de068 100644 --- a/cpp/bench/ann/src/raft/raft_ivf_flat_wrapper.h +++ b/cpp/bench/ann/src/raft/raft_ivf_flat_wrapper.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/cpp/bench/ann/src/raft/raft_ivf_pq_wrapper.h b/cpp/bench/ann/src/raft/raft_ivf_pq_wrapper.h index 8f1e43a706..1b74dcf975 100644 --- a/cpp/bench/ann/src/raft/raft_ivf_pq_wrapper.h +++ b/cpp/bench/ann/src/raft/raft_ivf_pq_wrapper.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -174,8 +173,7 @@ void RaftIvfPQ::search(const T* queries, raft::runtime::neighbors::ivf_pq::search( handle_, search_params_, *index_, queries_v, candidates.view(), distances_tmp.view()); - if (raft::spatial::knn::detail::utils::check_pointer_residency(dataset_.data_handle()) == - raft::spatial::knn::detail::utils::pointer_residency::device_only) { + if (raft::get_device_for_address(dataset_.data_handle()) >= 0) { auto queries_v = raft::make_device_matrix_view(queries, batch_size, index_->dim()); auto neighbors_v = raft::make_device_matrix_view((IdxT*)neighbors, batch_size, k); From 563b386c210faf5066c8ca292c6d06c928a773e7 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 13 Sep 2023 15:38:56 -0400 Subject: [PATCH 08/34] Explicitly adding spdlog and fmt --- cpp/bench/ann/CMakeLists.txt | 7 +++++ cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h | 9 ------ cpp/cmake/thirdparty/get_faiss.cmake | 10 ++++--- cpp/cmake/thirdparty/get_fmt.cmake | 22 ++++++++++++++ cpp/cmake/thirdparty/get_spdlog.cmake | 33 +++++++++++++++++++++ 5 files changed, 68 insertions(+), 13 deletions(-) create mode 100644 cpp/cmake/thirdparty/get_fmt.cmake create mode 100644 cpp/cmake/thirdparty/get_spdlog.cmake diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index 2b6f1c1520..be2aaae0cd 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -42,6 +42,11 @@ option(RAFT_ANN_BENCH_SINGLE_EXE find_package(Threads REQUIRED) if(BUILD_CPU_ONLY) + + # Include necessary logging dependencies + include(cmake/thirdparty/get_fmt.cmake) + include(cmake/thirdparty/get_spdlog.cmake) + set(RAFT_FAISS_ENABLE_GPU OFF) set(RAFT_ANN_BENCH_USE_FAISS_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT OFF) @@ -141,6 +146,8 @@ function(ConfigureAnnBench) $ -static-libgcc -static-libstdc++ + $<$:fmt::fmt-header-only> + $<$:spdlog::spdlog_header_only> ) set_target_properties( diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h index 05a50c9803..56fc9e9f11 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h @@ -16,11 +16,6 @@ #pragma once #include "../common/ann_types.hpp" - -#ifndef FMT_HEADER_ONLY -#define FMT_HEADER_ONLY_DEF -#define FMT_HEADER_ONLY -#endif #include #include @@ -314,7 +309,3 @@ class FaissFlat : public Faiss { }; } // namespace raft::bench::ann - -#ifdef FMT_HEADER_ONLY_DEF -#undef FMT_HEADER_ONLY -#endif \ No newline at end of file diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index 183dd0007a..b2027ef018 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -37,19 +37,21 @@ function(find_and_configure_faiss) GIT_TAG ${PKG_PINNED_TAG} EXCLUDE_FROM_ALL ${PKG_EXCLUDE_FROM_ALL} OPTIONS - "FAISS_ENABLE_PYTHON OFF" - "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" "FAISS_ENABLE_GPU ${PKG_ENABLE_GPU}" + "FAISS_ENABLE_PYTHON OFF" + "FAISS_OPT_LEVEL avx2" + "FAISS_USE_CUDA_TOOLKIT_STATIC ${CUDA_STATIC_RUNTIME}" "BUILD_TESTING OFF" "CMAKE_MESSAGE_LOG_LEVEL VERBOSE" - "FAISS_USE_CUDA_TOOLKIT_STATIC ${CUDA_STATIC_RUNTIME}" + "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" ) if(TARGET faiss AND NOT TARGET faiss::faiss) add_library(faiss::faiss ALIAS faiss) endif() - if(faiss_ADDED) + + if(faiss_ADDED) rapids_export(BUILD faiss EXPORT_SET faiss-targets GLOBAL_TARGETS faiss diff --git a/cpp/cmake/thirdparty/get_fmt.cmake b/cpp/cmake/thirdparty/get_fmt.cmake new file mode 100644 index 0000000000..c06f8a78bb --- /dev/null +++ b/cpp/cmake/thirdparty/get_fmt.cmake @@ -0,0 +1,22 @@ +# ============================================================================= +# Copyright (c) 2023, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= + +# Use CPM to find or clone fmt +function(find_and_configure_fmt) + + include(${rapids-cmake-dir}/cpm/fmt.cmake) + rapids_cpm_fmt(INSTALL_EXPORT_SET rmm-exports BUILD_EXPORT_SET rmm-exports) +endfunction() + +find_and_configure_fmt() \ No newline at end of file diff --git a/cpp/cmake/thirdparty/get_spdlog.cmake b/cpp/cmake/thirdparty/get_spdlog.cmake new file mode 100644 index 0000000000..7c8f3a4722 --- /dev/null +++ b/cpp/cmake/thirdparty/get_spdlog.cmake @@ -0,0 +1,33 @@ +# ============================================================================= +# Copyright (c) 2021-2023, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= + +# Use CPM to find or clone speedlog +function(find_and_configure_spdlog) + + include(${rapids-cmake-dir}/cpm/spdlog.cmake) + rapids_cpm_spdlog(FMT_OPTION "EXTERNAL_FMT_HO" INSTALL_EXPORT_SET rmm-exports) + rapids_export_package(BUILD spdlog rmm-exports) + + if(spdlog_ADDED) + rapids_export( + BUILD spdlog + EXPORT_SET spdlog + GLOBAL_TARGETS spdlog spdlog_header_only + NAMESPACE spdlog::) + include("${rapids-cmake-dir}/export/find_package_root.cmake") + rapids_export_find_package_root(BUILD spdlog [=[${CMAKE_CURRENT_LIST_DIR}]=] rmm-exports) + endif() +endfunction() + +find_and_configure_spdlog() \ No newline at end of file From 9585f20e6ab3560c70c1d49a7e05512dc26b06ba Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 13 Sep 2023 17:04:00 -0400 Subject: [PATCH 09/34] Using selectors for faiss --- conda/recipes/libraft/build_libraft.sh | 2 +- conda/recipes/libraft/build_libraft_headers.sh | 2 +- conda/recipes/libraft/build_libraft_template.sh | 2 +- conda/recipes/libraft/build_libraft_tests.sh | 2 +- conda/recipes/raft-ann-bench-cpu/meta.yaml | 7 +++++-- conda/recipes/raft-ann-bench/build.sh | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/conda/recipes/libraft/build_libraft.sh b/conda/recipes/libraft/build_libraft.sh index 71e1533893..7d4173e8bb 100644 --- a/conda/recipes/libraft/build_libraft.sh +++ b/conda/recipes/libraft/build_libraft.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash # Copyright (c) 2022-2023, NVIDIA CORPORATION. -./build.sh libraft -v --allgpuarch --compile-lib --build-metrics=compile_lib --incl-cache-stats --no-nvtx +./build.sh libraft --allgpuarch --compile-lib --build-metrics=compile_lib --incl-cache-stats --no-nvtx diff --git a/conda/recipes/libraft/build_libraft_headers.sh b/conda/recipes/libraft/build_libraft_headers.sh index 330ac92ff3..cc3b840e43 100644 --- a/conda/recipes/libraft/build_libraft_headers.sh +++ b/conda/recipes/libraft/build_libraft_headers.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash # Copyright (c) 2022-2023, NVIDIA CORPORATION. -./build.sh libraft -v --allgpuarch --no-nvtx +./build.sh libraft --allgpuarch --no-nvtx diff --git a/conda/recipes/libraft/build_libraft_template.sh b/conda/recipes/libraft/build_libraft_template.sh index 974b0a5b58..bd7719af76 100644 --- a/conda/recipes/libraft/build_libraft_template.sh +++ b/conda/recipes/libraft/build_libraft_template.sh @@ -2,4 +2,4 @@ # Copyright (c) 2022-2023, NVIDIA CORPORATION. # Just building template so we verify it uses libraft.so and fail if it doesn't build -./build.sh template -v +./build.sh template diff --git a/conda/recipes/libraft/build_libraft_tests.sh b/conda/recipes/libraft/build_libraft_tests.sh index 08f0d33485..05a2b59eb0 100644 --- a/conda/recipes/libraft/build_libraft_tests.sh +++ b/conda/recipes/libraft/build_libraft_tests.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash # Copyright (c) 2022-2023, NVIDIA CORPORATION. -./build.sh tests bench-prims -v --allgpuarch --no-nvtx --build-metrics=tests_bench_prims --incl-cache-stats +./build.sh tests bench-prims --allgpuarch --no-nvtx --build-metrics=tests_bench_prims --incl-cache-stats cmake --install cpp/build --component testing diff --git a/conda/recipes/raft-ann-bench-cpu/meta.yaml b/conda/recipes/raft-ann-bench-cpu/meta.yaml index 06737b0497..769fd0be08 100644 --- a/conda/recipes/raft-ann-bench-cpu/meta.yaml +++ b/conda/recipes/raft-ann-bench-cpu/meta.yaml @@ -47,6 +47,8 @@ requirements: host: - glog {{ glog_version }} - matplotlib + - libfaiss-avx2 {{ faiss_version }} # [linux64] + - libfaiss {{ faiss_version }} # [aarch64] - nlohmann_json {{ nlohmann_json_version }} - python - pyyaml @@ -55,13 +57,14 @@ requirements: run: - glog {{ glog_version }} - h5py {{ h5py_version }} + - libfaiss-avx2 {{ faiss_version }} # [linux64] + - libfaiss {{ faiss_version }} # [aarch64] - matplotlib - python - pyyaml - pandas - benchmark - about: home: https://rapids.ai/ license: Apache-2.0 - summary: libraft ann bench + summary: RAFT ANN CPU benchmarks diff --git a/conda/recipes/raft-ann-bench/build.sh b/conda/recipes/raft-ann-bench/build.sh index 9c411774b6..00078792a1 100644 --- a/conda/recipes/raft-ann-bench/build.sh +++ b/conda/recipes/raft-ann-bench/build.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash # Copyright (c) 2023, NVIDIA CORPORATION. -./build.sh bench-ann -v --allgpuarch --no-nvtx --build-metrics=bench_ann --incl-cache-stats +./build.sh bench-ann --allgpuarch --no-nvtx --build-metrics=bench_ann --incl-cache-stats cmake --install cpp/build --component ann_bench From 87e3be0023548bd608c5c4490a3877b9cfb46fe6 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 13 Sep 2023 18:03:05 -0400 Subject: [PATCH 10/34] Adding ability to link against faiss avx lib (only if arch supports it) --- .../conda_build_config.yaml | 3 +++ conda/recipes/raft-ann-bench-cpu/meta.yaml | 4 ++-- .../raft-ann-bench/conda_build_config.yaml | 2 +- conda/recipes/raft-ann-bench/meta.yaml | 2 ++ cpp/bench/ann/CMakeLists.txt | 4 +++- cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h | 7 +++--- cpp/cmake/thirdparty/get_faiss.cmake | 24 ++++++++++++++----- 7 files changed, 32 insertions(+), 14 deletions(-) diff --git a/conda/recipes/raft-ann-bench-cpu/conda_build_config.yaml b/conda/recipes/raft-ann-bench-cpu/conda_build_config.yaml index 0bd424f85b..1f8ac137bf 100644 --- a/conda/recipes/raft-ann-bench-cpu/conda_build_config.yaml +++ b/conda/recipes/raft-ann-bench-cpu/conda_build_config.yaml @@ -10,6 +10,9 @@ sysroot_version: cmake_version: - ">=3.26.4" +faiss_version: + - "1.7.4" + glog_version: - ">=0.6.0" diff --git a/conda/recipes/raft-ann-bench-cpu/meta.yaml b/conda/recipes/raft-ann-bench-cpu/meta.yaml index 769fd0be08..257793ab9b 100644 --- a/conda/recipes/raft-ann-bench-cpu/meta.yaml +++ b/conda/recipes/raft-ann-bench-cpu/meta.yaml @@ -48,7 +48,7 @@ requirements: - glog {{ glog_version }} - matplotlib - libfaiss-avx2 {{ faiss_version }} # [linux64] - - libfaiss {{ faiss_version }} # [aarch64] + - libfaiss {{ faiss_version }} - nlohmann_json {{ nlohmann_json_version }} - python - pyyaml @@ -58,7 +58,7 @@ requirements: - glog {{ glog_version }} - h5py {{ h5py_version }} - libfaiss-avx2 {{ faiss_version }} # [linux64] - - libfaiss {{ faiss_version }} # [aarch64] + - libfaiss {{ faiss_version }} - matplotlib - python - pyyaml diff --git a/conda/recipes/raft-ann-bench/conda_build_config.yaml b/conda/recipes/raft-ann-bench/conda_build_config.yaml index d156f2609b..335ca82e89 100644 --- a/conda/recipes/raft-ann-bench/conda_build_config.yaml +++ b/conda/recipes/raft-ann-bench/conda_build_config.yaml @@ -26,7 +26,7 @@ glog_version: - ">=0.6.0" faiss_version: - - ">=1.7.1" + - "1.7.4" h5py_version: - ">=3.8.0" diff --git a/conda/recipes/raft-ann-bench/meta.yaml b/conda/recipes/raft-ann-bench/meta.yaml index 91d0fdb729..97e297adee 100644 --- a/conda/recipes/raft-ann-bench/meta.yaml +++ b/conda/recipes/raft-ann-bench/meta.yaml @@ -74,6 +74,7 @@ requirements: {% if cuda_major == "11" %} - faiss-proc=*=cuda - libfaiss {{ faiss_version }} + - libfaiss-avx2 {{ faiss_version }} # [linux64] {% endif %} - h5py {{ h5py_version }} - benchmark @@ -96,6 +97,7 @@ requirements: {% if cuda_major == "11" %} - faiss-proc=*=cuda - libfaiss {{ faiss_version }} + - libfaiss-avx2 {{ faiss_version }} # [linux64] {% endif %} - h5py {{ h5py_version }} - benchmark diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index be2aaae0cd..02065cef63 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -138,7 +138,6 @@ function(ConfigureAnnBench) ${BENCH_NAME} PRIVATE raft::raft nlohmann_json::nlohmann_json - $<$:$<$:NCCL::NCCL>> ${ConfigureAnnBench_LINKS} Threads::Threads $<$:${RAFT_CTK_MATH_DEPENDENCIES}> @@ -246,18 +245,21 @@ endif() if(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT) ConfigureAnnBench( NAME FAISS_CPU_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS faiss::faiss + faiss::faiss_avx2 ) endif() if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT) ConfigureAnnBench( NAME FAISS_CPU_IVF_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS faiss::faiss + faiss::faiss_avx2 ) endif() if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_PQ) ConfigureAnnBench( NAME FAISS_CPU_IVF_PQ PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS faiss::faiss + faiss::faiss_avx2 ) endif() diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h index 56fc9e9f11..a96d314e2a 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h @@ -192,10 +192,9 @@ void Faiss::search(const T* queries, float* distances, cudaStream_t stream) const { - static_assert(sizeof(size_t) == sizeof(faiss::Index::idx_t), - "sizes of size_t and faiss::Index::idx_t are different"); - index_->search( - batch_size, queries, k, distances, reinterpret_cast(neighbors)); + static_assert(sizeof(size_t) == sizeof(faiss::idx_t), + "sizes of size_t and faiss::idx_t are different"); + index_->search(batch_size, queries, k, distances, reinterpret_cast(neighbors)); } template diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index b2027ef018..eef68c6d60 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -30,8 +30,16 @@ function(find_and_configure_faiss) set(CPM_DOWNLOAD_faiss ON) endif() + include(cmake/modules/FindAVX.cmake) + + # Link against AVX CPU lib if it exists + set(RAFT_FAISS_OPT_LEVEL "generic") + if(CXX_AVX_FOUND) + set(RAFT_FAISS_OPT_LEVEL "avx2") + endif() + rapids_cpm_find(faiss ${PKG_VERSION} - GLOBAL_TARGETS faiss::faiss + GLOBAL_TARGETS faiss::faiss faiss::faiss_avx2 CPM_ARGS GIT_REPOSITORY ${PKG_REPOSITORY} GIT_TAG ${PKG_PINNED_TAG} @@ -39,7 +47,7 @@ function(find_and_configure_faiss) OPTIONS "FAISS_ENABLE_GPU ${PKG_ENABLE_GPU}" "FAISS_ENABLE_PYTHON OFF" - "FAISS_OPT_LEVEL avx2" + "FAISS_OPT_LEVEL ${RAFT_FAISS_OPT_LEVEL}" "FAISS_USE_CUDA_TOOLKIT_STATIC ${CUDA_STATIC_RUNTIME}" "BUILD_TESTING OFF" "CMAKE_MESSAGE_LOG_LEVEL VERBOSE" @@ -50,18 +58,22 @@ function(find_and_configure_faiss) add_library(faiss::faiss ALIAS faiss) endif() + if(TARGET faiss_avx2 AND NOT TARGET faiss::faiss_avx2) + add_library(faiss::faiss_avx2 ALIAS faiss_avx2) + endif() + if(faiss_ADDED) rapids_export(BUILD faiss EXPORT_SET faiss-targets - GLOBAL_TARGETS faiss + GLOBAL_TARGETS faiss faiss_avx2 NAMESPACE faiss::) endif() # We generate the faiss-config files when we built faiss locally, so always do `find_dependency` rapids_export_package(BUILD OpenMP raft-ann-bench-exports) # faiss uses openMP but doesn't export a need for it - rapids_export_package(BUILD faiss raft-ann-bench-exports GLOBAL_TARGETS faiss::faiss faiss) - rapids_export_package(INSTALL faiss raft-ann-bench-exports GLOBAL_TARGETS faiss::faiss faiss) + rapids_export_package(BUILD faiss raft-ann-bench-exports GLOBAL_TARGETS faiss::faiss faiss faiss::faiss_avx2 faiss_avx2) + rapids_export_package(INSTALL faiss raft-ann-bench-exports GLOBAL_TARGETS faiss::faiss faiss faiss::faiss_avx2 faiss_avx2) # Tell cmake where it can find the generated faiss-config.cmake we wrote. include("${rapids-cmake-dir}/export/find_package_root.cmake") @@ -82,7 +94,7 @@ if(NOT RAFT_FAISS_GIT_REPOSITORY) # set(RAFT_FAISS_GIT_REPOSITORY https://github.com/facebookresearch/faiss.git) endif() -find_and_configure_faiss(VERSION 1.7.0 +find_and_configure_faiss(VERSION 1.7.4 REPOSITORY ${RAFT_FAISS_GIT_REPOSITORY} PINNED_TAG ${RAFT_FAISS_GIT_TAG} BUILD_STATIC_LIBS ${RAFT_USE_FAISS_STATIC} From 74e6a5ddf6bc72d841075a1eea959345552698ab Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 13 Sep 2023 18:03:40 -0400 Subject: [PATCH 11/34] Removing some legacy get_faiss cmake bits --- cpp/cmake/thirdparty/get_faiss.cmake | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index eef68c6d60..d245716994 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -80,20 +80,6 @@ function(find_and_configure_faiss) rapids_export_find_package_root(BUILD faiss [=[${CMAKE_CURRENT_LIST_DIR}]=] raft-ann-bench-exports) endfunction() -if(NOT RAFT_FAISS_GIT_TAG) - # TODO: Remove this once faiss supports FAISS_USE_CUDA_TOOLKIT_STATIC - # (https://github.com/facebookresearch/faiss/pull/2446) - set(RAFT_FAISS_GIT_TAG fea/statically-link-ctk-v1.7.0) - # set(RAFT_FAISS_GIT_TAG bde7c0027191f29c9dadafe4f6e68ca0ee31fb30) -endif() - -if(NOT RAFT_FAISS_GIT_REPOSITORY) - # TODO: Remove this once faiss supports FAISS_USE_CUDA_TOOLKIT_STATIC - # (https://github.com/facebookresearch/faiss/pull/2446) - set(RAFT_FAISS_GIT_REPOSITORY https://github.com/trxcllnt/faiss.git) - # set(RAFT_FAISS_GIT_REPOSITORY https://github.com/facebookresearch/faiss.git) -endif() - find_and_configure_faiss(VERSION 1.7.4 REPOSITORY ${RAFT_FAISS_GIT_REPOSITORY} PINNED_TAG ${RAFT_FAISS_GIT_TAG} From fcd029fead1e294f5c8a282197726133b770ed05 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 13 Sep 2023 19:07:32 -0400 Subject: [PATCH 12/34] Updating faiss cpu to override search params --- cpp/bench/ann/src/faiss/faiss_wrapper.h | 90 +++++++++++++++++++------ 1 file changed, 69 insertions(+), 21 deletions(-) diff --git a/cpp/bench/ann/src/faiss/faiss_wrapper.h b/cpp/bench/ann/src/faiss/faiss_wrapper.h index a426ad2df7..d98f1d347c 100644 --- a/cpp/bench/ann/src/faiss/faiss_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_wrapper.h @@ -105,7 +105,7 @@ class FaissGpu : public ANN { void build(const T* dataset, size_t nrow, cudaStream_t stream = 0) final; - void set_search_param(const AnnSearchParam& param) override; + virtual void set_search_param(const AnnSearchParam& param) {} // TODO: if the number of results is less than k, the remaining elements of 'neighbors' // will be filled with (size_t)-1 @@ -147,6 +147,7 @@ class FaissGpu : public ANN { cudaEvent_t sync_{nullptr}; cudaStream_t faiss_default_stream_{nullptr}; double training_sample_fraction_; + std::unique_ptr search_params_; }; template @@ -181,20 +182,6 @@ void FaissGpu::build(const T* dataset, size_t nrow, cudaStream_t stream) stream_wait(stream); } -template -void FaissGpu::set_search_param(const AnnSearchParam& param) -{ - auto search_param = dynamic_cast(param); - int nprobe = search_param.nprobe; - assert(nprobe <= nlist_); - dynamic_cast(index_.get())->setNumProbes(nprobe); - - if (search_param.refine_ratio > 1.0) { - this->index_refine_ = std::make_unique(this->index_.get()); - this->index_refine_.get()->k_factor = search_param.refine_ratio; - } -} - template void FaissGpu::search(const T* queries, int batch_size, @@ -203,10 +190,14 @@ void FaissGpu::search(const T* queries, float* distances, cudaStream_t stream) const { - static_assert(sizeof(size_t) == sizeof(faiss::Index::idx_t), - "sizes of size_t and faiss::Index::idx_t are different"); - index_->search( - batch_size, queries, k, distances, reinterpret_cast(neighbors)); + static_assert(sizeof(size_t) == sizeof(faiss::idx_t), + "sizes of size_t and faiss::idx_t are different"); + index_->search(batch_size, + queries, + k, + distances, + reinterpret_cast(neighbors), + search_params_.get()); stream_wait(stream); } @@ -245,6 +236,22 @@ class FaissGpuIVFFlat : public FaissGpu { &(this->gpu_resource_), dim, param.nlist, this->metric_type_, config); } + void set_search_param(const typename FaissGpu::AnnSearchParam& param) override + { + auto search_param = dynamic_cast::SearchParam&>(param); + int nprobe = search_param.nprobe; + assert(nprobe <= nlist_); + + faiss::IVFSearchParameters faiss_search_params; + faiss_search_params.nprobe = nprobe; + this->search_params_ = std::make_unique(faiss_search_params); + + if (search_param.refine_ratio > 1.0) { + this->index_refine_ = std::make_unique(this->index_.get()); + this->index_refine_.get()->k_factor = search_param.refine_ratio; + } + } + void save(const std::string& file) const override { this->template save_(file); @@ -280,6 +287,23 @@ class FaissGpuIVFPQ : public FaissGpu { config); } + void set_search_param(const typename FaissGpu::AnnSearchParam& param) override + { + auto search_param = dynamic_cast::SearchParam&>(param); + int nprobe = search_param.nprobe; + assert(nprobe <= nlist_); + + faiss::IVFPQSearchParameters faiss_search_params; + faiss_search_params.nprobe = nprobe; + + this->search_params_ = std::make_unique(faiss_search_params); + + if (search_param.refine_ratio > 1.0) { + this->index_refine_ = std::make_unique(this->index_.get()); + this->index_refine_.get()->k_factor = search_param.refine_ratio; + } + } + void save(const std::string& file) const override { this->template save_(file); @@ -293,6 +317,8 @@ class FaissGpuIVFPQ : public FaissGpu { template class FaissGpuIVFSQ : public FaissGpu { public: + using typename FaissGpu::AnnSearchParam; + using typename FaissGpu::SearchParam; struct BuildParam : public FaissGpu::BuildParam { std::string quantizer_type; }; @@ -315,6 +341,23 @@ class FaissGpuIVFSQ : public FaissGpu { &(this->gpu_resource_), dim, param.nlist, qtype, this->metric_type_, true, config); } + virtual void set_search_param(const typename FaissGpu::AnnSearchParam& param) override + { + auto search_param = dynamic_cast(param); + int nprobe = search_param.nprobe; + assert(nprobe <= nlist_); + + faiss::IVFSearchParameters faiss_search_params; + faiss_search_params.nprobe = nprobe; + + this->search_params_ = std::make_unique(faiss_search_params); + + if (search_param.refine_ratio > 1.0) { + this->index_refine_ = std::make_unique(this->index_.get()); + this->index_refine_.get()->k_factor = search_param.refine_ratio; + } + } + void save(const std::string& file) const override { this->template save_( @@ -339,9 +382,14 @@ class FaissGpuFlat : public FaissGpu { &(this->gpu_resource_), dim, this->metric_type_, config); } - // class FaissGpu is more like a IVF class, so need special treating here - void set_search_param(const typename ANN::AnnSearchParam&) override{}; + void set_search_param(const typename FaissGpu::AnnSearchParam& param) override + { + auto search_param = dynamic_cast::SearchParam&>(param); + int nprobe = search_param.nprobe; + assert(nprobe <= nlist_); + this->search_params_ = std::make_unique(); + } void save(const std::string& file) const override { this->template save_(file); From a56227e25a583dc911cc82200bff8d7dcebd3bd6 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 13 Sep 2023 20:39:37 -0400 Subject: [PATCH 13/34] Trying again. --- cpp/bench/ann/CMakeLists.txt | 25 ++++++++++++++++--------- cpp/cmake/thirdparty/get_faiss.cmake | 21 +++++++++++++++------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index 02065cef63..7017910c24 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -242,41 +242,48 @@ if(RAFT_ANN_BENCH_USE_RAFT_CAGRA) ) endif() +set(RAFT_FAISS_TARGETS faiss::faiss) +if(CXX_AVX_FOUND) + list(APPEND RAFT_FAISS_TARGETS faiss::faiss_avx2) +endif() + if(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT) ConfigureAnnBench( - NAME FAISS_CPU_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS faiss::faiss - faiss::faiss_avx2 + NAME FAISS_CPU_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS + ${RAFT_FAISS_TARGETS} ) endif() if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT) ConfigureAnnBench( - NAME FAISS_CPU_IVF_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS faiss::faiss - faiss::faiss_avx2 + NAME FAISS_CPU_IVF_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS + ${RAFT_FAISS_TARGETS} ) endif() if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_PQ) ConfigureAnnBench( - NAME FAISS_CPU_IVF_PQ PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS faiss::faiss - faiss::faiss_avx2 + NAME FAISS_CPU_IVF_PQ PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS + ${RAFT_FAISS_TARGETS} ) endif() if(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT) ConfigureAnnBench( - NAME FAISS_IVF_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS faiss::faiss + NAME FAISS_IVF_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS ${RAFT_FAISS_TARGETS} ) 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 + NAME FAISS_IVF_PQ PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS ${RAFT_FAISS_TARGETS} ) endif() if(RAFT_ANN_BENCH_USE_FAISS_FLAT) - ConfigureAnnBench(NAME FAISS_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS faiss::faiss) + ConfigureAnnBench( + NAME FAISS_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS ${RAFT_FAISS_TARGETS} + ) endif() if(RAFT_ANN_BENCH_USE_GGNN) diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index d245716994..bb7dc1eb5c 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -33,13 +33,19 @@ function(find_and_configure_faiss) include(cmake/modules/FindAVX.cmake) # Link against AVX CPU lib if it exists + set(RAFT_FAISS_GLOBAL_TARGETS faiss::faiss) + set(RAFT_FAISS_EXPORT_GLOBAL_TARGETS faiss) set(RAFT_FAISS_OPT_LEVEL "generic") if(CXX_AVX_FOUND) set(RAFT_FAISS_OPT_LEVEL "avx2") + list(APPEND RAFT_FAISS_GLOBAL_TARGETS faiss::faiss_avx2) + list(APPEND RAFT_FAISS_EXPORT_GLOBAL_TARGETS faiss_avx2) endif() + + rapids_cpm_find(faiss ${PKG_VERSION} - GLOBAL_TARGETS faiss::faiss faiss::faiss_avx2 + GLOBAL_TARGETS ${RAFT_FAISS_GLOBAL_TARGETS} CPM_ARGS GIT_REPOSITORY ${PKG_REPOSITORY} GIT_TAG ${PKG_PINNED_TAG} @@ -58,22 +64,25 @@ function(find_and_configure_faiss) add_library(faiss::faiss ALIAS faiss) endif() - if(TARGET faiss_avx2 AND NOT TARGET faiss::faiss_avx2) - add_library(faiss::faiss_avx2 ALIAS faiss_avx2) + if(CXX_AVX_FOUND) + + if(TARGET faiss_avx2 AND NOT TARGET faiss::faiss_avx2) + add_library(faiss::faiss_avx2 ALIAS faiss_avx2) + endif() endif() if(faiss_ADDED) rapids_export(BUILD faiss EXPORT_SET faiss-targets - GLOBAL_TARGETS faiss faiss_avx2 + GLOBAL_TARGETS ${RAFT_FAISS_EXPORT_GLOBAL_TARGETS} NAMESPACE faiss::) endif() # We generate the faiss-config files when we built faiss locally, so always do `find_dependency` rapids_export_package(BUILD OpenMP raft-ann-bench-exports) # faiss uses openMP but doesn't export a need for it - rapids_export_package(BUILD faiss raft-ann-bench-exports GLOBAL_TARGETS faiss::faiss faiss faiss::faiss_avx2 faiss_avx2) - rapids_export_package(INSTALL faiss raft-ann-bench-exports GLOBAL_TARGETS faiss::faiss faiss faiss::faiss_avx2 faiss_avx2) + rapids_export_package(BUILD faiss raft-ann-bench-exports GLOBAL_TARGETS ${RAFT_FAISS_GLOBAL_TARGETS} ${RAFT_FAISS_EXPORT_GLOBAL_TARGETS}) + rapids_export_package(INSTALL faiss raft-ann-bench-exports GLOBAL_TARGETS ${RAFT_FAISS_GLOBAL_TARGETS} ${RAFT_FAISS_EXPORT_GLOBAL_TARGETS}) # Tell cmake where it can find the generated faiss-config.cmake we wrote. include("${rapids-cmake-dir}/export/find_package_root.cmake") From 3fcd1e92f1f655a959f61490d62e518f52cb6b08 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 13 Sep 2023 20:40:31 -0400 Subject: [PATCH 14/34] Making libfaiss installs either or --- conda/recipes/raft-ann-bench-cpu/meta.yaml | 4 ++-- conda/recipes/raft-ann-bench/meta.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conda/recipes/raft-ann-bench-cpu/meta.yaml b/conda/recipes/raft-ann-bench-cpu/meta.yaml index 257793ab9b..769fd0be08 100644 --- a/conda/recipes/raft-ann-bench-cpu/meta.yaml +++ b/conda/recipes/raft-ann-bench-cpu/meta.yaml @@ -48,7 +48,7 @@ requirements: - glog {{ glog_version }} - matplotlib - libfaiss-avx2 {{ faiss_version }} # [linux64] - - libfaiss {{ faiss_version }} + - libfaiss {{ faiss_version }} # [aarch64] - nlohmann_json {{ nlohmann_json_version }} - python - pyyaml @@ -58,7 +58,7 @@ requirements: - glog {{ glog_version }} - h5py {{ h5py_version }} - libfaiss-avx2 {{ faiss_version }} # [linux64] - - libfaiss {{ faiss_version }} + - libfaiss {{ faiss_version }} # [aarch64] - matplotlib - python - pyyaml diff --git a/conda/recipes/raft-ann-bench/meta.yaml b/conda/recipes/raft-ann-bench/meta.yaml index 97e297adee..b86fc79e14 100644 --- a/conda/recipes/raft-ann-bench/meta.yaml +++ b/conda/recipes/raft-ann-bench/meta.yaml @@ -73,7 +73,7 @@ requirements: # Temporarily ignore faiss benchmarks on CUDA 12 because packages do not exist yet {% if cuda_major == "11" %} - faiss-proc=*=cuda - - libfaiss {{ faiss_version }} + - libfaiss {{ faiss_version }} # [aarch64] - libfaiss-avx2 {{ faiss_version }} # [linux64] {% endif %} - h5py {{ h5py_version }} @@ -96,7 +96,7 @@ requirements: # Temporarily ignore faiss benchmarks on CUDA 12 because packages do not exist yet {% if cuda_major == "11" %} - faiss-proc=*=cuda - - libfaiss {{ faiss_version }} + - libfaiss {{ faiss_version }} # [aarch64] - libfaiss-avx2 {{ faiss_version }} # [linux64] {% endif %} - h5py {{ h5py_version }} From 1ec75baa8fc21f595a4f11377ccae923acaca45a Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 25 Sep 2023 15:31:26 -0400 Subject: [PATCH 15/34] Using consistent naming for faiss algos --- cpp/bench/ann/CMakeLists.txt | 40 +++--- .../ann/src/faiss/faiss_cpu_benchmark.cpp | 32 ++--- cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h | 77 ++++------- ...ss_benchmark.cu => faiss_gpu_benchmark.cu} | 2 +- .../{faiss_wrapper.h => faiss_gpu_wrapper.h} | 23 ++-- .../src/raft-ann-bench/run/algos.yaml | 8 +- .../raft-ann-bench/run/conf/deep-100M.json | 28 ++-- .../src/raft-ann-bench/run/conf/deep-1B.json | 4 +- .../run/conf/deep-image-96-inner.json | 108 +++++++-------- .../run/conf/fashion-mnist-784-euclidean.json | 108 +++++++-------- .../run/conf/gist-960-euclidean.json | 108 +++++++-------- .../run/conf/glove-100-angular.json | 108 +++++++-------- .../run/conf/glove-100-inner.json | 124 +++++++++--------- .../run/conf/glove-50-angular.json | 108 +++++++-------- .../run/conf/lastfm-65-angular.json | 108 +++++++-------- .../run/conf/mnist-784-euclidean.json | 108 +++++++-------- .../run/conf/nytimes-256-angular.json | 108 +++++++-------- .../run/conf/sift-128-euclidean.json | 72 +++++----- 18 files changed, 625 insertions(+), 649 deletions(-) rename cpp/bench/ann/src/faiss/{faiss_benchmark.cu => faiss_gpu_benchmark.cu} (99%) rename cpp/bench/ann/src/faiss/{faiss_wrapper.h => faiss_gpu_wrapper.h} (96%) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index 7017910c24..4c294c6e0b 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -15,9 +15,9 @@ # ################################################################################################## # * benchmark options ------------------------------------------------------------------------------ -option(RAFT_ANN_BENCH_USE_FAISS_FLAT "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_FAISS_GPU_FLAT "Include faiss' brute-force knn algorithm in benchmark" ON) +option(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_FLAT "Include faiss' ivf flat algorithm in benchmark" ON) +option(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_PQ "Include faiss' ivf pq algorithm in benchmark" ON) option(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT "Include faiss' cpu brute-force knn algorithm in benchmark" ON ) @@ -48,9 +48,9 @@ if(BUILD_CPU_ONLY) include(cmake/thirdparty/get_spdlog.cmake) set(RAFT_FAISS_ENABLE_GPU OFF) - set(RAFT_ANN_BENCH_USE_FAISS_FLAT OFF) - set(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT OFF) - set(RAFT_ANN_BENCH_USE_FAISS_IVF_PQ OFF) + set(RAFT_ANN_BENCH_USE_FAISS_GPU_FLAT OFF) + set(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_FLAT OFF) + set(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_PQ OFF) set(RAFT_ANN_BENCH_USE_RAFT_IVF_FLAT OFF) set(RAFT_ANN_BENCH_USE_RAFT_IVF_PQ OFF) set(RAFT_ANN_BENCH_USE_RAFT_CAGRA OFF) @@ -60,17 +60,17 @@ else() # https://github.com/rapidsai/raft/issues/1627 if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL 12.0.0) set(RAFT_FAISS_ENABLE_GPU OFF) - set(RAFT_ANN_BENCH_USE_FAISS_FLAT OFF) - set(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT OFF) - set(RAFT_ANN_BENCH_USE_FAISS_IVF_PQ OFF) + set(RAFT_ANN_BENCH_USE_FAISS_GPU_FLAT OFF) + set(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_FLAT OFF) + set(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_PQ OFF) else() set(RAFT_FAISS_ENABLE_GPU ON) endif() endif() set(RAFT_ANN_BENCH_USE_FAISS OFF) -if(RAFT_ANN_BENCH_USE_FAISS_FLAT - OR RAFT_ANN_BENCH_USE_FAISS_IVFPQ +if(RAFT_ANN_BENCH_USE_FAISS_GPU_FLAT + OR RAFT_ANN_BENCH_USE_FAISS_GPU_IVFPQ OR RAFT_ANN_BENCH_USE_FAISS_IFFLAT OR RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT OR RAFT_ANN_BENCH_USE_FAISS_CPU_IVFPQ @@ -243,8 +243,8 @@ if(RAFT_ANN_BENCH_USE_RAFT_CAGRA) endif() set(RAFT_FAISS_TARGETS faiss::faiss) -if(CXX_AVX_FOUND) - list(APPEND RAFT_FAISS_TARGETS faiss::faiss_avx2) +if(TARGET faiss::faiss_avx2) + set(RAFT_FAISS_TARGETS faiss::faiss_avx2) endif() if(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT) @@ -268,21 +268,23 @@ if(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_PQ) ) endif() -if(RAFT_ANN_BENCH_USE_FAISS_IVF_FLAT) +if(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_FLAT) ConfigureAnnBench( - NAME FAISS_IVF_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS ${RAFT_FAISS_TARGETS} + NAME FAISS_GPU_IVF_FLAT PATH bench/ann/src/faiss/faiss_gpu_benchmark.cu LINKS + ${RAFT_FAISS_TARGETS} ) endif() -if(RAFT_ANN_BENCH_USE_FAISS_IVF_PQ) +if(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_PQ) ConfigureAnnBench( - NAME FAISS_IVF_PQ PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS ${RAFT_FAISS_TARGETS} + NAME FAISS_GPU_IVF_PQ PATH bench/ann/src/faiss/faiss_gpu_benchmark.cu LINKS + ${RAFT_FAISS_TARGETS} ) endif() -if(RAFT_ANN_BENCH_USE_FAISS_FLAT) +if(RAFT_ANN_BENCH_USE_FAISS_GPU_FLAT) ConfigureAnnBench( - NAME FAISS_FLAT PATH bench/ann/src/faiss/faiss_benchmark.cu LINKS ${RAFT_FAISS_TARGETS} + NAME FAISS_GPU_FLAT PATH bench/ann/src/faiss/faiss_gpu_benchmark.cu LINKS ${RAFT_FAISS_TARGETS} ) endif() diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp index 7d1ba726bb..0552e8fa36 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp +++ b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp @@ -31,7 +31,7 @@ namespace raft::bench::ann { template void parse_base_build_param(const nlohmann::json& conf, - typename raft::bench::ann::Faiss::BuildParam& param) + typename raft::bench::ann::FaissCpu::BuildParam& param) { param.nlist = conf.at("nlist"); if (conf.contains("ratio")) { param.ratio = conf.at("ratio"); } @@ -39,14 +39,14 @@ void parse_base_build_param(const nlohmann::json& conf, template void parse_build_param(const nlohmann::json& conf, - typename raft::bench::ann::FaissIVFFlat::BuildParam& param) + typename raft::bench::ann::FaissCpuIVFFlat::BuildParam& param) { parse_base_build_param(conf, param); } template void parse_build_param(const nlohmann::json& conf, - typename raft::bench::ann::FaissIVFPQ::BuildParam& param) + typename raft::bench::ann::FaissCpuIVFPQ::BuildParam& param) { parse_base_build_param(conf, param); param.M = conf.at("M"); @@ -64,7 +64,7 @@ void parse_build_param(const nlohmann::json& conf, template void parse_build_param(const nlohmann::json& conf, - typename raft::bench::ann::FaissIVFSQ::BuildParam& param) + typename raft::bench::ann::FaissCpuIVFSQ::BuildParam& param) { parse_base_build_param(conf, param); param.quantizer_type = conf.at("quantizer_type"); @@ -72,7 +72,7 @@ void parse_build_param(const nlohmann::json& conf, template void parse_search_param(const nlohmann::json& conf, - typename raft::bench::ann::Faiss::SearchParam& param) + typename raft::bench::ann::FaissCpu::SearchParam& param) { param.nprobe = conf.at("nprobe"); if (conf.contains("refine_ratio")) { param.refine_ratio = conf.at("refine_ratio"); } @@ -115,14 +115,14 @@ std::unique_ptr> create_algo(const std::string& algo, if constexpr (std::is_same_v) { raft::bench::ann::Metric metric = parse_metric(distance); - if (algo == "faiss_ivf_flat") { - ann = make_algo(metric, dim, conf, dev_list); - } else if (algo == "faiss_ivf_pq") { - ann = make_algo(metric, dim, conf); - } else if (algo == "faiss_ivf_sq") { - ann = make_algo(metric, dim, conf); - } else if (algo == "faiss_flat") { - ann = std::make_unique>(metric, dim); + if (algo == "faiss_gpu_ivf_flat") { + ann = make_algo(metric, dim, conf, dev_list); + } else if (algo == "faiss_gpu_ivf_pq") { + ann = make_algo(metric, dim, conf); + } else if (algo == "faiss_gpu_ivf_sq") { + ann = make_algo(metric, dim, conf); + } else if (algo == "faiss_gpu_flat") { + ann = std::make_unique>(metric, dim); } } @@ -137,11 +137,11 @@ template std::unique_ptr::AnnSearchParam> create_search_param( const std::string& algo, const nlohmann::json& conf) { - if (algo == "faiss_ivf_flat" || algo == "faiss_ivf_pq" || algo == "faiss_ivf_sq") { - auto param = std::make_unique::SearchParam>(); + if (algo == "faiss_gpu_ivf_flat" || algo == "faiss_gpu_ivf_pq" || algo == "faiss_gpu_ivf_sq") { + auto param = std::make_unique::SearchParam>(); parse_search_param(conf, *param); return param; - } else if (algo == "faiss_flat") { + } else if (algo == "faiss_gpu_flat") { auto param = std::make_unique::AnnSearchParam>(); return param; } diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h index a96d314e2a..3a78ca1724 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -44,32 +43,12 @@ faiss::MetricType parse_metric_type(raft::bench::ann::Metric metric) throw std::runtime_error("faiss supports only metric type of inner product and L2"); } } - -// note BLAS library can still use multi-threading, and -// setting environment variable like OPENBLAS_NUM_THREADS can control it -class OmpSingleThreadScope { - public: - OmpSingleThreadScope() - { - max_threads_ = omp_get_max_threads(); - omp_set_num_threads(1); - } - ~OmpSingleThreadScope() - { - // the best we can do - omp_set_num_threads(max_threads_); - } - - private: - int max_threads_; -}; - } // namespace namespace raft::bench::ann { template -class Faiss : public ANN { +class FaissCpu : public ANN { public: using typename ANN::AnnSearchParam; struct SearchParam : public AnnSearchParam { @@ -82,7 +61,7 @@ class Faiss : public ANN { int ratio = 2; }; - Faiss(Metric metric, int dim, const BuildParam& param) + FaissCpu(Metric metric, int dim, const BuildParam& param) : ANN(metric, dim), metric_type_(parse_metric_type(metric)), nlist_{param.nlist}, @@ -91,7 +70,7 @@ class Faiss : public ANN { static_assert(std::is_same_v, "faiss support only float type"); } - virtual ~Faiss() noexcept {} + virtual ~FaissCpu() noexcept {} void build(const T* dataset, size_t nrow, cudaStream_t stream = 0) final; @@ -140,9 +119,8 @@ class Faiss : public ANN { }; template -void Faiss::build(const T* dataset, size_t nrow, cudaStream_t stream) +void FaissCpu::build(const T* dataset, size_t nrow, cudaStream_t stream) { - OmpSingleThreadScope omp_single_thread; auto index_ivf = dynamic_cast(index_.get()); if (index_ivf != nullptr) { // set the min/max training size for clustering to use the whole provided training set. @@ -171,7 +149,7 @@ void Faiss::build(const T* dataset, size_t nrow, cudaStream_t stream) } template -void Faiss::set_search_param(const AnnSearchParam& param) +void FaissCpu::set_search_param(const AnnSearchParam& param) { auto search_param = dynamic_cast(param); int nprobe = search_param.nprobe; @@ -185,12 +163,12 @@ void Faiss::set_search_param(const AnnSearchParam& param) } template -void Faiss::search(const T* queries, - int batch_size, - int k, - size_t* neighbors, - float* distances, - cudaStream_t stream) const +void FaissCpu::search(const T* queries, + int batch_size, + int k, + size_t* neighbors, + float* distances, + cudaStream_t stream) const { static_assert(sizeof(size_t) == sizeof(faiss::idx_t), "sizes of size_t and faiss::idx_t are different"); @@ -199,26 +177,24 @@ void Faiss::search(const T* queries, template template -void Faiss::save_(const std::string& file) const +void FaissCpu::save_(const std::string& file) const { - OmpSingleThreadScope omp_single_thread; faiss::write_index(index_.get(), file.c_str()); } template template -void Faiss::load_(const std::string& file) +void FaissCpu::load_(const std::string& file) { - OmpSingleThreadScope omp_single_thread; index_ = std::unique_ptr(dynamic_cast(faiss::read_index(file.c_str()))); } template -class FaissIVFFlat : public Faiss { +class FaissCpuIVFFlat : public FaissCpu { public: - using typename Faiss::BuildParam; + using typename FaissCpu::BuildParam; - FaissIVFFlat(Metric metric, int dim, const BuildParam& param) : Faiss(metric, dim, param) + FaissCpuIVFFlat(Metric metric, int dim, const BuildParam& param) : FaissCpu(metric, dim, param) { this->init_quantizer(dim); this->index_ = std::make_unique( @@ -233,15 +209,15 @@ class FaissIVFFlat : public Faiss { }; template -class FaissIVFPQ : public Faiss { +class FaissCpuIVFPQ : public FaissCpu { public: - struct BuildParam : public Faiss::BuildParam { + struct BuildParam : public FaissCpu::BuildParam { int M; int bitsPerCode; bool usePrecomputed; }; - FaissIVFPQ(Metric metric, int dim, const BuildParam& param) : Faiss(metric, dim, param) + FaissCpuIVFPQ(Metric metric, int dim, const BuildParam& param) : FaissCpu(metric, dim, param) { this->init_quantizer(dim); this->index_ = std::make_unique( @@ -256,13 +232,13 @@ class FaissIVFPQ : public Faiss { }; template -class FaissIVFSQ : public Faiss { +class FaissCpuIVFSQ : public FaissCpu { public: - struct BuildParam : public Faiss::BuildParam { + struct BuildParam : public FaissCpu::BuildParam { std::string quantizer_type; }; - FaissIVFSQ(Metric metric, int dim, const BuildParam& param) : Faiss(metric, dim, param) + FaissCpuIVFSQ(Metric metric, int dim, const BuildParam& param) : FaissCpu(metric, dim, param) { faiss::ScalarQuantizer::QuantizerType qtype; if (param.quantizer_type == "fp16") { @@ -270,7 +246,7 @@ class FaissIVFSQ : public Faiss { } else if (param.quantizer_type == "int8") { qtype = faiss::ScalarQuantizer::QT_8bit; } else { - throw std::runtime_error("FaissIVFSQ supports only fp16 and int8 but got " + + throw std::runtime_error("FaissCpuIVFSQ supports only fp16 and int8 but got " + param.quantizer_type); } @@ -290,14 +266,15 @@ class FaissIVFSQ : public Faiss { }; template -class FaissFlat : public Faiss { +class FaissCpuFlat : public FaissCpu { public: - FaissFlat(Metric metric, int dim) : Faiss(metric, dim, typename Faiss::BuildParam{}) + FaissCpuFlat(Metric metric, int dim) + : FaissCpu(metric, dim, typename FaissCpu::BuildParam{}) { this->index_ = std::make_unique(dim, this->metric_type_); } - // class Faiss is more like a IVF class, so need special treating here + // class FaissCpu is more like a IVF class, so need special treating here void set_search_param(const typename ANN::AnnSearchParam&) override{}; void save(const std::string& file) const override diff --git a/cpp/bench/ann/src/faiss/faiss_benchmark.cu b/cpp/bench/ann/src/faiss/faiss_gpu_benchmark.cu similarity index 99% rename from cpp/bench/ann/src/faiss/faiss_benchmark.cu rename to cpp/bench/ann/src/faiss/faiss_gpu_benchmark.cu index 56885cce5c..8b04ba1980 100644 --- a/cpp/bench/ann/src/faiss/faiss_benchmark.cu +++ b/cpp/bench/ann/src/faiss/faiss_gpu_benchmark.cu @@ -24,7 +24,7 @@ #include "../common/ann_types.hpp" #undef WARP_SIZE -#include "faiss_wrapper.h" +#include "faiss_gpu_wrapper.h" #define JSON_DIAGNOSTICS 1 #include diff --git a/cpp/bench/ann/src/faiss/faiss_wrapper.h b/cpp/bench/ann/src/faiss/faiss_gpu_wrapper.h similarity index 96% rename from cpp/bench/ann/src/faiss/faiss_wrapper.h rename to cpp/bench/ann/src/faiss/faiss_gpu_wrapper.h index d98f1d347c..6144f89bd4 100644 --- a/cpp/bench/ann/src/faiss/faiss_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_gpu_wrapper.h @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#pragma once +#ifndef FAISS_WRAPPER_H_ +#define FAISS_WRAPPER_H_ + #include "../common/ann_types.hpp" #include @@ -105,7 +107,7 @@ class FaissGpu : public ANN { void build(const T* dataset, size_t nrow, cudaStream_t stream = 0) final; - virtual void set_search_param(const AnnSearchParam& param) {} + virtual void set_search_param(const FaissGpu::AnnSearchParam& param) {} // TODO: if the number of results is less than k, the remaining elements of 'neighbors' // will be filled with (size_t)-1 @@ -192,12 +194,7 @@ void FaissGpu::search(const T* queries, { static_assert(sizeof(size_t) == sizeof(faiss::idx_t), "sizes of size_t and faiss::idx_t are different"); - index_->search(batch_size, - queries, - k, - distances, - reinterpret_cast(neighbors), - search_params_.get()); + index_->search(batch_size, queries, k, distances, reinterpret_cast(neighbors)); stream_wait(stream); } @@ -317,8 +314,6 @@ class FaissGpuIVFPQ : public FaissGpu { template class FaissGpuIVFSQ : public FaissGpu { public: - using typename FaissGpu::AnnSearchParam; - using typename FaissGpu::SearchParam; struct BuildParam : public FaissGpu::BuildParam { std::string quantizer_type; }; @@ -341,9 +336,9 @@ class FaissGpuIVFSQ : public FaissGpu { &(this->gpu_resource_), dim, param.nlist, qtype, this->metric_type_, true, config); } - virtual void set_search_param(const typename FaissGpu::AnnSearchParam& param) override + void set_search_param(const typename FaissGpu::AnnSearchParam& param) override { - auto search_param = dynamic_cast(param); + auto search_param = dynamic_cast::SearchParam&>(param); int nprobe = search_param.nprobe; assert(nprobe <= nlist_); @@ -381,7 +376,6 @@ class FaissGpuFlat : public FaissGpu { this->index_ = std::make_unique( &(this->gpu_resource_), dim, this->metric_type_, config); } - void set_search_param(const typename FaissGpu::AnnSearchParam& param) override { auto search_param = dynamic_cast::SearchParam&>(param); @@ -390,6 +384,7 @@ class FaissGpuFlat : public FaissGpu { this->search_params_ = std::make_unique(); } + void save(const std::string& file) const override { this->template save_(file); @@ -401,3 +396,5 @@ class FaissGpuFlat : public FaissGpu { }; } // namespace raft::bench::ann + +#endif \ No newline at end of file diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/algos.yaml b/python/raft-ann-bench/src/raft-ann-bench/run/algos.yaml index 247e2cc4a4..f4f928505f 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/algos.yaml +++ b/python/raft-ann-bench/src/raft-ann-bench/run/algos.yaml @@ -1,14 +1,14 @@ faiss_gpu_flat: - executable: FAISS_FLAT_ANN_BENCH + executable: FAISS_GPU_FLAT_ANN_BENCH requires_gpu: true faiss_gpu_ivf_flat: - executable: FAISS_IVF_FLAT_ANN_BENCH + executable: FAISS_GPU_IVF_FLAT_ANN_BENCH requires_gpu: true faiss_gpu_ivf_pq: - executable: FAISS_IVF_PQ_ANN_BENCH + executable: FAISS_GPU_IVF_PQ_ANN_BENCH requires_gpu: true faiss_gpu_ivf_sq: - executable: FAISS_IVF_PQ_ANN_BENCH + executable: FAISS_GPU_IVF_PQ_ANN_BENCH requires_gpu: true faiss_flat: executable: FAISS_CPU_FLAT_ANN_BENCH diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-100M.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-100M.json index bc77b522a8..3885876022 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-100M.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-100M.json @@ -87,10 +87,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist50K", + "name": "faiss_gpu_ivf_flat.nlist50K", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist":50000}, - "file": "deep-100M/faiss_ivf_flat/nlist50K", + "file": "deep-100M/faiss_gpu_ivf_flat/nlist50K", "search_params": [ {"nprobe":20}, {"nprobe":30}, @@ -103,10 +103,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist100K", + "name": "faiss_gpu_ivf_flat.nlist100K", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist":100000}, - "file": "deep-100M/faiss_ivf_flat/nlist100K", + "file": "deep-100M/faiss_gpu_ivf_flat/nlist100K", "search_params": [ {"nprobe":20}, {"nprobe":30}, @@ -119,10 +119,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist200K", + "name": "faiss_gpu_ivf_flat.nlist200K", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist":200000}, - "file": "deep-100M/faiss_ivf_flat/nlist200K", + "file": "deep-100M/faiss_gpu_ivf_flat/nlist200K", "search_params": [ {"nprobe":20}, {"nprobe":30}, @@ -135,10 +135,10 @@ ] }, { - "name": "faiss_ivf_pq.M48-nlist16K", + "name": "faiss_gpu_ivf_pq.M48-nlist16K", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":16384, "M":48}, - "file": "deep-100M/faiss_ivf_pq/M48-nlist16K", + "file": "deep-100M/faiss_gpu_ivf_pq/M48-nlist16K", "search_params": [ {"nprobe":10}, {"nprobe":20}, @@ -151,10 +151,10 @@ ] }, { - "name": "faiss_ivf_pq.M48-nlist50K", + "name": "faiss_gpu_ivf_pq.M48-nlist50K", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":50000, "M":48}, - "file": "deep-100M/faiss_ivf_pq/M48-nlist50K", + "file": "deep-100M/faiss_gpu_ivf_pq/M48-nlist50K", "search_params": [ {"nprobe":20}, {"nprobe":30}, @@ -167,10 +167,10 @@ ] }, { - "name": "faiss_ivf_pq.M48-nlist100K", + "name": "faiss_gpu_ivf_pq.M48-nlist100K", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":100000, "M":48}, - "file": "deep-100M/faiss_ivf_pq/M48-nlist100K", + "file": "deep-100M/faiss_gpu_ivf_pq/M48-nlist100K", "search_params": [ {"nprobe":20}, {"nprobe":30}, @@ -183,10 +183,10 @@ ] }, { - "name": "faiss_ivf_pq.M48-nlist200K", + "name": "faiss_gpu_ivf_pq.M48-nlist200K", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":200000, "M":48}, - "file": "deep-100M/faiss_ivf_pq/M48-nlist200K", + "file": "deep-100M/faiss_gpu_ivf_pq/M48-nlist200K", "search_params": [ {"nprobe":20}, {"nprobe":30}, diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-1B.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-1B.json index 632d2f7308..e5190e073e 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-1B.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-1B.json @@ -14,10 +14,10 @@ "index": [ { - "name": "faiss_ivf_pq.M48-nlist50K", + "name": "faiss_gpu_ivf_pq.M48-nlist50K", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":50000, "M":48}, - "file": "deep-1B/faiss_ivf_pq/M48-nlist50K", + "file": "deep-1B/faiss_gpu_ivf_pq/M48-nlist50K", "search_params": [ {"nprobe":1}, {"nprobe":5}, diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-image-96-inner.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-image-96-inner.json index f1c033e415..79610e4f5b 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-image-96-inner.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/deep-image-96-inner.json @@ -105,12 +105,12 @@ "search_result_file": "result/deep-image-96-inner/raft_bfknn/bfknn" }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 1024 }, - "file": "index/deep-image-96-inner/faiss_ivf_flat/nlist1024", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_flat/nlist1024", "search_params": [ { "nprobe": 1 @@ -137,15 +137,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_flat/nlist1024" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_flat/nlist1024" }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 2048 }, - "file": "index/deep-image-96-inner/faiss_ivf_flat/nlist2048", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_flat/nlist2048", "search_params": [ { "nprobe": 1 @@ -172,15 +172,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_flat/nlist2048" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_flat/nlist2048" }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 4096 }, - "file": "index/deep-image-96-inner/faiss_ivf_flat/nlist4096", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_flat/nlist4096", "search_params": [ { "nprobe": 1 @@ -207,15 +207,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_flat/nlist4096" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_flat/nlist4096" }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 8192 }, - "file": "index/deep-image-96-inner/faiss_ivf_flat/nlist8192", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_flat/nlist8192", "search_params": [ { "nprobe": 1 @@ -242,15 +242,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_flat/nlist8192" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_flat/nlist8192" }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 16384 }, - "file": "index/deep-image-96-inner/faiss_ivf_flat/nlist16384", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_flat/nlist16384", "search_params": [ { "nprobe": 1 @@ -280,10 +280,10 @@ "nprobe": 2000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_flat/nlist16384" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_flat/nlist16384" }, { - "name": "faiss_ivf_pq.M64-nlist1024", + "name": "faiss_gpu_ivf_pq.M64-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -291,7 +291,7 @@ "useFloat16": true, "usePrecomputed": true }, - "file": "index/deep-image-96-inner/faiss_ivf_pq/M64-nlist1024", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_pq/M64-nlist1024", "search_params": [ {"nprobe": 10}, {"nprobe": 50}, @@ -300,10 +300,10 @@ {"nprobe": 500}, {"nprobe": 1000} ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_pq.M64-nlist1024.noprecomp", + "name": "faiss_gpu_ivf_pq.M64-nlist1024.noprecomp", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -311,7 +311,7 @@ "useFloat16": true, "usePrecomputed": false }, - "file": "index/deep-image-96-inner/faiss_ivf_pq/M64-nlist1024.noprecomp", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_pq/M64-nlist1024.noprecomp", "search_params": [ {"nprobe": 10}, {"nprobe": 50}, @@ -320,16 +320,16 @@ {"nprobe": 500}, {"nprobe": 1000} ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "fp16" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist1024-fp16", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ { "nprobe": 1 @@ -356,16 +356,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist1024-fp16" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist1024-fp16" }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "fp16" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist2048-fp16", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ { "nprobe": 1 @@ -392,16 +392,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist2048-fp16" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist2048-fp16" }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "fp16" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist4096-fp16", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ { "nprobe": 1 @@ -428,16 +428,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist4096-fp16" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist4096-fp16" }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "fp16" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist8192-fp16", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ { "nprobe": 1 @@ -464,16 +464,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist8192-fp16" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist8192-fp16" }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "fp16" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist16384-fp16", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ { "nprobe": 1 @@ -503,16 +503,16 @@ "nprobe": 2000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist16384-fp16" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist16384-fp16" }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "int8" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist1024-int8", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ { "nprobe": 1 @@ -539,16 +539,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist1024-int8" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist1024-int8" }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "int8" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist2048-int8", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ { "nprobe": 1 @@ -575,16 +575,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist2048-int8" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist2048-int8" }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "int8" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist4096-int8", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ { "nprobe": 1 @@ -611,16 +611,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist4096-int8" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist4096-int8" }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "int8" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist8192-int8", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ { "nprobe": 1 @@ -647,16 +647,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist8192-int8" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist8192-int8" }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "int8" }, - "file": "index/deep-image-96-inner/faiss_ivf_sq/nlist16384-int8", + "file": "index/deep-image-96-inner/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ { "nprobe": 1 @@ -686,17 +686,17 @@ "nprobe": 2000 } ], - "search_result_file": "result/deep-image-96-inner/faiss_ivf_sq/nlist16384-int8" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_ivf_sq/nlist16384-int8" }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "index/deep-image-96-inner/faiss_flat/flat", + "file": "index/deep-image-96-inner/faiss_gpu_flat/flat", "search_params": [ {} ], - "search_result_file": "result/deep-image-96-inner/faiss_flat/flat" + "search_result_file": "result/deep-image-96-inner/faiss_gpu_flat/flat" }, { diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/fashion-mnist-784-euclidean.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/fashion-mnist-784-euclidean.json index 65f28fc81a..25d9751497 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/fashion-mnist-784-euclidean.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/fashion-mnist-784-euclidean.json @@ -104,12 +104,12 @@ "search_result_file": "result/fashion-mnist-784-euclidean/raft_bfknn/bfknn" }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 1024 }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist1024", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist1024", "search_params": [ { "nprobe": 1 @@ -136,15 +136,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist1024" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist1024" }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 2048 }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist2048", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist2048", "search_params": [ { "nprobe": 1 @@ -171,15 +171,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist2048" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist2048" }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 4096 }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist4096", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist4096", "search_params": [ { "nprobe": 1 @@ -206,15 +206,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist4096" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist4096" }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 8192 }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist8192", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist8192", "search_params": [ { "nprobe": 1 @@ -241,15 +241,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist8192" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist8192" }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 16384 }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist16384", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist16384", "search_params": [ { "nprobe": 1 @@ -279,10 +279,10 @@ "nprobe": 2000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_flat/nlist16384" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_flat/nlist16384" }, { - "name": "faiss_ivf_pq.M64-nlist1024", + "name": "faiss_gpu_ivf_pq.M64-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -290,7 +290,7 @@ "useFloat16": true, "usePrecomputed": true }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_pq/M64-nlist1024", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_pq/M64-nlist1024", "search_params": [ { "nprobe": 10 @@ -311,10 +311,10 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_pq.M64-nlist1024.noprecomp", + "name": "faiss_gpu_ivf_pq.M64-nlist1024.noprecomp", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -322,7 +322,7 @@ "useFloat16": true, "usePrecomputed": false }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_pq/M64-nlist1024.noprecomp", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_pq/M64-nlist1024.noprecomp", "search_params": [ { "nprobe": 10 @@ -343,16 +343,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "fp16" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist1024-fp16", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ { "nprobe": 1 @@ -379,16 +379,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist1024-fp16" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist1024-fp16" }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "fp16" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist2048-fp16", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ { "nprobe": 1 @@ -415,16 +415,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist2048-fp16" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist2048-fp16" }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "fp16" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist4096-fp16", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ { "nprobe": 1 @@ -451,16 +451,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist4096-fp16" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist4096-fp16" }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "fp16" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist8192-fp16", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ { "nprobe": 1 @@ -487,16 +487,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist8192-fp16" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist8192-fp16" }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "fp16" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist16384-fp16", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ { "nprobe": 1 @@ -526,16 +526,16 @@ "nprobe": 2000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist16384-fp16" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist16384-fp16" }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "int8" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist1024-int8", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ { "nprobe": 1 @@ -562,16 +562,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist1024-int8" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist1024-int8" }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "int8" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist2048-int8", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ { "nprobe": 1 @@ -598,16 +598,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist2048-int8" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist2048-int8" }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "int8" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist4096-int8", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ { "nprobe": 1 @@ -634,16 +634,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist4096-int8" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist4096-int8" }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "int8" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist8192-int8", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ { "nprobe": 1 @@ -670,16 +670,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist8192-int8" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist8192-int8" }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "int8" }, - "file": "index/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist16384-int8", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ { "nprobe": 1 @@ -709,17 +709,17 @@ "nprobe": 2000 } ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_ivf_sq/nlist16384-int8" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_ivf_sq/nlist16384-int8" }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "index/fashion-mnist-784-euclidean/faiss_flat/flat", + "file": "index/fashion-mnist-784-euclidean/faiss_gpu_flat/flat", "search_params": [ {} ], - "search_result_file": "result/fashion-mnist-784-euclidean/faiss_flat/flat" + "search_result_file": "result/fashion-mnist-784-euclidean/faiss_gpu_flat/flat" }, { diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/gist-960-euclidean.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/gist-960-euclidean.json index b097aa7ca0..3ada85834f 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/gist-960-euclidean.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/gist-960-euclidean.json @@ -104,12 +104,12 @@ "search_result_file": "result/gist-960-euclidean/raft_bfknn/bfknn" }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 1024 }, - "file": "index/gist-960-euclidean/faiss_ivf_flat/nlist1024", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_flat/nlist1024", "search_params": [ { "nprobe": 1 @@ -136,15 +136,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_flat/nlist1024" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_flat/nlist1024" }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 2048 }, - "file": "index/gist-960-euclidean/faiss_ivf_flat/nlist2048", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_flat/nlist2048", "search_params": [ { "nprobe": 1 @@ -171,15 +171,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_flat/nlist2048" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_flat/nlist2048" }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 4096 }, - "file": "index/gist-960-euclidean/faiss_ivf_flat/nlist4096", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_flat/nlist4096", "search_params": [ { "nprobe": 1 @@ -206,15 +206,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_flat/nlist4096" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_flat/nlist4096" }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 8192 }, - "file": "index/gist-960-euclidean/faiss_ivf_flat/nlist8192", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_flat/nlist8192", "search_params": [ { "nprobe": 1 @@ -241,15 +241,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_flat/nlist8192" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_flat/nlist8192" }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 16384 }, - "file": "index/gist-960-euclidean/faiss_ivf_flat/nlist16384", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_flat/nlist16384", "search_params": [ { "nprobe": 1 @@ -279,10 +279,10 @@ "nprobe": 2000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_flat/nlist16384" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_flat/nlist16384" }, { - "name": "faiss_ivf_pq.M64-nlist1024", + "name": "faiss_gpu_ivf_pq.M64-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -290,7 +290,7 @@ "useFloat16": true, "usePrecomputed": true }, - "file": "index/gist-960-euclidean/faiss_ivf_pq/M64-nlist1024", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_pq/M64-nlist1024", "search_params": [ { "nprobe": 10 @@ -311,10 +311,10 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_pq.M64-nlist1024.noprecomp", + "name": "faiss_gpu_ivf_pq.M64-nlist1024.noprecomp", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -322,7 +322,7 @@ "useFloat16": true, "usePrecomputed": false }, - "file": "index/gist-960-euclidean/faiss_ivf_pq/M64-nlist1024.noprecomp", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_pq/M64-nlist1024.noprecomp", "search_params": [ { "nprobe": 10 @@ -343,16 +343,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "fp16" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist1024-fp16", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ { "nprobe": 1 @@ -379,16 +379,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist1024-fp16" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist1024-fp16" }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "fp16" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist2048-fp16", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ { "nprobe": 1 @@ -415,16 +415,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist2048-fp16" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist2048-fp16" }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "fp16" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist4096-fp16", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ { "nprobe": 1 @@ -451,16 +451,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist4096-fp16" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist4096-fp16" }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "fp16" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist8192-fp16", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ { "nprobe": 1 @@ -487,16 +487,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist8192-fp16" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist8192-fp16" }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "fp16" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist16384-fp16", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ { "nprobe": 1 @@ -526,16 +526,16 @@ "nprobe": 2000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist16384-fp16" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist16384-fp16" }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "int8" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist1024-int8", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ { "nprobe": 1 @@ -562,16 +562,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist1024-int8" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist1024-int8" }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "int8" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist2048-int8", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ { "nprobe": 1 @@ -598,16 +598,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist2048-int8" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist2048-int8" }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "int8" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist4096-int8", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ { "nprobe": 1 @@ -634,16 +634,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist4096-int8" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist4096-int8" }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "int8" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist8192-int8", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ { "nprobe": 1 @@ -670,16 +670,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist8192-int8" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist8192-int8" }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "int8" }, - "file": "index/gist-960-euclidean/faiss_ivf_sq/nlist16384-int8", + "file": "index/gist-960-euclidean/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ { "nprobe": 1 @@ -709,17 +709,17 @@ "nprobe": 2000 } ], - "search_result_file": "result/gist-960-euclidean/faiss_ivf_sq/nlist16384-int8" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_ivf_sq/nlist16384-int8" }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "index/gist-960-euclidean/faiss_flat/flat", + "file": "index/gist-960-euclidean/faiss_gpu_flat/flat", "search_params": [ {} ], - "search_result_file": "result/gist-960-euclidean/faiss_flat/flat" + "search_result_file": "result/gist-960-euclidean/faiss_gpu_flat/flat" }, { diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-100-angular.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-100-angular.json index 526aef2db0..e12a30ccd9 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-100-angular.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-100-angular.json @@ -104,12 +104,12 @@ "search_result_file": "result/glove-100-angular/raft_bfknn/bfknn" }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 1024 }, - "file": "index/glove-100-angular/faiss_ivf_flat/nlist1024", + "file": "index/glove-100-angular/faiss_gpu_ivf_flat/nlist1024", "search_params": [ { "nprobe": 1 @@ -136,15 +136,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_flat/nlist1024" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_flat/nlist1024" }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 2048 }, - "file": "index/glove-100-angular/faiss_ivf_flat/nlist2048", + "file": "index/glove-100-angular/faiss_gpu_ivf_flat/nlist2048", "search_params": [ { "nprobe": 1 @@ -171,15 +171,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_flat/nlist2048" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_flat/nlist2048" }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 4096 }, - "file": "index/glove-100-angular/faiss_ivf_flat/nlist4096", + "file": "index/glove-100-angular/faiss_gpu_ivf_flat/nlist4096", "search_params": [ { "nprobe": 1 @@ -206,15 +206,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_flat/nlist4096" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_flat/nlist4096" }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 8192 }, - "file": "index/glove-100-angular/faiss_ivf_flat/nlist8192", + "file": "index/glove-100-angular/faiss_gpu_ivf_flat/nlist8192", "search_params": [ { "nprobe": 1 @@ -241,15 +241,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_flat/nlist8192" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_flat/nlist8192" }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 16384 }, - "file": "index/glove-100-angular/faiss_ivf_flat/nlist16384", + "file": "index/glove-100-angular/faiss_gpu_ivf_flat/nlist16384", "search_params": [ { "nprobe": 1 @@ -279,10 +279,10 @@ "nprobe": 2000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_flat/nlist16384" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_flat/nlist16384" }, { - "name": "faiss_ivf_pq.M64-nlist1024", + "name": "faiss_gpu_ivf_pq.M64-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -290,7 +290,7 @@ "useFloat16": true, "usePrecomputed": true }, - "file": "index/glove-100-angular/faiss_ivf_pq/M64-nlist1024", + "file": "index/glove-100-angular/faiss_gpu_ivf_pq/M64-nlist1024", "search_params": [ { "nprobe": 10 @@ -311,10 +311,10 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_pq.M64-nlist1024.noprecomp", + "name": "faiss_gpu_ivf_pq.M64-nlist1024.noprecomp", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -322,7 +322,7 @@ "useFloat16": true, "usePrecomputed": false }, - "file": "index/glove-100-angular/faiss_ivf_pq/M64-nlist1024.noprecomp", + "file": "index/glove-100-angular/faiss_gpu_ivf_pq/M64-nlist1024.noprecomp", "search_params": [ { "nprobe": 10 @@ -343,16 +343,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "fp16" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist1024-fp16", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ { "nprobe": 1 @@ -379,16 +379,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist1024-fp16" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist1024-fp16" }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "fp16" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist2048-fp16", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ { "nprobe": 1 @@ -415,16 +415,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist2048-fp16" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist2048-fp16" }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "fp16" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist4096-fp16", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ { "nprobe": 1 @@ -451,16 +451,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist4096-fp16" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist4096-fp16" }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "fp16" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist8192-fp16", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ { "nprobe": 1 @@ -487,16 +487,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist8192-fp16" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist8192-fp16" }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "fp16" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist16384-fp16", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ { "nprobe": 1 @@ -526,16 +526,16 @@ "nprobe": 2000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist16384-fp16" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist16384-fp16" }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "int8" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist1024-int8", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ { "nprobe": 1 @@ -562,16 +562,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist1024-int8" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist1024-int8" }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "int8" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist2048-int8", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ { "nprobe": 1 @@ -598,16 +598,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist2048-int8" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist2048-int8" }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "int8" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist4096-int8", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ { "nprobe": 1 @@ -634,16 +634,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist4096-int8" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist4096-int8" }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "int8" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist8192-int8", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ { "nprobe": 1 @@ -670,16 +670,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist8192-int8" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist8192-int8" }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "int8" }, - "file": "index/glove-100-angular/faiss_ivf_sq/nlist16384-int8", + "file": "index/glove-100-angular/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ { "nprobe": 1 @@ -709,17 +709,17 @@ "nprobe": 2000 } ], - "search_result_file": "result/glove-100-angular/faiss_ivf_sq/nlist16384-int8" + "search_result_file": "result/glove-100-angular/faiss_gpu_ivf_sq/nlist16384-int8" }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "index/glove-100-angular/faiss_flat/flat", + "file": "index/glove-100-angular/faiss_gpu_flat/flat", "search_params": [ {} ], - "search_result_file": "result/glove-100-angular/faiss_flat/flat" + "search_result_file": "result/glove-100-angular/faiss_gpu_flat/flat" }, { diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-100-inner.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-100-inner.json index 7c95ceb439..a59496507e 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-100-inner.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-100-inner.json @@ -167,10 +167,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist":1024}, - "file": "glove-100-inner/faiss_ivf_flat/nlist1024", + "file": "glove-100-inner/faiss_gpu_ivf_flat/nlist1024", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -183,10 +183,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist":2048}, - "file": "glove-100-inner/faiss_ivf_flat/nlist2048", + "file": "glove-100-inner/faiss_gpu_ivf_flat/nlist2048", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -199,10 +199,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist":4096}, - "file": "glove-100-inner/faiss_ivf_flat/nlist4096", + "file": "glove-100-inner/faiss_gpu_ivf_flat/nlist4096", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -215,10 +215,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist":8192}, - "file": "glove-100-inner/faiss_ivf_flat/nlist8192", + "file": "glove-100-inner/faiss_gpu_ivf_flat/nlist8192", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -231,10 +231,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist":16384}, - "file": "glove-100-inner/faiss_ivf_flat/nlist16384", + "file": "glove-100-inner/faiss_gpu_ivf_flat/nlist16384", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -251,10 +251,10 @@ { - "name": "faiss_ivf_pq.M2-nlist1024", + "name": "faiss_gpu_ivf_pq.M2-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":1024, "M":2}, - "file": "glove-100-inner/faiss_ivf_pq/M2-nlist1024", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M2-nlist1024", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -267,10 +267,10 @@ ] }, { - "name": "faiss_ivf_pq.M2-nlist2048", + "name": "faiss_gpu_ivf_pq.M2-nlist2048", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":2048, "M":2}, - "file": "glove-100-inner/faiss_ivf_pq/M2-nlist2048", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M2-nlist2048", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -283,10 +283,10 @@ ] }, { - "name": "faiss_ivf_pq.M2-nlist4096", + "name": "faiss_gpu_ivf_pq.M2-nlist4096", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":4096, "M":2}, - "file": "glove-100-inner/faiss_ivf_pq/M2-nlist4096", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M2-nlist4096", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -299,10 +299,10 @@ ] }, { - "name": "faiss_ivf_pq.M2-nlist8192", + "name": "faiss_gpu_ivf_pq.M2-nlist8192", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":8192, "M":2}, - "file": "glove-100-inner/faiss_ivf_pq/M2-nlist8192", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M2-nlist8192", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -315,10 +315,10 @@ ] }, { - "name": "faiss_ivf_pq.M2-nlist16384", + "name": "faiss_gpu_ivf_pq.M2-nlist16384", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":16384, "M":2}, - "file": "glove-100-inner/faiss_ivf_pq/M2-nlist16384", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M2-nlist16384", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -332,10 +332,10 @@ ] }, { - "name": "faiss_ivf_pq.M4-nlist1024", + "name": "faiss_gpu_ivf_pq.M4-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":1024, "M":4}, - "file": "glove-100-inner/faiss_ivf_pq/M4-nlist1024", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M4-nlist1024", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -348,10 +348,10 @@ ] }, { - "name": "faiss_ivf_pq.M4-nlist2048", + "name": "faiss_gpu_ivf_pq.M4-nlist2048", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":2048, "M":4}, - "file": "glove-100-inner/faiss_ivf_pq/M4-nlist2048", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M4-nlist2048", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -364,10 +364,10 @@ ] }, { - "name": "faiss_ivf_pq.M4-nlist4096", + "name": "faiss_gpu_ivf_pq.M4-nlist4096", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":4096, "M":4}, - "file": "glove-100-inner/faiss_ivf_pq/M4-nlist4096", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M4-nlist4096", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -380,10 +380,10 @@ ] }, { - "name": "faiss_ivf_pq.M4-nlist8192", + "name": "faiss_gpu_ivf_pq.M4-nlist8192", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":8192, "M":4}, - "file": "glove-100-inner/faiss_ivf_pq/M4-nlist8192", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M4-nlist8192", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -396,10 +396,10 @@ ] }, { - "name": "faiss_ivf_pq.M4-nlist16384", + "name": "faiss_gpu_ivf_pq.M4-nlist16384", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":16384, "M":4}, - "file": "glove-100-inner/faiss_ivf_pq/M4-nlist16384", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M4-nlist16384", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -413,10 +413,10 @@ ] }, { - "name": "faiss_ivf_pq.M20-nlist1024", + "name": "faiss_gpu_ivf_pq.M20-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":1024, "M":20}, - "file": "glove-100-inner/faiss_ivf_pq/M20-nlist1024", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M20-nlist1024", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -429,10 +429,10 @@ ] }, { - "name": "faiss_ivf_pq.M20-nlist2048", + "name": "faiss_gpu_ivf_pq.M20-nlist2048", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":2048, "M":20}, - "file": "glove-100-inner/faiss_ivf_pq/M20-nlist2048", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M20-nlist2048", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -445,10 +445,10 @@ ] }, { - "name": "faiss_ivf_pq.M20-nlist4096", + "name": "faiss_gpu_ivf_pq.M20-nlist4096", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":4096, "M":20}, - "file": "glove-100-inner/faiss_ivf_pq/M20-nlist4096", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M20-nlist4096", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -461,10 +461,10 @@ ] }, { - "name": "faiss_ivf_pq.M20-nlist8192", + "name": "faiss_gpu_ivf_pq.M20-nlist8192", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":8192, "M":20}, - "file": "glove-100-inner/faiss_ivf_pq/M20-nlist8192", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M20-nlist8192", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -477,10 +477,10 @@ ] }, { - "name": "faiss_ivf_pq.M20-nlist16384", + "name": "faiss_gpu_ivf_pq.M20-nlist16384", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist":16384, "M":20}, - "file": "glove-100-inner/faiss_ivf_pq/M20-nlist16384", + "file": "glove-100-inner/faiss_gpu_ivf_pq/M20-nlist16384", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -496,10 +496,10 @@ { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":1024, "quantizer_type":"fp16"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist1024-fp16", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -512,10 +512,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":2048, "quantizer_type":"fp16"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist2048-fp16", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -528,10 +528,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":4096, "quantizer_type":"fp16"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist4096-fp16", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -544,10 +544,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":8192, "quantizer_type":"fp16"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist8192-fp16", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -560,10 +560,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":16384, "quantizer_type":"fp16"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist16384-fp16", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -577,10 +577,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":1024, "quantizer_type":"int8"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist1024-int8", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -593,10 +593,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":2048, "quantizer_type":"int8"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist2048-int8", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -609,10 +609,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":4096, "quantizer_type":"int8"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist4096-int8", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -625,10 +625,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":8192, "quantizer_type":"int8"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist8192-int8", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -641,10 +641,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist":16384, "quantizer_type":"int8"}, - "file": "glove-100-inner/faiss_ivf_sq/nlist16384-int8", + "file": "glove-100-inner/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ {"nprobe":1}, {"nprobe":5}, @@ -658,10 +658,10 @@ ] }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "glove-100-inner/faiss_flat/flat", + "file": "glove-100-inner/faiss_gpu_flat/flat", "search_params": [{}] }, { diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-50-angular.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-50-angular.json index 9b3f192c9f..6e8d2fe1d9 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-50-angular.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/glove-50-angular.json @@ -104,12 +104,12 @@ "search_result_file": "result/glove-50-angular/raft_bfknn/bfknn" }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 1024 }, - "file": "index/glove-50-angular/faiss_ivf_flat/nlist1024", + "file": "index/glove-50-angular/faiss_gpu_ivf_flat/nlist1024", "search_params": [ { "nprobe": 1 @@ -136,15 +136,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_flat/nlist1024" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_flat/nlist1024" }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 2048 }, - "file": "index/glove-50-angular/faiss_ivf_flat/nlist2048", + "file": "index/glove-50-angular/faiss_gpu_ivf_flat/nlist2048", "search_params": [ { "nprobe": 1 @@ -171,15 +171,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_flat/nlist2048" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_flat/nlist2048" }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 4096 }, - "file": "index/glove-50-angular/faiss_ivf_flat/nlist4096", + "file": "index/glove-50-angular/faiss_gpu_ivf_flat/nlist4096", "search_params": [ { "nprobe": 1 @@ -206,15 +206,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_flat/nlist4096" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_flat/nlist4096" }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 8192 }, - "file": "index/glove-50-angular/faiss_ivf_flat/nlist8192", + "file": "index/glove-50-angular/faiss_gpu_ivf_flat/nlist8192", "search_params": [ { "nprobe": 1 @@ -241,15 +241,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_flat/nlist8192" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_flat/nlist8192" }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 16384 }, - "file": "index/glove-50-angular/faiss_ivf_flat/nlist16384", + "file": "index/glove-50-angular/faiss_gpu_ivf_flat/nlist16384", "search_params": [ { "nprobe": 1 @@ -279,10 +279,10 @@ "nprobe": 2000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_flat/nlist16384" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_flat/nlist16384" }, { - "name": "faiss_ivf_pq.M64-nlist1024", + "name": "faiss_gpu_ivf_pq.M64-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -290,7 +290,7 @@ "useFloat16": true, "usePrecomputed": true }, - "file": "index/glove-50-angular/faiss_ivf_pq/M64-nlist1024", + "file": "index/glove-50-angular/faiss_gpu_ivf_pq/M64-nlist1024", "search_params": [ { "nprobe": 10 @@ -311,10 +311,10 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_pq.M64-nlist1024.noprecomp", + "name": "faiss_gpu_ivf_pq.M64-nlist1024.noprecomp", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -322,7 +322,7 @@ "useFloat16": true, "usePrecomputed": false }, - "file": "index/glove-50-angular/faiss_ivf_pq/M64-nlist1024.noprecomp", + "file": "index/glove-50-angular/faiss_gpu_ivf_pq/M64-nlist1024.noprecomp", "search_params": [ { "nprobe": 10 @@ -343,16 +343,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "fp16" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist1024-fp16", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ { "nprobe": 1 @@ -379,16 +379,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist1024-fp16" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist1024-fp16" }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "fp16" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist2048-fp16", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ { "nprobe": 1 @@ -415,16 +415,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist2048-fp16" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist2048-fp16" }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "fp16" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist4096-fp16", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ { "nprobe": 1 @@ -451,16 +451,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist4096-fp16" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist4096-fp16" }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "fp16" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist8192-fp16", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ { "nprobe": 1 @@ -487,16 +487,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist8192-fp16" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist8192-fp16" }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "fp16" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist16384-fp16", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ { "nprobe": 1 @@ -526,16 +526,16 @@ "nprobe": 2000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist16384-fp16" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist16384-fp16" }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "int8" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist1024-int8", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ { "nprobe": 1 @@ -562,16 +562,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist1024-int8" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist1024-int8" }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "int8" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist2048-int8", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ { "nprobe": 1 @@ -598,16 +598,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist2048-int8" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist2048-int8" }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "int8" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist4096-int8", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ { "nprobe": 1 @@ -634,16 +634,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist4096-int8" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist4096-int8" }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "int8" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist8192-int8", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ { "nprobe": 1 @@ -670,16 +670,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist8192-int8" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist8192-int8" }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "int8" }, - "file": "index/glove-50-angular/faiss_ivf_sq/nlist16384-int8", + "file": "index/glove-50-angular/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ { "nprobe": 1 @@ -709,17 +709,17 @@ "nprobe": 2000 } ], - "search_result_file": "result/glove-50-angular/faiss_ivf_sq/nlist16384-int8" + "search_result_file": "result/glove-50-angular/faiss_gpu_ivf_sq/nlist16384-int8" }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "index/glove-50-angular/faiss_flat/flat", + "file": "index/glove-50-angular/faiss_gpu_flat/flat", "search_params": [ {} ], - "search_result_file": "result/glove-50-angular/faiss_flat/flat" + "search_result_file": "result/glove-50-angular/faiss_gpu_flat/flat" }, { diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/lastfm-65-angular.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/lastfm-65-angular.json index e5a4ca6e5f..2d7a2eb7d4 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/lastfm-65-angular.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/lastfm-65-angular.json @@ -104,12 +104,12 @@ "search_result_file": "result/lastfm-65-angular/raft_bfknn/bfknn" }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 1024 }, - "file": "index/lastfm-65-angular/faiss_ivf_flat/nlist1024", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_flat/nlist1024", "search_params": [ { "nprobe": 1 @@ -136,15 +136,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_flat/nlist1024" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_flat/nlist1024" }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 2048 }, - "file": "index/lastfm-65-angular/faiss_ivf_flat/nlist2048", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_flat/nlist2048", "search_params": [ { "nprobe": 1 @@ -171,15 +171,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_flat/nlist2048" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_flat/nlist2048" }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 4096 }, - "file": "index/lastfm-65-angular/faiss_ivf_flat/nlist4096", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_flat/nlist4096", "search_params": [ { "nprobe": 1 @@ -206,15 +206,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_flat/nlist4096" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_flat/nlist4096" }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 8192 }, - "file": "index/lastfm-65-angular/faiss_ivf_flat/nlist8192", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_flat/nlist8192", "search_params": [ { "nprobe": 1 @@ -241,15 +241,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_flat/nlist8192" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_flat/nlist8192" }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 16384 }, - "file": "index/lastfm-65-angular/faiss_ivf_flat/nlist16384", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_flat/nlist16384", "search_params": [ { "nprobe": 1 @@ -279,10 +279,10 @@ "nprobe": 2000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_flat/nlist16384" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_flat/nlist16384" }, { - "name": "faiss_ivf_pq.M64-nlist1024", + "name": "faiss_gpu_ivf_pq.M64-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -290,7 +290,7 @@ "useFloat16": true, "usePrecomputed": true }, - "file": "index/lastfm-65-angular/faiss_ivf_pq/M64-nlist1024", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_pq/M64-nlist1024", "search_params": [ { "nprobe": 10 @@ -311,10 +311,10 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_pq.M64-nlist1024.noprecomp", + "name": "faiss_gpu_ivf_pq.M64-nlist1024.noprecomp", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -322,7 +322,7 @@ "useFloat16": true, "usePrecomputed": false }, - "file": "index/lastfm-65-angular/faiss_ivf_pq/M64-nlist1024.noprecomp", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_pq/M64-nlist1024.noprecomp", "search_params": [ { "nprobe": 10 @@ -343,16 +343,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "fp16" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist1024-fp16", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ { "nprobe": 1 @@ -379,16 +379,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist1024-fp16" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist1024-fp16" }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "fp16" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist2048-fp16", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ { "nprobe": 1 @@ -415,16 +415,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist2048-fp16" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist2048-fp16" }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "fp16" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist4096-fp16", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ { "nprobe": 1 @@ -451,16 +451,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist4096-fp16" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist4096-fp16" }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "fp16" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist8192-fp16", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ { "nprobe": 1 @@ -487,16 +487,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist8192-fp16" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist8192-fp16" }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "fp16" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist16384-fp16", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ { "nprobe": 1 @@ -526,16 +526,16 @@ "nprobe": 2000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist16384-fp16" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist16384-fp16" }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "int8" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist1024-int8", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ { "nprobe": 1 @@ -562,16 +562,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist1024-int8" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist1024-int8" }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "int8" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist2048-int8", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ { "nprobe": 1 @@ -598,16 +598,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist2048-int8" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist2048-int8" }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "int8" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist4096-int8", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ { "nprobe": 1 @@ -634,16 +634,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist4096-int8" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist4096-int8" }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "int8" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist8192-int8", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ { "nprobe": 1 @@ -670,16 +670,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist8192-int8" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist8192-int8" }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "int8" }, - "file": "index/lastfm-65-angular/faiss_ivf_sq/nlist16384-int8", + "file": "index/lastfm-65-angular/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ { "nprobe": 1 @@ -709,17 +709,17 @@ "nprobe": 2000 } ], - "search_result_file": "result/lastfm-65-angular/faiss_ivf_sq/nlist16384-int8" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_ivf_sq/nlist16384-int8" }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "index/lastfm-65-angular/faiss_flat/flat", + "file": "index/lastfm-65-angular/faiss_gpu_flat/flat", "search_params": [ {} ], - "search_result_file": "result/lastfm-65-angular/faiss_flat/flat" + "search_result_file": "result/lastfm-65-angular/faiss_gpu_flat/flat" }, { diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/mnist-784-euclidean.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/mnist-784-euclidean.json index 2a493edeed..66750a64b1 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/mnist-784-euclidean.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/mnist-784-euclidean.json @@ -104,12 +104,12 @@ "search_result_file": "result/mnist-784-euclidean/raft_bfknn/bfknn" }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 1024 }, - "file": "index/mnist-784-euclidean/faiss_ivf_flat/nlist1024", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist1024", "search_params": [ { "nprobe": 1 @@ -136,15 +136,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_flat/nlist1024" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist1024" }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 2048 }, - "file": "index/mnist-784-euclidean/faiss_ivf_flat/nlist2048", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist2048", "search_params": [ { "nprobe": 1 @@ -171,15 +171,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_flat/nlist2048" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist2048" }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 4096 }, - "file": "index/mnist-784-euclidean/faiss_ivf_flat/nlist4096", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist4096", "search_params": [ { "nprobe": 1 @@ -206,15 +206,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_flat/nlist4096" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist4096" }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 8192 }, - "file": "index/mnist-784-euclidean/faiss_ivf_flat/nlist8192", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist8192", "search_params": [ { "nprobe": 1 @@ -241,15 +241,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_flat/nlist8192" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist8192" }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 16384 }, - "file": "index/mnist-784-euclidean/faiss_ivf_flat/nlist16384", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist16384", "search_params": [ { "nprobe": 1 @@ -279,10 +279,10 @@ "nprobe": 2000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_flat/nlist16384" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_flat/nlist16384" }, { - "name": "faiss_ivf_pq.M64-nlist1024", + "name": "faiss_gpu_ivf_pq.M64-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -290,7 +290,7 @@ "useFloat16": true, "usePrecomputed": true }, - "file": "index/mnist-784-euclidean/faiss_ivf_pq/M64-nlist1024", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_pq/M64-nlist1024", "search_params": [ { "nprobe": 10 @@ -311,10 +311,10 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_pq.M64-nlist1024.noprecomp", + "name": "faiss_gpu_ivf_pq.M64-nlist1024.noprecomp", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -322,7 +322,7 @@ "useFloat16": true, "usePrecomputed": false }, - "file": "index/mnist-784-euclidean/faiss_ivf_pq/M64-nlist1024.noprecomp", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_pq/M64-nlist1024.noprecomp", "search_params": [ { "nprobe": 10 @@ -343,16 +343,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "fp16" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist1024-fp16", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ { "nprobe": 1 @@ -379,16 +379,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist1024-fp16" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist1024-fp16" }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "fp16" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist2048-fp16", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ { "nprobe": 1 @@ -415,16 +415,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist2048-fp16" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist2048-fp16" }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "fp16" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist4096-fp16", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ { "nprobe": 1 @@ -451,16 +451,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist4096-fp16" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist4096-fp16" }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "fp16" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist8192-fp16", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ { "nprobe": 1 @@ -487,16 +487,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist8192-fp16" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist8192-fp16" }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "fp16" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist16384-fp16", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ { "nprobe": 1 @@ -526,16 +526,16 @@ "nprobe": 2000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist16384-fp16" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist16384-fp16" }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "int8" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist1024-int8", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ { "nprobe": 1 @@ -562,16 +562,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist1024-int8" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist1024-int8" }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "int8" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist2048-int8", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ { "nprobe": 1 @@ -598,16 +598,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist2048-int8" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist2048-int8" }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "int8" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist4096-int8", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ { "nprobe": 1 @@ -634,16 +634,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist4096-int8" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist4096-int8" }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "int8" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist8192-int8", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ { "nprobe": 1 @@ -670,16 +670,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist8192-int8" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist8192-int8" }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "int8" }, - "file": "index/mnist-784-euclidean/faiss_ivf_sq/nlist16384-int8", + "file": "index/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ { "nprobe": 1 @@ -709,17 +709,17 @@ "nprobe": 2000 } ], - "search_result_file": "result/mnist-784-euclidean/faiss_ivf_sq/nlist16384-int8" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_ivf_sq/nlist16384-int8" }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "index/mnist-784-euclidean/faiss_flat/flat", + "file": "index/mnist-784-euclidean/faiss_gpu_flat/flat", "search_params": [ {} ], - "search_result_file": "result/mnist-784-euclidean/faiss_flat/flat" + "search_result_file": "result/mnist-784-euclidean/faiss_gpu_flat/flat" }, { diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/nytimes-256-angular.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/nytimes-256-angular.json index 630b700ba5..78c5e181e3 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/nytimes-256-angular.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/nytimes-256-angular.json @@ -104,12 +104,12 @@ "search_result_file": "result/nytimes-256-angular/raft_bfknn/bfknn" }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 1024 }, - "file": "index/nytimes-256-angular/faiss_ivf_flat/nlist1024", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_flat/nlist1024", "search_params": [ { "nprobe": 1 @@ -136,15 +136,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_flat/nlist1024" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_flat/nlist1024" }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 2048 }, - "file": "index/nytimes-256-angular/faiss_ivf_flat/nlist2048", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_flat/nlist2048", "search_params": [ { "nprobe": 1 @@ -171,15 +171,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_flat/nlist2048" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_flat/nlist2048" }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 4096 }, - "file": "index/nytimes-256-angular/faiss_ivf_flat/nlist4096", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_flat/nlist4096", "search_params": [ { "nprobe": 1 @@ -206,15 +206,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_flat/nlist4096" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_flat/nlist4096" }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 8192 }, - "file": "index/nytimes-256-angular/faiss_ivf_flat/nlist8192", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_flat/nlist8192", "search_params": [ { "nprobe": 1 @@ -241,15 +241,15 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_flat/nlist8192" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_flat/nlist8192" }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": { "nlist": 16384 }, - "file": "index/nytimes-256-angular/faiss_ivf_flat/nlist16384", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_flat/nlist16384", "search_params": [ { "nprobe": 1 @@ -279,10 +279,10 @@ "nprobe": 2000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_flat/nlist16384" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_flat/nlist16384" }, { - "name": "faiss_ivf_pq.M64-nlist1024", + "name": "faiss_gpu_ivf_pq.M64-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -290,7 +290,7 @@ "useFloat16": true, "usePrecomputed": true }, - "file": "index/nytimes-256-angular/faiss_ivf_pq/M64-nlist1024", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_pq/M64-nlist1024", "search_params": [ { "nprobe": 10 @@ -311,10 +311,10 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_pq.M64-nlist1024.noprecomp", + "name": "faiss_gpu_ivf_pq.M64-nlist1024.noprecomp", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -322,7 +322,7 @@ "useFloat16": true, "usePrecomputed": false }, - "file": "index/nytimes-256-angular/faiss_ivf_pq/M64-nlist1024.noprecomp", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_pq/M64-nlist1024.noprecomp", "search_params": [ { "nprobe": 10 @@ -343,16 +343,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_pq/M64-nlist1024" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_pq/M64-nlist1024" }, { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "fp16" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist1024-fp16", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ { "nprobe": 1 @@ -379,16 +379,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist1024-fp16" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist1024-fp16" }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "fp16" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist2048-fp16", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ { "nprobe": 1 @@ -415,16 +415,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist2048-fp16" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist2048-fp16" }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "fp16" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist4096-fp16", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ { "nprobe": 1 @@ -451,16 +451,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist4096-fp16" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist4096-fp16" }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "fp16" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist8192-fp16", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ { "nprobe": 1 @@ -487,16 +487,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist8192-fp16" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist8192-fp16" }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "fp16" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist16384-fp16", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ { "nprobe": 1 @@ -526,16 +526,16 @@ "nprobe": 2000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist16384-fp16" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist16384-fp16" }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 1024, "quantizer_type": "int8" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist1024-int8", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ { "nprobe": 1 @@ -562,16 +562,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist1024-int8" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist1024-int8" }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 2048, "quantizer_type": "int8" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist2048-int8", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ { "nprobe": 1 @@ -598,16 +598,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist2048-int8" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist2048-int8" }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 4096, "quantizer_type": "int8" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist4096-int8", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ { "nprobe": 1 @@ -634,16 +634,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist4096-int8" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist4096-int8" }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 8192, "quantizer_type": "int8" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist8192-int8", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ { "nprobe": 1 @@ -670,16 +670,16 @@ "nprobe": 1000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist8192-int8" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist8192-int8" }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": { "nlist": 16384, "quantizer_type": "int8" }, - "file": "index/nytimes-256-angular/faiss_ivf_sq/nlist16384-int8", + "file": "index/nytimes-256-angular/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ { "nprobe": 1 @@ -709,17 +709,17 @@ "nprobe": 2000 } ], - "search_result_file": "result/nytimes-256-angular/faiss_ivf_sq/nlist16384-int8" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_ivf_sq/nlist16384-int8" }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "index/nytimes-256-angular/faiss_flat/flat", + "file": "index/nytimes-256-angular/faiss_gpu_flat/flat", "search_params": [ {} ], - "search_result_file": "result/nytimes-256-angular/faiss_flat/flat" + "search_result_file": "result/nytimes-256-angular/faiss_gpu_flat/flat" }, { diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/sift-128-euclidean.json b/python/raft-ann-bench/src/raft-ann-bench/run/conf/sift-128-euclidean.json index 439c1a10c6..ff639cb90c 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/sift-128-euclidean.json +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/sift-128-euclidean.json @@ -93,10 +93,10 @@ "search_params": [{"probe": 1}] }, { - "name": "faiss_ivf_flat.nlist1024", + "name": "faiss_gpu_ivf_flat.nlist1024", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist": 1024}, - "file": "sift-128-euclidean/faiss_ivf_flat/nlist1024", + "file": "sift-128-euclidean/faiss_gpu_ivf_flat/nlist1024", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -109,10 +109,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist2048", + "name": "faiss_gpu_ivf_flat.nlist2048", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist": 2048}, - "file": "sift-128-euclidean/faiss_ivf_flat/nlist2048", + "file": "sift-128-euclidean/faiss_gpu_ivf_flat/nlist2048", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -125,10 +125,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist4096", + "name": "faiss_gpu_ivf_flat.nlist4096", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist": 4096}, - "file": "sift-128-euclidean/faiss_ivf_flat/nlist4096", + "file": "sift-128-euclidean/faiss_gpu_ivf_flat/nlist4096", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -141,10 +141,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist8192", + "name": "faiss_gpu_ivf_flat.nlist8192", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist": 8192}, - "file": "sift-128-euclidean/faiss_ivf_flat/nlist8192", + "file": "sift-128-euclidean/faiss_gpu_ivf_flat/nlist8192", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -157,10 +157,10 @@ ] }, { - "name": "faiss_ivf_flat.nlist16384", + "name": "faiss_gpu_ivf_flat.nlist16384", "algo": "faiss_gpu_ivf_flat", "build_param": {"nlist": 16384}, - "file": "sift-128-euclidean/faiss_ivf_flat/nlist16384", + "file": "sift-128-euclidean/faiss_gpu_ivf_flat/nlist16384", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -174,10 +174,10 @@ ] }, { - "name": "faiss_ivf_pq.M64-nlist1024", + "name": "faiss_gpu_ivf_pq.M64-nlist1024", "algo": "faiss_gpu_ivf_pq", "build_param": {"nlist": 1024, "M": 64, "useFloat16": true, "usePrecomputed": true}, - "file": "sift-128-euclidean/faiss_ivf_pq/M64-nlist1024", + "file": "sift-128-euclidean/faiss_gpu_ivf_pq/M64-nlist1024", "search_params": [ {"nprobe": 10}, {"nprobe": 50}, @@ -188,7 +188,7 @@ ] }, { - "name": "faiss_ivf_pq.M64-nlist1024.noprecomp", + "name": "faiss_gpu_ivf_pq.M64-nlist1024.noprecomp", "algo": "faiss_gpu_ivf_pq", "build_param": { "nlist": 1024, @@ -196,7 +196,7 @@ "useFloat16": true, "usePrecomputed": false }, - "file": "sift-128-euclidean/faiss_ivf_pq/M64-nlist1024.noprecomp", + "file": "sift-128-euclidean/faiss_gpu_ivf_pq/M64-nlist1024.noprecomp", "search_params": [ {"nprobe": 10}, {"nprobe": 50}, @@ -207,10 +207,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist1024-fp16", + "name": "faiss_gpu_ivf_sq.nlist1024-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 1024, "quantizer_type": "fp16"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist1024-fp16", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist1024-fp16", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -223,10 +223,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist2048-fp16", + "name": "faiss_gpu_ivf_sq.nlist2048-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 2048, "quantizer_type": "fp16"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist2048-fp16", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist2048-fp16", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -239,10 +239,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist4096-fp16", + "name": "faiss_gpu_ivf_sq.nlist4096-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 4096, "quantizer_type": "fp16"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist4096-fp16", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist4096-fp16", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -255,10 +255,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist8192-fp16", + "name": "faiss_gpu_ivf_sq.nlist8192-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 8192, "quantizer_type": "fp16"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist8192-fp16", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist8192-fp16", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -271,10 +271,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist16384-fp16", + "name": "faiss_gpu_ivf_sq.nlist16384-fp16", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 16384, "quantizer_type": "fp16"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist16384-fp16", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist16384-fp16", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -288,10 +288,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist1024-int8", + "name": "faiss_gpu_ivf_sq.nlist1024-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 1024, "quantizer_type": "int8"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist1024-int8", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist1024-int8", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -304,10 +304,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist2048-int8", + "name": "faiss_gpu_ivf_sq.nlist2048-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 2048,"quantizer_type": "int8"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist2048-int8", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist2048-int8", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -320,10 +320,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist4096-int8", + "name": "faiss_gpu_ivf_sq.nlist4096-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 4096, "quantizer_type": "int8"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist4096-int8", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist4096-int8", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -336,10 +336,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist8192-int8", + "name": "faiss_gpu_ivf_sq.nlist8192-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 8192, "quantizer_type": "int8"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist8192-int8", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist8192-int8", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -352,10 +352,10 @@ ] }, { - "name": "faiss_ivf_sq.nlist16384-int8", + "name": "faiss_gpu_ivf_sq.nlist16384-int8", "algo": "faiss_gpu_ivf_sq", "build_param": {"nlist": 16384, "quantizer_type": "int8"}, - "file": "sift-128-euclidean/faiss_ivf_sq/nlist16384-int8", + "file": "sift-128-euclidean/faiss_gpu_ivf_sq/nlist16384-int8", "search_params": [ {"nprobe": 1}, {"nprobe": 5}, @@ -369,10 +369,10 @@ ] }, { - "name": "faiss_flat", + "name": "faiss_gpu_flat", "algo": "faiss_gpu_flat", "build_param": {}, - "file": "sift-128-euclidean/faiss_flat/flat", + "file": "sift-128-euclidean/faiss_gpu_flat/flat", "search_params": [{}] }, { From 7d213752b43ec0df1c1df72c873c3f099015c5c9 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 25 Sep 2023 17:47:44 -0400 Subject: [PATCH 16/34] Updating faiss version --- conda/environments/bench_ann_cuda-118_arch-x86_64.yaml | 3 ++- dependencies.yaml | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml index 5a9ef5bd32..6ceeb568ef 100644 --- a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml +++ b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml @@ -30,7 +30,8 @@ dependencies: - libcusolver=11.4.1.48 - libcusparse-dev=11.7.5.86 - libcusparse=11.7.5.86 -- libfaiss>=1.7.1 +- libfaiss-avx2=1.7.4 +- libfaiss=1.7.4 - nccl>=2.9.9 - ninja - nlohmann_json>=3.11.2 diff --git a/dependencies.yaml b/dependencies.yaml index 700a6db1bf..9e208aac5f 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -181,9 +181,16 @@ dependencies: - nlohmann_json>=3.11.2 - glog>=0.6.0 - h5py>=3.8.0 - - libfaiss>=1.7.1 + - libfaiss=1.7.4 - benchmark>=1.8.2 - faiss-proc=*=cuda + specific: + - output_types: [conda, pyproject, requirements] + matrices: + - matrix: + arch: x86_64 + packages: + - libfaiss-avx2=1.7.4 nn_bench_python: common: - output_types: [conda] From 001c22453e1cb302118f2856301014e92ea58b21 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 25 Sep 2023 19:16:32 -0400 Subject: [PATCH 17/34] Pringing raft_faiss_targets --- cpp/bench/ann/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index 4c294c6e0b..e307de5b1d 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -247,6 +247,8 @@ if(TARGET faiss::faiss_avx2) set(RAFT_FAISS_TARGETS faiss::faiss_avx2) endif() +message("RAFT_FAISS_TARGETS: ${RAFT_FAISS_TARGETS}") + if(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT) ConfigureAnnBench( NAME FAISS_CPU_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS From c430bb80057fe609d3daa18727f4e3e79813e612 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 25 Sep 2023 19:41:41 -0400 Subject: [PATCH 18/34] Using faiss from pytorch --- conda/recipes/raft-ann-bench-cpu/meta.yaml | 6 ++---- conda/recipes/raft-ann-bench/meta.yaml | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/conda/recipes/raft-ann-bench-cpu/meta.yaml b/conda/recipes/raft-ann-bench-cpu/meta.yaml index 769fd0be08..f7a34a4bb3 100644 --- a/conda/recipes/raft-ann-bench-cpu/meta.yaml +++ b/conda/recipes/raft-ann-bench-cpu/meta.yaml @@ -47,8 +47,7 @@ requirements: host: - glog {{ glog_version }} - matplotlib - - libfaiss-avx2 {{ faiss_version }} # [linux64] - - libfaiss {{ faiss_version }} # [aarch64] + - faiss-cpu {{ faiss_version }} - nlohmann_json {{ nlohmann_json_version }} - python - pyyaml @@ -57,8 +56,7 @@ requirements: run: - glog {{ glog_version }} - h5py {{ h5py_version }} - - libfaiss-avx2 {{ faiss_version }} # [linux64] - - libfaiss {{ faiss_version }} # [aarch64] + - faiss-cpu {{ faiss_version }} - matplotlib - python - pyyaml diff --git a/conda/recipes/raft-ann-bench/meta.yaml b/conda/recipes/raft-ann-bench/meta.yaml index 987e2a60d7..a2ab0af643 100644 --- a/conda/recipes/raft-ann-bench/meta.yaml +++ b/conda/recipes/raft-ann-bench/meta.yaml @@ -73,8 +73,7 @@ requirements: # Temporarily ignore faiss benchmarks on CUDA 12 because packages do not exist yet {% if cuda_major == "11" %} - faiss-proc=*=cuda - - libfaiss {{ faiss_version }} # [aarch64] - - libfaiss-avx2 {{ faiss_version }} # [linux64] + - libfaiss {{ faiss_version }} {% endif %} - h5py {{ h5py_version }} - benchmark @@ -96,8 +95,7 @@ requirements: # Temporarily ignore faiss benchmarks on CUDA 12 because packages do not exist yet {% if cuda_major == "11" %} - faiss-proc=*=cuda - - libfaiss {{ faiss_version }} # [aarch64] - - libfaiss-avx2 {{ faiss_version }} # [linux64] + - libfaiss {{ faiss_version }} {% endif %} - h5py {{ h5py_version }} - benchmark From 30428fd9ae870d48b318cb6a1220c7c8619c0724 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Thu, 28 Sep 2023 12:58:14 -0400 Subject: [PATCH 19/34] Building faiss statically each time. Will slow down CI but alleviate some of the conda issues. --- .../bench_ann_cuda-118_arch-x86_64.yaml | 3 +-- conda/recipes/raft-ann-bench-cpu/meta.yaml | 4 ++-- conda/recipes/raft-ann-bench/meta.yaml | 16 ++++++++-------- cpp/bench/ann/CMakeLists.txt | 1 + cpp/cmake/thirdparty/get_faiss.cmake | 4 ++-- dependencies.yaml | 3 +-- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml index 6ceeb568ef..8652c6f076 100644 --- a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml +++ b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml @@ -17,7 +17,6 @@ dependencies: - cudatoolkit - cxx-compiler - cython>=3.0.0 -- faiss-proc=*=cuda - gcc_linux-64=11.* - glog>=0.6.0 - h5py>=3.8.0 @@ -31,10 +30,10 @@ dependencies: - libcusparse-dev=11.7.5.86 - libcusparse=11.7.5.86 - libfaiss-avx2=1.7.4 -- libfaiss=1.7.4 - nccl>=2.9.9 - ninja - nlohmann_json>=3.11.2 +- rmm=23.10.* - scikit-build>=0.13.1 - sysroot_linux-64==2.17 name: bench_ann_cuda-118_arch-x86_64 diff --git a/conda/recipes/raft-ann-bench-cpu/meta.yaml b/conda/recipes/raft-ann-bench-cpu/meta.yaml index f7a34a4bb3..7df2c60f7e 100644 --- a/conda/recipes/raft-ann-bench-cpu/meta.yaml +++ b/conda/recipes/raft-ann-bench-cpu/meta.yaml @@ -47,7 +47,7 @@ requirements: host: - glog {{ glog_version }} - matplotlib - - faiss-cpu {{ faiss_version }} +# - faiss-cpu {{ faiss_version }} - nlohmann_json {{ nlohmann_json_version }} - python - pyyaml @@ -56,7 +56,7 @@ requirements: run: - glog {{ glog_version }} - h5py {{ h5py_version }} - - faiss-cpu {{ faiss_version }} +# - faiss-cpu {{ faiss_version }} - matplotlib - python - pyyaml diff --git a/conda/recipes/raft-ann-bench/meta.yaml b/conda/recipes/raft-ann-bench/meta.yaml index a2ab0af643..2270460df6 100644 --- a/conda/recipes/raft-ann-bench/meta.yaml +++ b/conda/recipes/raft-ann-bench/meta.yaml @@ -71,10 +71,10 @@ requirements: - glog {{ glog_version }} - nlohmann_json {{ nlohmann_json_version }} # Temporarily ignore faiss benchmarks on CUDA 12 because packages do not exist yet - {% if cuda_major == "11" %} - - faiss-proc=*=cuda - - libfaiss {{ faiss_version }} - {% endif %} +# {% if cuda_major == "11" %} +# - faiss-proc=*=cuda +# - libfaiss {{ faiss_version }} +# {% endif %} - h5py {{ h5py_version }} - benchmark - matplotlib @@ -93,10 +93,10 @@ requirements: {% endif %} - glog {{ glog_version }} # Temporarily ignore faiss benchmarks on CUDA 12 because packages do not exist yet - {% if cuda_major == "11" %} - - faiss-proc=*=cuda - - libfaiss {{ faiss_version }} - {% endif %} +# {% if cuda_major == "11" %} +# - faiss-proc=*=cuda +# - libfaiss {{ faiss_version }} +# {% endif %} - h5py {{ h5py_version }} - benchmark - glog {{ glog_version }} diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index e307de5b1d..f95cf67e5c 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -77,6 +77,7 @@ if(RAFT_ANN_BENCH_USE_FAISS_GPU_FLAT OR RAFT_ANN_BENCH_USE_FAISS_CPU_IFFLAT ) set(RAFT_ANN_BENCH_USE_FAISS ON) + set(RAFT_USE_FAISS_STATIC ON) endif() set(RAFT_ANN_BENCH_USE_RAFT OFF) diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index bb7dc1eb5c..b2d0cf20cf 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -90,8 +90,8 @@ function(find_and_configure_faiss) endfunction() find_and_configure_faiss(VERSION 1.7.4 - REPOSITORY ${RAFT_FAISS_GIT_REPOSITORY} - PINNED_TAG ${RAFT_FAISS_GIT_TAG} + REPOSITORY git@github.com:facebookresearch/faiss.git + PINNED_TAG v1.7.4 BUILD_STATIC_LIBS ${RAFT_USE_FAISS_STATIC} EXCLUDE_FROM_ALL ${RAFT_EXCLUDE_FAISS_FROM_ALL} ENABLE_GPU ${RAFT_FAISS_ENABLE_GPU}) diff --git a/dependencies.yaml b/dependencies.yaml index 9e208aac5f..1baf741a60 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -181,9 +181,8 @@ dependencies: - nlohmann_json>=3.11.2 - glog>=0.6.0 - h5py>=3.8.0 - - libfaiss=1.7.4 - benchmark>=1.8.2 - - faiss-proc=*=cuda + - rmm=23.10.* specific: - output_types: [conda, pyproject, requirements] matrices: From db2d21078d6a5b1d16ffcb326be09056533a8836 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Thu, 28 Sep 2023 13:03:23 -0400 Subject: [PATCH 20/34] Updates --- conda/environments/bench_ann_cuda-118_arch-x86_64.yaml | 2 +- dependencies.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml index 13d15156f2..c6e298dcd2 100644 --- a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml +++ b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml @@ -33,8 +33,8 @@ dependencies: - nccl>=2.9.9 - ninja - nlohmann_json>=3.11.2 -- rmm=23.10.* - nvcc_linux-64=11.8 +- rmm=23.10.* - scikit-build>=0.13.1 - sysroot_linux-64==2.17 name: bench_ann_cuda-118_arch-x86_64 diff --git a/dependencies.yaml b/dependencies.yaml index eba8e27196..4b90302400 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -178,6 +178,7 @@ dependencies: packages: - &rmm_conda rmm==23.10.* - output_types: requirements + packages: # pip recognizes the index as a global option for the requirements.txt file # This index is needed for rmm-cu{11,12}. From cb2eef89dfc39730b1752199fddd7aaef75dac94 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Thu, 28 Sep 2023 13:03:37 -0400 Subject: [PATCH 21/34] Reverting --- dependencies.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/dependencies.yaml b/dependencies.yaml index 4b90302400..eba8e27196 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -178,7 +178,6 @@ dependencies: packages: - &rmm_conda rmm==23.10.* - output_types: requirements - packages: # pip recognizes the index as a global option for the requirements.txt file # This index is needed for rmm-cu{11,12}. From 375c38e6bb0741fce0f97a942234c804d4f330f2 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Thu, 28 Sep 2023 15:23:06 -0400 Subject: [PATCH 22/34] Using https for faiss github repo --- cpp/cmake/thirdparty/get_faiss.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index b2d0cf20cf..d980a4497b 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -90,7 +90,7 @@ function(find_and_configure_faiss) endfunction() find_and_configure_faiss(VERSION 1.7.4 - REPOSITORY git@github.com:facebookresearch/faiss.git + REPOSITORY https://github.com/facebookresearch/faiss.git PINNED_TAG v1.7.4 BUILD_STATIC_LIBS ${RAFT_USE_FAISS_STATIC} EXCLUDE_FROM_ALL ${RAFT_EXCLUDE_FAISS_FROM_ALL} From c4fb53ce6adb732a2d1ae40606fdbf9d85e774c8 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 2 Oct 2023 18:12:04 -0400 Subject: [PATCH 23/34] Trying again --- cpp/cmake/thirdparty/get_faiss.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index d980a4497b..dde66c7a64 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -42,8 +42,6 @@ function(find_and_configure_faiss) list(APPEND RAFT_FAISS_EXPORT_GLOBAL_TARGETS faiss_avx2) endif() - - rapids_cpm_find(faiss ${PKG_VERSION} GLOBAL_TARGETS ${RAFT_FAISS_GLOBAL_TARGETS} CPM_ARGS @@ -57,7 +55,7 @@ function(find_and_configure_faiss) "FAISS_USE_CUDA_TOOLKIT_STATIC ${CUDA_STATIC_RUNTIME}" "BUILD_TESTING OFF" "CMAKE_MESSAGE_LOG_LEVEL VERBOSE" - "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" +# "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" ) if(TARGET faiss AND NOT TARGET faiss::faiss) From 8bb273c53e19b9a467e351350c43bd2b44b17f62 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 2 Oct 2023 18:21:17 -0400 Subject: [PATCH 24/34] Using corey's fork for now --- cpp/cmake/thirdparty/get_faiss.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index dde66c7a64..c758b6cc01 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -55,7 +55,7 @@ function(find_and_configure_faiss) "FAISS_USE_CUDA_TOOLKIT_STATIC ${CUDA_STATIC_RUNTIME}" "BUILD_TESTING OFF" "CMAKE_MESSAGE_LOG_LEVEL VERBOSE" -# "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" + "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" ) if(TARGET faiss AND NOT TARGET faiss::faiss) @@ -88,8 +88,8 @@ function(find_and_configure_faiss) endfunction() find_and_configure_faiss(VERSION 1.7.4 - REPOSITORY https://github.com/facebookresearch/faiss.git - PINNED_TAG v1.7.4 + REPOSITORY https://github.com/cjnolet/faiss.git + PINNED_TAG fea/statically-link-ctk BUILD_STATIC_LIBS ${RAFT_USE_FAISS_STATIC} EXCLUDE_FROM_ALL ${RAFT_EXCLUDE_FAISS_FROM_ALL} ENABLE_GPU ${RAFT_FAISS_ENABLE_GPU}) From d53931636dea919eaa110813317c57a5d557c1bf Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 2 Oct 2023 19:46:29 -0400 Subject: [PATCH 25/34] More updates --- cpp/cmake/thirdparty/get_faiss.cmake | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index c758b6cc01..4ec95f67c4 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -87,9 +87,23 @@ function(find_and_configure_faiss) rapids_export_find_package_root(BUILD faiss [=[${CMAKE_CURRENT_LIST_DIR}]=] raft-ann-bench-exports) endfunction() +if(NOT RAFT_FAISS_GIT_TAG) + # TODO: Remove this once faiss supports FAISS_USE_CUDA_TOOLKIT_STATIC + # (https://github.com/facebookresearch/faiss/pull/2446) + set(RAFT_FAISS_GIT_TAG fea/statically-link-ctk) + # set(RAFT_FAISS_GIT_TAG bde7c0027191f29c9dadafe4f6e68ca0ee31fb30) +endif() + +if(NOT RAFT_FAISS_GIT_REPOSITORY) + # TODO: Remove this once faiss supports FAISS_USE_CUDA_TOOLKIT_STATIC + # (https://github.com/facebookresearch/faiss/pull/2446) + set(RAFT_FAISS_GIT_REPOSITORY https://github.com/cjnolet/faiss.git) + # set(RAFT_FAISS_GIT_REPOSITORY https://github.com/facebookresearch/faiss.git) +endif() + find_and_configure_faiss(VERSION 1.7.4 - REPOSITORY https://github.com/cjnolet/faiss.git - PINNED_TAG fea/statically-link-ctk + REPOSITORY ${RAFT_FAISS_GIT_REPOSITORY} + PINNED_TAG ${RAFT_FAISS_GIT_TAG} BUILD_STATIC_LIBS ${RAFT_USE_FAISS_STATIC} EXCLUDE_FROM_ALL ${RAFT_EXCLUDE_FAISS_FROM_ALL} ENABLE_GPU ${RAFT_FAISS_ENABLE_GPU}) From fce179b56698b1edf65294acd50a1a489b54e69d Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 2 Oct 2023 21:35:13 -0400 Subject: [PATCH 26/34] CHecking cudatoolkit library dir --- cpp/bench/ann/CMakeLists.txt | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index f95cf67e5c..6d24835dec 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -249,7 +249,8 @@ if(TARGET faiss::faiss_avx2) endif() message("RAFT_FAISS_TARGETS: ${RAFT_FAISS_TARGETS}") - +message( + "CUDAToolkit_LIBRARY_DIR: ${CUDAToolkit_LIBRARY_DIR}) if(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT) ConfigureAnnBench( NAME FAISS_CPU_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS @@ -339,16 +340,17 @@ if(RAFT_ANN_BENCH_SINGLE_EXE) target_compile_definitions( ANN_BENCH PRIVATE - $<$:ANN_BENCH_LINK_CUDART="libcudart.so.${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}.${CUDAToolkit_VERSION_PATCH}"> - $<$:ANN_BENCH_NVTX3_HEADERS_FOUND> - ) + $<$:ANN_BENCH_LINK_CUDART="libcudart.so.${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}.${CUDAToolkit_VERSION_PATCH} + "> + $<$:ANN_BENCH_NVTX3_HEADERS_FOUND> +) - target_link_options(ANN_BENCH PRIVATE -export-dynamic) +target_link_options(ANN_BENCH PRIVATE -export-dynamic) - install( - TARGETS ANN_BENCH - COMPONENT ann_bench - DESTINATION bin/ann - EXCLUDE_FROM_ALL - ) +install( + TARGETS ANN_BENCH + COMPONENT ann_bench + DESTINATION bin/ann + EXCLUDE_FROM_ALL +) endif() From f54a75747b387e74c0b67aedf866a0a2d352e5da Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 2 Oct 2023 23:20:16 -0400 Subject: [PATCH 27/34] iTerminating string --- cpp/bench/ann/CMakeLists.txt | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index 6d24835dec..f85dc1deb7 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -249,8 +249,7 @@ if(TARGET faiss::faiss_avx2) endif() message("RAFT_FAISS_TARGETS: ${RAFT_FAISS_TARGETS}") -message( - "CUDAToolkit_LIBRARY_DIR: ${CUDAToolkit_LIBRARY_DIR}) +message("CUDAToolkit_LIBRARY_DIR: ${CUDAToolkit_LIBRARY_DIR}") if(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT) ConfigureAnnBench( NAME FAISS_CPU_FLAT PATH bench/ann/src/faiss/faiss_cpu_benchmark.cpp LINKS @@ -342,15 +341,15 @@ if(RAFT_ANN_BENCH_SINGLE_EXE) PRIVATE $<$:ANN_BENCH_LINK_CUDART="libcudart.so.${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}.${CUDAToolkit_VERSION_PATCH} "> - $<$:ANN_BENCH_NVTX3_HEADERS_FOUND> -) + $<$:ANN_BENCH_NVTX3_HEADERS_FOUND> + ) -target_link_options(ANN_BENCH PRIVATE -export-dynamic) + target_link_options(ANN_BENCH PRIVATE -export-dynamic) -install( - TARGETS ANN_BENCH - COMPONENT ann_bench - DESTINATION bin/ann - EXCLUDE_FROM_ALL -) + install( + TARGETS ANN_BENCH + COMPONENT ann_bench + DESTINATION bin/ann + EXCLUDE_FROM_ALL + ) endif() From 385b4f4de7ede5b658d1acb082d6b87a2bb056df Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 4 Oct 2023 13:49:48 -0400 Subject: [PATCH 28/34] Teach faiss about conda [hacky] --- cpp/bench/ann/CMakeLists.txt | 6 ++++++ cpp/cmake/thirdparty/get_faiss.cmake | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index f85dc1deb7..771d492ffb 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -103,6 +103,12 @@ if(RAFT_ANN_BENCH_USE_GGNN) endif() if(RAFT_ANN_BENCH_USE_FAISS) + # We need to ensure that faiss has all the conda + # information. So we currently use the very ugly + # hammer of `link_libraries` to ensure that all + # targets in this directory and the faiss directory + # will have the conda includes/link dirs + link_libraries($) include(cmake/thirdparty/get_faiss.cmake) endif() diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake index 4ec95f67c4..9d4840f524 100644 --- a/cpp/cmake/thirdparty/get_faiss.cmake +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -55,7 +55,6 @@ function(find_and_configure_faiss) "FAISS_USE_CUDA_TOOLKIT_STATIC ${CUDA_STATIC_RUNTIME}" "BUILD_TESTING OFF" "CMAKE_MESSAGE_LOG_LEVEL VERBOSE" - "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" ) if(TARGET faiss AND NOT TARGET faiss::faiss) From 95c12db3f7f7eb4c192a80556d3bd234ddaad15f Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 4 Oct 2023 16:34:44 -0400 Subject: [PATCH 29/34] Adding thread pool to overlap faiss queries --- cpp/bench/ann/src/common/thread_pool.hpp | 131 ++++++++++++++++++ .../ann/src/faiss/faiss_cpu_benchmark.cpp | 1 + cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h | 28 +++- cpp/bench/ann/src/hnswlib/hnswlib_wrapper.h | 110 +-------------- cpp/bench/ann/src/raft/raft_cagra_wrapper.h | 2 +- docs/source/ann_benchmarks_param_tuning.md | 13 +- 6 files changed, 171 insertions(+), 114 deletions(-) create mode 100644 cpp/bench/ann/src/common/thread_pool.hpp diff --git a/cpp/bench/ann/src/common/thread_pool.hpp b/cpp/bench/ann/src/common/thread_pool.hpp new file mode 100644 index 0000000000..efea938d5b --- /dev/null +++ b/cpp/bench/ann/src/common/thread_pool.hpp @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2023, NVIDIA CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class FixedThreadPool { + public: + FixedThreadPool(int num_threads) + { + if (num_threads < 1) { + throw std::runtime_error("num_threads must >= 1"); + } else if (num_threads == 1) { + return; + } + + tasks_ = new Task_[num_threads]; + + threads_.reserve(num_threads); + for (int i = 0; i < num_threads; ++i) { + threads_.emplace_back([&, i] { + auto& task = tasks_[i]; + while (true) { + std::unique_lock lock(task.mtx); + task.cv.wait(lock, + [&] { return task.has_task || finished_.load(std::memory_order_relaxed); }); + if (finished_.load(std::memory_order_relaxed)) { break; } + + task.task(); + task.has_task = false; + } + }); + } + } + + ~FixedThreadPool() + { + if (threads_.empty()) { return; } + + finished_.store(true, std::memory_order_relaxed); + for (unsigned i = 0; i < threads_.size(); ++i) { + auto& task = tasks_[i]; + std::lock_guard(task.mtx); + + task.cv.notify_one(); + threads_[i].join(); + } + + delete[] tasks_; + } + + template + void submit(Func f, IdxT len) + { + if (threads_.empty()) { + for (IdxT i = 0; i < len; ++i) { + f(i); + } + return; + } + + const int num_threads = threads_.size(); + // one extra part for competition among threads + const IdxT items_per_thread = len / (num_threads + 1); + std::atomic cnt(items_per_thread * num_threads); + + auto wrapped_f = [&](IdxT start, IdxT end) { + for (IdxT i = start; i < end; ++i) { + f(i); + } + + while (true) { + IdxT i = cnt.fetch_add(1, std::memory_order_relaxed); + if (i >= len) { break; } + f(i); + } + }; + + std::vector> futures; + futures.reserve(num_threads); + for (int i = 0; i < num_threads; ++i) { + IdxT start = i * items_per_thread; + auto& task = tasks_[i]; + { + std::lock_guard lock(task.mtx); + (void)lock; // stop nvcc warning + task.task = std::packaged_task([=] { wrapped_f(start, start + items_per_thread); }); + futures.push_back(task.task.get_future()); + task.has_task = true; + } + task.cv.notify_one(); + } + + for (auto& fut : futures) { + fut.wait(); + } + return; + } + + private: + struct alignas(64) Task_ { + std::mutex mtx; + std::condition_variable cv; + bool has_task = false; + std::packaged_task task; + }; + + Task_* tasks_; + std::vector threads_; + std::atomic finished_{false}; +}; diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp index 0552e8fa36..f11df605ee 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp +++ b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp @@ -76,6 +76,7 @@ void parse_search_param(const nlohmann::json& conf, { param.nprobe = conf.at("nprobe"); if (conf.contains("refine_ratio")) { param.refine_ratio = conf.at("refine_ratio"); } + if (conf.contains("numThreads")) { param.num_threads = conf.at("numThreads"); } } template class Algo> diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h index 3a78ca1724..a703fa9950 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h @@ -16,6 +16,8 @@ #pragma once #include "../common/ann_types.hpp" +#include "../common/thread_pool.hpp" + #include #include @@ -54,6 +56,7 @@ class FaissCpu : public ANN { struct SearchParam : public AnnSearchParam { int nprobe; float refine_ratio = 1.0; + int num_threads = omp_get_num_procs(); }; struct BuildParam { @@ -116,6 +119,9 @@ class FaissCpu : public ANN { faiss::MetricType metric_type_; int nlist_; double training_sample_fraction_; + + int num_threads_; + std::unique_ptr thread_pool_; }; template @@ -160,6 +166,11 @@ void FaissCpu::set_search_param(const AnnSearchParam& param) this->index_refine_ = std::make_unique(this->index_.get()); this->index_refine_.get()->k_factor = search_param.refine_ratio; } + + if (!thread_pool_ || num_threads_ != search_param.num_threads) { + num_threads_ = search_param.num_threads; + thread_pool_ = std::make_unique(num_threads_); + } } template @@ -172,7 +183,13 @@ void FaissCpu::search(const T* queries, { static_assert(sizeof(size_t) == sizeof(faiss::idx_t), "sizes of size_t and faiss::idx_t are different"); - index_->search(batch_size, queries, k, distances, reinterpret_cast(neighbors)); + + thread_pool_->submit( + [&](int i) { + // Use thread pool for batch size = 1. FAISS multi-threads internally for batch size > 1. + index_->search(batch_size, queries, k, distances, reinterpret_cast(neighbors)); + }, + 1); } template @@ -275,7 +292,14 @@ class FaissCpuFlat : public FaissCpu { } // class FaissCpu is more like a IVF class, so need special treating here - void set_search_param(const typename ANN::AnnSearchParam&) override{}; + void set_search_param(const typename ANN::AnnSearchParam& param) override + { + auto search_param = dynamic_cast::SearchParam&>(param); + if (!this->thread_pool_ || this->num_threads_ != search_param.num_threads) { + this->num_threads_ = search_param.num_threads; + this->thread_pool_ = std::make_unique(this->num_threads_); + } + }; void save(const std::string& file) const override { diff --git a/cpp/bench/ann/src/hnswlib/hnswlib_wrapper.h b/cpp/bench/ann/src/hnswlib/hnswlib_wrapper.h index 4d7b993aa1..df44605493 100644 --- a/cpp/bench/ann/src/hnswlib/hnswlib_wrapper.h +++ b/cpp/bench/ann/src/hnswlib/hnswlib_wrapper.h @@ -31,9 +31,8 @@ #include #include -#include - #include "../common/ann_types.hpp" +#include "../common/thread_pool.hpp" #include namespace raft::bench::ann { @@ -53,112 +52,6 @@ struct hnsw_dist_t { using type = int; }; -class FixedThreadPool { - public: - FixedThreadPool(int num_threads) - { - if (num_threads < 1) { - throw std::runtime_error("num_threads must >= 1"); - } else if (num_threads == 1) { - return; - } - - tasks_ = new Task_[num_threads]; - - threads_.reserve(num_threads); - for (int i = 0; i < num_threads; ++i) { - threads_.emplace_back([&, i] { - auto& task = tasks_[i]; - while (true) { - std::unique_lock lock(task.mtx); - task.cv.wait(lock, - [&] { return task.has_task || finished_.load(std::memory_order_relaxed); }); - if (finished_.load(std::memory_order_relaxed)) { break; } - - task.task(); - task.has_task = false; - } - }); - } - } - - ~FixedThreadPool() - { - if (threads_.empty()) { return; } - - finished_.store(true, std::memory_order_relaxed); - for (unsigned i = 0; i < threads_.size(); ++i) { - auto& task = tasks_[i]; - std::lock_guard(task.mtx); - - task.cv.notify_one(); - threads_[i].join(); - } - - delete[] tasks_; - } - - template - void submit(Func f, IdxT len) - { - if (threads_.empty()) { - for (IdxT i = 0; i < len; ++i) { - f(i); - } - return; - } - - const int num_threads = threads_.size(); - // one extra part for competition among threads - const IdxT items_per_thread = len / (num_threads + 1); - std::atomic cnt(items_per_thread * num_threads); - - auto wrapped_f = [&](IdxT start, IdxT end) { - for (IdxT i = start; i < end; ++i) { - f(i); - } - - while (true) { - IdxT i = cnt.fetch_add(1, std::memory_order_relaxed); - if (i >= len) { break; } - f(i); - } - }; - - std::vector> futures; - futures.reserve(num_threads); - for (int i = 0; i < num_threads; ++i) { - IdxT start = i * items_per_thread; - auto& task = tasks_[i]; - { - std::lock_guard lock(task.mtx); - (void)lock; // stop nvcc warning - task.task = std::packaged_task([=] { wrapped_f(start, start + items_per_thread); }); - futures.push_back(task.task.get_future()); - task.has_task = true; - } - task.cv.notify_one(); - } - - for (auto& fut : futures) { - fut.wait(); - } - return; - } - - private: - struct alignas(64) Task_ { - std::mutex mtx; - std::condition_variable cv; - bool has_task = false; - std::packaged_task task; - }; - - Task_* tasks_; - std::vector threads_; - std::atomic finished_{false}; -}; - template class HnswLib : public ANN { public: @@ -281,6 +174,7 @@ void HnswLib::search( { thread_pool_->submit( [&](int i) { + // hnsw can only handle a single vector at a time. get_search_knn_results_(query + i * dim_, k, indices + i * k, distances + i * k); }, batch_size); diff --git a/cpp/bench/ann/src/raft/raft_cagra_wrapper.h b/cpp/bench/ann/src/raft/raft_cagra_wrapper.h index 727a6ed830..19c5151186 100644 --- a/cpp/bench/ann/src/raft/raft_cagra_wrapper.h +++ b/cpp/bench/ann/src/raft/raft_cagra_wrapper.h @@ -52,7 +52,7 @@ class RaftCagra : public ANN { using BuildParam = raft::neighbors::cagra::index_params; - RaftCagra(Metric metric, int dim, const BuildParam& param) + RaftCagra(Metric metric, int dim, const BuildParam& param, int concurrent_searches = 1) : ANN(metric, dim), index_params_(param), dimension_(dim), diff --git a/docs/source/ann_benchmarks_param_tuning.md b/docs/source/ann_benchmarks_param_tuning.md index b70d1d788f..0faaeba59c 100644 --- a/docs/source/ann_benchmarks_param_tuning.md +++ b/docs/source/ann_benchmarks_param_tuning.md @@ -93,11 +93,16 @@ IVF-pq is an inverted-file index, which partitions the vectors into a series of | `numProbes` | `search_params` | Y | Positive Integer >0 | | The closest number of clusters to search for each query vector. Larger values will improve recall but will search more points in the index. | | `refine_ratio` | `search_params` | N| Positive Number >=0 | 0 | `refine_ratio * k` nearest neighbors are queried from the index initially and an additional refinement step improves recall by selecting only the best `k` neighbors. | -### `faiss_flat` +### `faiss_cpu_flat` Use FAISS flat index on the CPU, which performs an exact search using brute-force and doesn't have any further build or search parameters. -### `faiss_ivf_flat` + +| Parameter | Type | Required | Data Type | Default | Description | +|-----------|----------------|----------|---------------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `numThreads` | `search_params` | N | Positive Integer >0 | 1 | Number of threads to use for queries. | + +### `faiss_cpu_ivf_flat` Use FAISS IVF-Flat index on CPU @@ -106,8 +111,9 @@ Use FAISS IVF-Flat index on CPU | `nlists` | `build_param` | Y | Positive Integer >0 | | Number of clusters to partition the vectors into. Larger values will put less points into each cluster but this will impact index build time as more clusters need to be trained. | | `ratio` | `build_param` | N | Positive Integer >0 | 2 | `1/ratio` is the number of training points which should be used to train the clusters. | | `nprobe` | `search_params` | Y | Positive Integer >0 | | The closest number of clusters to search for each query vector. Larger values will improve recall but will search more points in the index. | +| `numThreads` | `search_params` | N | Positive Integer >0 | 1 | Number of threads to use for queries. | -### `faiss_ivf_pq` +### `faiss_cpu_ivf_pq` Use FAISS IVF-PQ index on CPU @@ -120,6 +126,7 @@ Use FAISS IVF-PQ index on CPU | `bitsPerCode` | `build_param` | N | Positive Integer [4-8] | 8 | Number of bits to use for each code. | | `numProbes` | `search_params` | Y | Positive Integer >0 | | The closest number of clusters to search for each query vector. Larger values will improve recall but will search more points in the index. | | `refine_ratio` | `search_params` | N| Positive Number >=0 | 0 | `refine_ratio * k` nearest neighbors are queried from the index initially and an additional refinement step improves recall by selecting only the best `k` neighbors. | +| `numThreads` | `search_params` | N | Positive Integer >0 | 1 | Number of threads to use for queries. | ## HNSW From 1e7b5c8605472e9e433ad1a5a84da86602f1933e Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Thu, 5 Oct 2023 23:19:46 -0400 Subject: [PATCH 30/34] Seeing if this fixes the devcontainers --- .../environments/bench_ann_cuda-118_arch-x86_64.yaml | 1 - .../raft-ann-bench-cpu/conda_build_config.yaml | 3 --- conda/recipes/raft-ann-bench-cpu/meta.yaml | 2 -- conda/recipes/raft-ann-bench/conda_build_config.yaml | 3 --- conda/recipes/raft-ann-bench/meta.yaml | 10 ---------- cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp | 12 ++++++------ cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h | 2 ++ cpp/bench/ann/src/faiss/faiss_gpu_wrapper.h | 2 ++ dependencies.yaml | 7 ------- 9 files changed, 10 insertions(+), 32 deletions(-) diff --git a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml index c6e298dcd2..4e33ee435f 100644 --- a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml +++ b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml @@ -29,7 +29,6 @@ dependencies: - libcusolver=11.4.1.48 - libcusparse-dev=11.7.5.86 - libcusparse=11.7.5.86 -- libfaiss-avx2=1.7.4 - nccl>=2.9.9 - ninja - nlohmann_json>=3.11.2 diff --git a/conda/recipes/raft-ann-bench-cpu/conda_build_config.yaml b/conda/recipes/raft-ann-bench-cpu/conda_build_config.yaml index 1f8ac137bf..0bd424f85b 100644 --- a/conda/recipes/raft-ann-bench-cpu/conda_build_config.yaml +++ b/conda/recipes/raft-ann-bench-cpu/conda_build_config.yaml @@ -10,9 +10,6 @@ sysroot_version: cmake_version: - ">=3.26.4" -faiss_version: - - "1.7.4" - glog_version: - ">=0.6.0" diff --git a/conda/recipes/raft-ann-bench-cpu/meta.yaml b/conda/recipes/raft-ann-bench-cpu/meta.yaml index 7df2c60f7e..71571465c1 100644 --- a/conda/recipes/raft-ann-bench-cpu/meta.yaml +++ b/conda/recipes/raft-ann-bench-cpu/meta.yaml @@ -47,7 +47,6 @@ requirements: host: - glog {{ glog_version }} - matplotlib -# - faiss-cpu {{ faiss_version }} - nlohmann_json {{ nlohmann_json_version }} - python - pyyaml @@ -56,7 +55,6 @@ requirements: run: - glog {{ glog_version }} - h5py {{ h5py_version }} -# - faiss-cpu {{ faiss_version }} - matplotlib - python - pyyaml diff --git a/conda/recipes/raft-ann-bench/conda_build_config.yaml b/conda/recipes/raft-ann-bench/conda_build_config.yaml index 335ca82e89..da0b893c1d 100644 --- a/conda/recipes/raft-ann-bench/conda_build_config.yaml +++ b/conda/recipes/raft-ann-bench/conda_build_config.yaml @@ -25,9 +25,6 @@ gtest_version: glog_version: - ">=0.6.0" -faiss_version: - - "1.7.4" - h5py_version: - ">=3.8.0" diff --git a/conda/recipes/raft-ann-bench/meta.yaml b/conda/recipes/raft-ann-bench/meta.yaml index 2270460df6..1c6fa5723b 100644 --- a/conda/recipes/raft-ann-bench/meta.yaml +++ b/conda/recipes/raft-ann-bench/meta.yaml @@ -70,11 +70,6 @@ requirements: {% endif %} - glog {{ glog_version }} - nlohmann_json {{ nlohmann_json_version }} - # Temporarily ignore faiss benchmarks on CUDA 12 because packages do not exist yet -# {% if cuda_major == "11" %} -# - faiss-proc=*=cuda -# - libfaiss {{ faiss_version }} -# {% endif %} - h5py {{ h5py_version }} - benchmark - matplotlib @@ -92,11 +87,6 @@ requirements: - cudatoolkit {% endif %} - glog {{ glog_version }} - # Temporarily ignore faiss benchmarks on CUDA 12 because packages do not exist yet -# {% if cuda_major == "11" %} -# - faiss-proc=*=cuda -# - libfaiss {{ faiss_version }} -# {% endif %} - h5py {{ h5py_version }} - benchmark - glog {{ glog_version }} diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp index f11df605ee..97d1bbf307 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp +++ b/cpp/bench/ann/src/faiss/faiss_cpu_benchmark.cpp @@ -116,13 +116,13 @@ std::unique_ptr> create_algo(const std::string& algo, if constexpr (std::is_same_v) { raft::bench::ann::Metric metric = parse_metric(distance); - if (algo == "faiss_gpu_ivf_flat") { + if (algo == "faiss_cpu_ivf_flat") { ann = make_algo(metric, dim, conf, dev_list); - } else if (algo == "faiss_gpu_ivf_pq") { + } else if (algo == "faiss_cpu_ivf_pq") { ann = make_algo(metric, dim, conf); - } else if (algo == "faiss_gpu_ivf_sq") { + } else if (algo == "faiss_cpu_ivf_sq") { ann = make_algo(metric, dim, conf); - } else if (algo == "faiss_gpu_flat") { + } else if (algo == "faiss_cpu_flat") { ann = std::make_unique>(metric, dim); } } @@ -138,11 +138,11 @@ template std::unique_ptr::AnnSearchParam> create_search_param( const std::string& algo, const nlohmann::json& conf) { - if (algo == "faiss_gpu_ivf_flat" || algo == "faiss_gpu_ivf_pq" || algo == "faiss_gpu_ivf_sq") { + if (algo == "faiss_cpu_ivf_flat" || algo == "faiss_cpu_ivf_pq" || algo == "faiss_cpu_ivf_sq") { auto param = std::make_unique::SearchParam>(); parse_search_param(conf, *param); return param; - } else if (algo == "faiss_gpu_flat") { + } else if (algo == "faiss_cpu_flat") { auto param = std::make_unique::AnnSearchParam>(); return param; } diff --git a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h index a703fa9950..028a444530 100644 --- a/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_cpu_wrapper.h @@ -248,6 +248,8 @@ class FaissCpuIVFPQ : public FaissCpu { void load(const std::string& file) override { this->template load_(file); } }; +// TODO: Enable this in cmake +// ref: https://github.com/rapidsai/raft/issues/1876 template class FaissCpuIVFSQ : public FaissCpu { public: diff --git a/cpp/bench/ann/src/faiss/faiss_gpu_wrapper.h b/cpp/bench/ann/src/faiss/faiss_gpu_wrapper.h index 6144f89bd4..38eeddf813 100644 --- a/cpp/bench/ann/src/faiss/faiss_gpu_wrapper.h +++ b/cpp/bench/ann/src/faiss/faiss_gpu_wrapper.h @@ -311,6 +311,8 @@ class FaissGpuIVFPQ : public FaissGpu { } }; +// TODO: Enable this in cmake +// ref: https://github.com/rapidsai/raft/issues/1876 template class FaissGpuIVFSQ : public FaissGpu { public: diff --git a/dependencies.yaml b/dependencies.yaml index c8bdfe6da7..b9df7d34c3 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -227,13 +227,6 @@ dependencies: - h5py>=3.8.0 - benchmark>=1.8.2 - rmm=23.10.* - specific: - - output_types: [conda, pyproject, requirements] - matrices: - - matrix: - arch: x86_64 - packages: - - libfaiss-avx2=1.7.4 nn_bench_python: common: - output_types: [conda] From 667b95c4211ba45df9914cd2e720f8acf151b410 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Fri, 6 Oct 2023 00:21:53 -0400 Subject: [PATCH 31/34] Fixing dependencies.yml --- conda/environments/bench_ann_cuda-118_arch-x86_64.yaml | 2 +- dependencies.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml index 4e33ee435f..98b07c2c3f 100644 --- a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml +++ b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml @@ -33,7 +33,7 @@ dependencies: - ninja - nlohmann_json>=3.11.2 - nvcc_linux-64=11.8 -- rmm=23.10.* +- rmm=23.12.* - scikit-build>=0.13.1 - sysroot_linux-64==2.17 name: bench_ann_cuda-118_arch-x86_64 diff --git a/dependencies.yaml b/dependencies.yaml index b9df7d34c3..e3ca128340 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -226,7 +226,7 @@ dependencies: - glog>=0.6.0 - h5py>=3.8.0 - benchmark>=1.8.2 - - rmm=23.10.* + - rmm=23.12.* nn_bench_python: common: - output_types: [conda] From daffaf475ff17f561d6d64ed2e4cd2f204686c6a Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Fri, 6 Oct 2023 22:04:27 -0400 Subject: [PATCH 32/34] Adding openblas to nn_bench deps --- conda/environments/bench_ann_cuda-118_arch-x86_64.yaml | 1 + dependencies.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml index 98b07c2c3f..051dad7eaa 100644 --- a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml +++ b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml @@ -33,6 +33,7 @@ dependencies: - ninja - nlohmann_json>=3.11.2 - nvcc_linux-64=11.8 +- openblas - rmm=23.12.* - scikit-build>=0.13.1 - sysroot_linux-64==2.17 diff --git a/dependencies.yaml b/dependencies.yaml index e3ca128340..11d14c7be9 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -227,6 +227,7 @@ dependencies: - h5py>=3.8.0 - benchmark>=1.8.2 - rmm=23.12.* + - openblas nn_bench_python: common: - output_types: [conda] From 86384107864d18679d281cb8a375fa4847477deb Mon Sep 17 00:00:00 2001 From: Dante Gama Dessavre Date: Tue, 10 Oct 2023 09:42:33 -0500 Subject: [PATCH 33/34] FIX add cpu targets to CUDA 12 faiss exception --- cpp/bench/ann/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index 771d492ffb..3314299ba0 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -63,6 +63,9 @@ else() set(RAFT_ANN_BENCH_USE_FAISS_GPU_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_PQ OFF) + set(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT OFF) + set(RAFT_ANN_BENCH_USE_FAISS_CPU_IVFPQ OFF) + set(RAFT_ANN_BENCH_USE_FAISS_CPU_IFFLAT OFF) else() set(RAFT_FAISS_ENABLE_GPU ON) endif() @@ -70,8 +73,8 @@ endif() set(RAFT_ANN_BENCH_USE_FAISS OFF) if(RAFT_ANN_BENCH_USE_FAISS_GPU_FLAT - OR RAFT_ANN_BENCH_USE_FAISS_GPU_IVFPQ - OR RAFT_ANN_BENCH_USE_FAISS_IFFLAT + OR RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_PQ + OR RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_FLAT OR RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT OR RAFT_ANN_BENCH_USE_FAISS_CPU_IVFPQ OR RAFT_ANN_BENCH_USE_FAISS_CPU_IFFLAT From bdc8d9a6a6991e44a5354ac874e28ae024d8c138 Mon Sep 17 00:00:00 2001 From: Dante Gama Dessavre Date: Tue, 10 Oct 2023 10:00:42 -0500 Subject: [PATCH 34/34] FIX ivf_flat and pq cmake variable underscores --- cpp/bench/ann/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index 3314299ba0..502f371a25 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -64,8 +64,8 @@ else() set(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_FLAT OFF) set(RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_PQ OFF) set(RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT OFF) - set(RAFT_ANN_BENCH_USE_FAISS_CPU_IVFPQ OFF) - set(RAFT_ANN_BENCH_USE_FAISS_CPU_IFFLAT OFF) + set(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_PQ OFF) + set(RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT OFF) else() set(RAFT_FAISS_ENABLE_GPU ON) endif() @@ -76,8 +76,8 @@ if(RAFT_ANN_BENCH_USE_FAISS_GPU_FLAT OR RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_PQ OR RAFT_ANN_BENCH_USE_FAISS_GPU_IVF_FLAT OR RAFT_ANN_BENCH_USE_FAISS_CPU_FLAT - OR RAFT_ANN_BENCH_USE_FAISS_CPU_IVFPQ - OR RAFT_ANN_BENCH_USE_FAISS_CPU_IFFLAT + OR RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_PQ + OR RAFT_ANN_BENCH_USE_FAISS_CPU_IVF_FLAT ) set(RAFT_ANN_BENCH_USE_FAISS ON) set(RAFT_USE_FAISS_STATIC ON)