14 #include "../GpuIndicesOptions.h"
15 #include "../utils/DeviceVector.cuh"
16 #include "../utils/DeviceTensor.cuh"
18 #include <thrust/device_vector.h>
21 namespace faiss {
namespace gpu {
33 IndicesOptions indicesOptions);
118 std::vector<std::unique_ptr<DeviceVector<unsigned char>>> deviceListIndices_;
const int numLists_
Number of inverted lists we maintain.
int maxListLength_
Maximum list length seen.
std::vector< std::vector< long > > listOffsetToUserIndex_
Holder of GPU resources for a particular flat index.
int getDim() const
Return the number of dimensions we are indexing.
int getListLength(int listId) const
void reserveMemory(size_t numVecs)
Reserve GPU memory in our inverted lists for this number of vectors.
size_t reclaimMemory_(bool exact)
Base inverted list functionality for IVFFlat and IVFPQ.
thrust::device_vector< int > deviceListLengths_
thrust::device_vector< void * > deviceListIndexPointers_
IVFBase(GpuResources *resources, FlatIndex *quantizer, int bytesPerVector, IndicesOptions indicesOptions)
FlatIndex * quantizer_
Quantizer object.
thrust::device_vector< void * > deviceListDataPointers_
GpuResources * resources_
Collection of GPU resources that we use.
const int bytesPerVector_
Number of bytes per vector in the list.
void updateDeviceListInfo_(cudaStream_t stream)
Update all device-side list pointer and size information.
std::vector< long > getListIndices(int listId) const
Return the list indices of a particular list back to the CPU.
const IndicesOptions indicesOptions_
How are user indices stored on the GPU?
std::vector< std::unique_ptr< DeviceVector< unsigned char > > > deviceListData_
const int dim_
Expected dimensionality of the vectors.
void addIndicesFromCpu_(int listId, const long *indices, size_t numVecs)
Shared function to copy indices from CPU to GPU.
size_t getNumLists() const
Returns the number of inverted lists.