Skip to content

Commit

Permalink
Fixing style
Browse files Browse the repository at this point in the history
  • Loading branch information
cjnolet committed Oct 12, 2023
1 parent c4eee56 commit 3e9079d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion conda/environments/bench_ann_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions cpp/bench/ann/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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($<TARGET_NAME_IF_EXISTS:conda_env>)
include(cmake/thirdparty/get_faiss.cmake)
Expand Down
4 changes: 2 additions & 2 deletions cpp/bench/ann/src/common/benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -194,7 +194,7 @@ void bench_search(::benchmark::State& state,
if (!current_algo || (algo = dynamic_cast<ANN<T>*>(current_algo.get())) == nullptr) {
std::cout << "Loading algo" << std::endl;
created_new_algo = true;
auto ualgo = ann::create_algo<T>(
auto ualgo = ann::create_algo<T>(
index.algo, dataset->distance(), dataset->dim(), index.build_param, index.dev_list);
algo = ualgo.get();
algo->load(index_file);
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/raft/neighbors/cagra_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ struct index : ann::index {
metric_(metric),
dataset_(make_device_matrix<T, int64_t>(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<IdxT, int64_t>(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");
Expand Down
15 changes: 8 additions & 7 deletions cpp/include/raft/neighbors/detail/cagra/cagra_build.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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<IdxT>(dataset.extent(1) * 2, build_params->n_lists);
search_params->n_probes = 50; // std::min<IdxT>(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<IdxT>(std::max(gpu_top_k, top_k), dataset.extent(0));
const auto num_queries = dataset.extent(0);
const auto max_batch_size = 1024;
Expand Down

0 comments on commit 3e9079d

Please sign in to comment.