faiss
faiss copied to clipboard
add_with_ids fails on GPU but works after moving the index to the CPU, is this expected?
Summary
add_with_ids fails on GPU but works after moving the index to the CPU, is this expected? Thank you in advance!
Platform
OS: nvidia/cuda:12.1.1-devel-ubuntu22.04
Faiss version: 1.8.0 / py3.11_hedc54c9_0_cuda11.4.4
Installed from: conda install -c pytorch -c nvidia faiss-gpu -y
Faiss compilation options: N/A
Running on:
- [X] CPU
- [X] GPU
Interface:
- [ ] C++
- [X] Python
Reproduction instructions
import faiss
import numpy
idx = faiss.index_factory(1024, 'OPQ48_336,IVF131072,PQ48x8', faiss.METRIC_INNER_PRODUCT)
idx = faiss.index_cpu_to_all_gpus(idx)
idx.train(numpy.random.rand(131072, 1024).astype(numpy.float32))
idx.add_with_ids(numpy.random.rand(3, 1024).astype(numpy.float32), numpy.array([4, 5, 6], numpy.int64)) # fails
idx = faiss.index_gpu_to_cpu(objIndex)
idx.add_with_ids(numpy.random.rand(3, 1024).astype(numpy.float32), numpy.array([4, 5, 6], numpy.int64)) # works