GPU memory usage increases after creating new instances in different threads #3639
Replies: 2 comments
-
Any GPU indices that share a single GpuResources object can only be used one at a time from any thread. A GpuResources object attempts to reserve 1.5 GB by default for each GPU that it is used on. Examples: create 4 GpuIndex instances on the same GPU, sharing the same GpuResources object. OK: using these 4 indices sequentially in the same CPU thread. create 2 GpuIndex instances on different GPUs, sharing the same GpuResources object. OK: using these 2 indices sequentially in the same CPU thread. I might consider adding a mutex to GpuResources itself so as to make this always safe, though you might not get the concurrency that you prefer when using different CPU threads. |
Beta Was this translation helpful? Give feedback.
-
Did you solve it? I also want to use Faiss on multi gpu with multi threads and I don't know how to use it correctly. |
Beta Was this translation helpful? Give feedback.
-
Summary
Platform
OS:
Faiss version: 1.7.0
Installed from: pypip
Faiss compilation options:
Running on: I9 9900X - 32GB - RTX 2080ti
Interface:
Reproduction instructions
Each time I create a new instance, faiss-gpu is allocated a large amount of GPU memosy.
https://github.com/HoangTienDuc/github_issues/blob/faiss/subcrib_message.py#L34
So with 11gb GPU memory I can only create 5 threads on it.
How to solve this problem? I want to create more threads.
Can you please take a check at https://github.com/HoangTienDuc/github_issues/tree/faiss#issue-detail
Beta Was this translation helpful? Give feedback.
All reactions