[FEA] Expose algorithm selection in `matrix.select_k` python API

Open
#2,427 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, python
Domain
api

Research direction

Start with the pylibraft.matrix.select_k Python API and compare its signature with the C++ select_k API, especially the SelectAlgo argument and available enum values. Trace the Python binding and any associated tests, then verify that callers can choose the algorithm and that the selected option reaches the C++ implementation.

Written by the indexing model from the issue text.

Description

feature request

Is your feature request related to a problem? Please describe.
The current python API (here) in pylibraft.matrix.select_k does not expose the algorithm selection that the C++ API does, see here. Instead it uses the default value which automatically selects the algorithm.

Describe the solution you'd like
I'd suggest passing an extra enum argument to the function that allows selecting the algorithm similar to the C++ API.

Describe alternatives you've considered
In a benchmark, the default automatic algorithm performs poorly (~10X slower) than the AIR-TopK reported in this paper. Using the C++ API, I can reproduce the same timings reported in the paper when choosing raft::matrix::SelectAlgo::kRadix11bits algorithm.

Additional context
C++ documentation is provided here.

Dominant language
Cuda
Stars
1.1k
Forks
260
Avg merge
1d 18h
Merged PRs (30d)
21

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/raft

All issues in NVIDIA/raft

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.