Base inverted list functionality for IVFFlat and IVFPQ. More...
Public Member Functions | |
| IVFBase (GpuResources *resources, FlatIndex *quantizer, int bytesPerVector, IndicesOptions indicesOptions) | |
| void | reserveMemory (size_t numVecs) |
| Reserve GPU memory in our inverted lists for this number of vectors. | |
| void | reset () |
| int | getDim () const |
| Return the number of dimensions we are indexing. | |
| size_t | reclaimMemory () |
| size_t | getNumLists () const |
| Returns the number of inverted lists. | |
| int | getListLength (int listId) const |
| std::vector< long > | getListIndices (int listId) const |
| Return the list indices of a particular list back to the CPU. | |
Protected Member Functions | |
| size_t | reclaimMemory_ (bool exact) |
| void | updateDeviceListInfo_ (cudaStream_t stream) |
| Update all device-side list pointer and size information. | |
| void | updateDeviceListInfo_ (const std::vector< int > &listIds, cudaStream_t stream) |
| void | addIndicesFromCpu_ (int listId, const long *indices, size_t numVecs) |
| Shared function to copy indices from CPU to GPU. | |
Protected Attributes | |
| GpuResources * | resources_ |
| Collection of GPU resources that we use. | |
| FlatIndex * | quantizer_ |
| Quantizer object. | |
| const int | dim_ |
| Expected dimensionality of the vectors. | |
| const int | numLists_ |
| Number of inverted lists we maintain. | |
| const int | bytesPerVector_ |
| Number of bytes per vector in the list. | |
| const IndicesOptions | indicesOptions_ |
| How are user indices stored on the GPU? | |
| thrust::device_vector< void * > | deviceListDataPointers_ |
| thrust::device_vector< void * > | deviceListIndexPointers_ |
| thrust::device_vector< int > | deviceListLengths_ |
| int | maxListLength_ |
| Maximum list length seen. | |
| std::vector< std::unique_ptr < DeviceVector< unsigned char > > > | deviceListData_ |
|
std::vector< std::unique_ptr < DeviceVector< unsigned char > > > | deviceListIndices_ |
| std::vector< std::vector< long > > | listOffsetToUserIndex_ |
Base inverted list functionality for IVFFlat and IVFPQ.
Definition at line 27 of file IVFBase.cuh.
| faiss::gpu::IVFBase::IVFBase | ( | GpuResources * | resources, |
| FlatIndex * | quantizer, | ||
| int | bytesPerVector, | ||
| IndicesOptions | indicesOptions | ||
| ) |
| quantizer | We do not own this reference |
Definition at line 26 of file IVFBase.cu.
| int faiss::gpu::IVFBase::getListLength | ( | int | listId | ) | const |
For debugging purposes, return the list length of a particular list
Definition at line 198 of file IVFBase.cu.
| size_t faiss::gpu::IVFBase::reclaimMemory | ( | ) |
After adding vectors, one can call this to reclaim device memory to exactly the amount needed. Returns space reclaimed in bytes
Definition at line 103 of file IVFBase.cu.
|
protected |
Reclaim memory consumed on the device for our inverted lists exact means we trim exactly to the memory needed
Definition at line 109 of file IVFBase.cu.
| void faiss::gpu::IVFBase::reset | ( | ) |
Clear out all inverted lists, but retain the coarse quantizer and the product quantizer info
Definition at line 74 of file IVFBase.cu.
|
protected |
For a set of list IDs, update device-side list pointer and size information
Definition at line 146 of file IVFBase.cu.
|
protected |
Device memory for each separate list, as managed by the host. Device memory as stored in DeviceVector is stored as unique_ptr since deviceListSummary_ pointers must remain valid despite resizing of deviceLists_
Definition at line 117 of file IVFBase.cuh.
|
protected |
Device representation of all inverted list data id -> data
Definition at line 100 of file IVFBase.cuh.
|
protected |
Device representation of all inverted list index pointers id -> data
Definition at line 104 of file IVFBase.cuh.
|
protected |
Device representation of all inverted list lengths id -> length
Definition at line 108 of file IVFBase.cuh.
|
protected |
If we are storing indices on the CPU (indicesOptions_ is INDICES_CPU), then this maintains a CPU-side map of what (inverted list id, offset) maps to which user index
Definition at line 123 of file IVFBase.cuh.
1.8.5