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

Selection of GPU and data quantity in IndexIVFPQ experiment #1551

Closed
2 of 4 tasks
Aurevoir-68 opened this issue Dec 3, 2020 · 2 comments
Closed
2 of 4 tasks

Selection of GPU and data quantity in IndexIVFPQ experiment #1551

Aurevoir-68 opened this issue Dec 3, 2020 · 2 comments

Comments

@Aurevoir-68
Copy link

Summary

Platform

OS:

Faiss version:

Installed from:

Faiss compilation options:

Running on:

  • CPU
  • GPU

Interface:

  • C++
  • Python

Reproduction instructions

The experiment was carried out in NVIDIA docker,nb = 500w, d = 512, There are three graphics cards:

  1. 1080(8G)
  2. 2080ti(11G)
  3. 1080(8G)

I encountered the following problems in the ivfpq experiment:

(1) When running a program with multiple GPUs, the difference between faiss::gpu::index_ cpu_ to_ gpu_multiple method and faiss::gpu::GpuiIndexIVFPQ?

(2) Can faiss::gpu::GpuiIndexIVFPQ method control the number of graphics cards and which one ?(I know the method of faiss:: GPU:: index_ cpu_to_gpu_ Multiple can control the number of GPUs)

(3) When I use nb = 4000000, d = 512,there is no problem. **When I modify nb = 5000000, an error is reported:

terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted(core dumped)

In addition, the graphics card uses one 2080ti by default. Shouldn't it be 1080 in order?

faiss::IndexFlatL2 quantizer(d);
faiss::IndexIVFPQ cpu_index(&quantizer,d,nlist,m,8);
faiss::Index * gpu_index=faiss::gpu::index_cpu_to_gpu_multiple(res,devs,&cpu_index);
faiss::gpu::GpuIndexIVFPQConfig config;
config.device = 1;
faiss::gpu::GpuIndexIVFPQ index(&res,d,nlist,m,8,faiss::METRIC_L2,config);
@wickedfoo
Copy link
Contributor

  1. index_cpu_to_gpu_multiple is just a wrapper around calling the GpuIndexIVFPQ constructor. In C++ I'd probably prefer calling the constructor yourself, though the multiple part wraps the indices in an IndexShards or IndexReplicas object, which dedicates a separate thread to each GPU. In order to effectively use multiple GPUs you'll want a separate CPU thread for each index on each GPU.

  2. The GpuIndexIVFPQConfig object contains a field device that says which GPU a particular index will use.

  3. yes. Note that 5000000 x 512 x sizeof(float) is 10.24 GB, which is likely exceeding the memory available/remaining on your GPU.

  4. 2080ti vs 1080, you are specifying config.device = 1. Nvidia specifies devices numbered from 0. You yourself have the 2080ti device as device Faiss not working #1 above, so don't see what the issue is here?

@mdouze
Copy link
Contributor

mdouze commented Jan 5, 2021

no activity, closing.

@mdouze mdouze closed this as completed Jan 5, 2021
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

3 participants