From 3e9079d432946c02a6e6efb3917206b82af5e711 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Thu, 12 Oct 2023 14:13:21 -0400 Subject: [PATCH] Fixing style --- .../bench_ann_cuda-118_arch-x86_64.yaml | 2 +- cpp/bench/ann/CMakeLists.txt | 6 ++---- cpp/bench/ann/src/common/benchmark.hpp | 4 ++-- cpp/include/raft/neighbors/cagra_types.hpp | 4 ++-- .../raft/neighbors/detail/cagra/cagra_build.cuh | 15 ++++++++------- 5 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 2665ce4205..2c92ad0a99 100644 --- a/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml +++ b/conda/environments/bench_ann_cuda-118_arch-x86_64.yaml @@ -37,7 +37,7 @@ dependencies: - openblas - pandas - pyyaml -- rmm=23.12.* +- rmm==23.12.* - scikit-build>=0.13.1 - sysroot_linux-64==2.17 name: bench_ann_cuda-118_arch-x86_64 diff --git a/cpp/bench/ann/CMakeLists.txt b/cpp/bench/ann/CMakeLists.txt index a3f5eaffaf..bfc9e24730 100644 --- a/cpp/bench/ann/CMakeLists.txt +++ b/cpp/bench/ann/CMakeLists.txt @@ -106,10 +106,8 @@ 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 + # 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) diff --git a/cpp/bench/ann/src/common/benchmark.hpp b/cpp/bench/ann/src/common/benchmark.hpp index 9e09e74369..0a398ade1d 100644 --- a/cpp/bench/ann/src/common/benchmark.hpp +++ b/cpp/bench/ann/src/common/benchmark.hpp @@ -182,7 +182,7 @@ void bench_search(::benchmark::State& state, } // algo is static to cache it between close search runs to save time on index loading static std::string index_file = ""; - bool created_new_algo = false; + bool created_new_algo = false; if (index.file != index_file) { current_algo.reset(); index_file = index.file; @@ -194,7 +194,7 @@ void bench_search(::benchmark::State& state, if (!current_algo || (algo = dynamic_cast*>(current_algo.get())) == nullptr) { std::cout << "Loading algo" << std::endl; created_new_algo = true; - auto ualgo = ann::create_algo( + auto ualgo = ann::create_algo( index.algo, dataset->distance(), dataset->dim(), index.build_param, index.dev_list); algo = ualgo.get(); algo->load(index_file); diff --git a/cpp/include/raft/neighbors/cagra_types.hpp b/cpp/include/raft/neighbors/cagra_types.hpp index ed624d2f8d..ff0eb2b6c6 100644 --- a/cpp/include/raft/neighbors/cagra_types.hpp +++ b/cpp/include/raft/neighbors/cagra_types.hpp @@ -266,10 +266,10 @@ struct index : ann::index { metric_(metric), dataset_(make_device_matrix(res, 0, 0)), dataset_pinned_(0, resource::get_cuda_stream(res), mr_huge_.get()), - //dataset_pinned_(0, resource::get_cuda_stream(res), mr_.get()), + // dataset_pinned_(0, resource::get_cuda_stream(res), mr_.get()), graph_(make_device_matrix(res, 0, 0)), graph_pinned_(0, resource::get_cuda_stream(res), mr_huge_.get()) - //graph_pinned_(0, resource::get_cuda_stream(res), mr_.get()) + // graph_pinned_(0, resource::get_cuda_stream(res), mr_.get()) { RAFT_EXPECTS(dataset.extent(0) == knn_graph.extent(0), "Dataset and knn_graph must have equal number of rows"); diff --git a/cpp/include/raft/neighbors/detail/cagra/cagra_build.cuh b/cpp/include/raft/neighbors/detail/cagra/cagra_build.cuh index e2365b14c3..b9fc83bc5b 100644 --- a/cpp/include/raft/neighbors/detail/cagra/cagra_build.cuh +++ b/cpp/include/raft/neighbors/detail/cagra/cagra_build.cuh @@ -59,12 +59,13 @@ void build_knn_graph(raft::resources const& res, node_degree); if (!build_params) { - build_params = ivf_pq::index_params{}; - build_params->n_lists = 16384; //dataset.extent(0) < 4 * 2500 ? 4 : (uint32_t)(dataset.extent(0) / 2500); - build_params->pq_dim = 32; //raft::Pow2<8>::roundUp(dataset.extent(1) / 2); - build_params->pq_bits = 8; + build_params = ivf_pq::index_params{}; + build_params->n_lists = + 16384; // dataset.extent(0) < 4 * 2500 ? 4 : (uint32_t)(dataset.extent(0) / 2500); + build_params->pq_dim = 32; // raft::Pow2<8>::roundUp(dataset.extent(1) / 2); + build_params->pq_bits = 8; build_params->kmeans_trainset_fraction = dataset.extent(0) < 10000 ? 1 : 10; - build_params->kmeans_n_iters = 10; //25; + build_params->kmeans_n_iters = 10; // 25; build_params->add_data_on_build = true; } @@ -94,12 +95,12 @@ void build_knn_graph(raft::resources const& res, // if (!search_params) { search_params = ivf_pq::search_params{}; - search_params->n_probes = 50; //std::min(dataset.extent(1) * 2, build_params->n_lists); + search_params->n_probes = 50; // std::min(dataset.extent(1) * 2, build_params->n_lists); search_params->lut_dtype = CUDA_R_16F; search_params->internal_distance_dtype = CUDA_R_16F; } const auto top_k = node_degree + 1; - uint32_t gpu_top_k = node_degree * 4; //refine_rate.value_or(2.0f); + uint32_t gpu_top_k = node_degree * 4; // refine_rate.value_or(2.0f); gpu_top_k = std::min(std::max(gpu_top_k, top_k), dataset.extent(0)); const auto num_queries = dataset.extent(0); const auto max_batch_size = 1024;