[QST] the nn_descent_params.n_clusters
Nobody has claimed this yet.
- Dominant language
- Cuda
- Stars
- 854
- Forks
- 236
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 62
Description
What is your question?
I would like to know how to use CAGRA's NNDescent to build a KNN graph when the dataset size exceeds GPU memory capacity.
When I use the Deep10M dataset, the GPU memory usage is:
n_clusters = 1 → 12,265 MB
n_clusters = 32 → 10,671 MB
n_clusters = 64 → 9,903 MB
So I’m concerned that using Deep100M will cause memory usage to exceed the 80 GB limit on the A100 GPU.
What I’ve tried
Here is the code I’m currently using:
void buildknn_baseline(raft::device_resources const &dev_resources,
const raft::host_matrix_view<const float, int64_t> & dataset,
size_t k, size_t iterN, std::string gd_knng_path, std::string dst_path)
{
using namespace cuvs::neighbors::nn_descent;
using IdxT = u_int32_t;
nn_descent::index_params build_params;
build_params.max_iterations = iterN;
build_params.graph_degree = k;
build_params.return_distances = false;
build_params.n_clusters = 64;
auto knn_graph = raft::make_host_matrix<IdxT, IdxT>(dataset.extent(0), build_params.graph_degree);
build(dev_resources, build_params, dataset, knn_graph.view());
}
int main(int argc, char* argv[])
{
auto host_data = raft::make_host_matrix<float, int64_t>(n_samples, n_dim);
for (size_t i = 0; i < n_samples; ++i) {
for (size_t j = 0; j < n_dim; ++j) {
host_data(i, j) = *(base_data + i * data_dim + j);
}
}
buildknn_baseline(dev_resources, raft::make_const_mdspan(host_data.view()), K, iterN, gd_knng_path, dstPath);
return 0;
}
My Questions
Is there a recommended way to build a large NNDescent-based graph that exceeds GPU memory limits?
How does n_clusters affect memory usage, and is there a way to process the graph in batches or chunks?
Would you recommend a hybrid CPU-GPU strategy, or using host memory to offload intermediate data?
Thanks in advance!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the shown nn_descent::index_params configuration and the build(dev_resources, build_params, dataset, knn_graph.view()) call. Determine how n_clusters affects memory and whether the requested large-dataset, batching, or host-memory workflows are supported; done means providing a clear, actionable answer or documenting the supported approach and limits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- machine-learning, performance
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100