Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue in IndexFlatIP #4121

Open
2 of 4 tasks
Museum7432 opened this issue Jan 9, 2025 · 0 comments
Open
2 of 4 tasks

Performance issue in IndexFlatIP #4121

Museum7432 opened this issue Jan 9, 2025 · 0 comments

Comments

@Museum7432
Copy link

Museum7432 commented Jan 9, 2025

Summary

IndexFlatIP doesn't seem to use parallelization correctly, as my custom flat index is somehow 2x to 3x (depends on the number of threads) faster than IndexFlatIP when I wrote a benchmark to compare the two. I kind of expected mine to be slower than Faiss as it is the same under the hood with fewer optimizations, not faster like this.

Platform

OS: Linux

Faiss version: 1.9.0

Installed from: faiss-cpu from anaconda and pip

Running on:

  • CPU
  • GPU

Interface:

  • C++
  • Python

Reproduction instructions

Here is the colab notebook for reproducing the problem.
It could be caused by the memory access pattern in IndexFlatIP (like why does the function fvec_inner_products_by_idx parallelize over the queries not ids, I can't read the code for dispatch_knn_ResultHandler though, so i can't say it is caused by it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants