Faiss

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | List of all members
faiss::gpu::IVFFlat Class Reference
Inheritance diagram for faiss::gpu::IVFFlat:

## Public Member Functions
| IVFFlat (GpuResources *resources, FlatIndex *quantizer, bool l2Distance, bool useFloat16, IndicesOptions indicesOptions)
| Construct from a quantizer that has elemen. More...
void | addCodeVectorsFromCpu (int listId, const float *vecs, const long *indices, size_t numVecs)
int | classifyAndAddVectors (Tensor< float, 2, true > &vecs, Tensor< long, 1, true > &indices)
void | query (Tensor< float, 2, true > &queries, int nprobe, int k, Tensor< float, 2, true > &outDistances, Tensor< long, 2, true > &outIndices)
std::vector< float > | getListVectors (int listId) const
| Return the vectors of a particular list back to the CPU.
Public Member Functions inherited from faiss::gpu::IVFBase
| 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.

## Additional Inherited Members
Protected Member Functions inherited from faiss::gpu::IVFBase
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 inherited from faiss::gpu::IVFBase
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_

## Detailed Description

Definition at line 18 of file IVFFlat.cuh.

## Constructor & Destructor Documentation

faiss::gpu::IVFFlat::IVFFlat | ( | GpuResources * | resources,
|  | FlatIndex * | quantizer,
|  | bool | l2Distance,
|  | bool | useFloat16,
|  | IndicesOptions | indicesOptions
| ) |  |

Construct from a quantizer that has elemen.

Parameters

  quantizer | We do not own this reference

Definition at line 30 of file IVFFlat.cu.

## Member Function Documentation

void faiss::gpu::IVFFlat::addCodeVectorsFromCpu | ( | int | listId,
|  | const float * | vecs,
|  | const long * | indices,
|  | size_t | numVecs
| ) |  |

Add vectors to a specific list; the input data can be on the host or on our current device

Definition at line 57 of file IVFFlat.cu.

int faiss::gpu::IVFFlat::classifyAndAddVectors | ( | Tensor< float, 2, true > & | vecs,
|  | Tensor< long, 1, true > & | indices
| ) |  |

Adds the given vectors to this index. The input data must be on our current device. Returns the number of vectors successfully added. Vectors may not be able to be added because they contain NaNs.

Definition at line 129 of file IVFFlat.cu.

void faiss::gpu::IVFFlat::query | ( | Tensor< float, 2, true > & | queries,
|  | int | nprobe,
|  | int | k,
|  | Tensor< float, 2, true > & | outDistances,
|  | Tensor< long, 2, true > & | outIndices
| ) |  |

Find the approximate k nearest neigbors for `queries` against our database

Definition at line 287 of file IVFFlat.cu.

The documentation for this class was generated from the following files:

- /data/users/matthijs/github_faiss/faiss/gpu/impl/IVFFlat.cuh
- /data/users/matthijs/github_faiss/faiss/gpu/impl/IVFFlat.cu