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

index_cpu_to_all_gpus is very slow for the first time #4221

Open
abhishekukmeesho opened this issue Mar 4, 2025 · 3 comments
Open

index_cpu_to_all_gpus is very slow for the first time #4221

abhishekukmeesho opened this issue Mar 4, 2025 · 3 comments

Comments

@abhishekukmeesho
Copy link

abhishekukmeesho commented Mar 4, 2025

I have a simple code where I load the index from a path and converting it to a GPU index

faiss_index = faiss.read_index('/path/to/specific/faiss.index')
faiss_index_gpu = faiss.index_cpu_to_all_gpus(faiss_index)

I'm using:

Python = 3.10
faiss-gpu==1.7.2
CUDA version (torch): 11.8
Size of the index ~= 800MB
Machine = g2-standard-8 = Nvidia L4 +  8vCPU + 32G CPU mem

The issue is, whenever I run it for the first time, it almost takes 20 minutes for the second line to execute(index_cpu_to_all_gpus). But if I load a new index later on and call the same function or even run the same code block the second time, it finishes within a couple of seconds.

So I wanted to understand why is this behaviour seen and if I am making any mistake. Any help is appreciated.

@Arcmoon-Hu
Copy link

same issue

@mdouze
Copy link
Contributor

mdouze commented Mar 6, 2025

@abhishekukmeesho
Copy link
Author

I used the 1.7.3 version with wheel as explained here (kyamagu/faiss-wheels#54 (comment)) and it seems to have solved the issue. Now the load happens instantaneously.

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

5 participants