#include <GpuIndexBinaryFlat.h>
Public Member Functions | |
| GpuIndexBinaryFlat (GpuResources *resources, const faiss::IndexBinaryFlat *index, GpuIndexBinaryFlatConfig config=GpuIndexBinaryFlatConfig()) | |
| GpuIndexBinaryFlat (GpuResources *resources, int dims, GpuIndexBinaryFlatConfig config=GpuIndexBinaryFlatConfig()) | |
| Construct an empty instance that can be added to. | |
| void | copyFrom (const faiss::IndexBinaryFlat *index) |
| void | copyTo (faiss::IndexBinaryFlat *index) const |
| void | add (faiss::IndexBinary::idx_t n, const uint8_t *x) override |
| void | reset () override |
| Removes all elements from the database. | |
| void | search (faiss::IndexBinary::idx_t n, const uint8_t *x, faiss::IndexBinary::idx_t k, int32_t *distances, faiss::IndexBinary::idx_t *labels) const override |
| void | reconstruct (faiss::IndexBinary::idx_t key, uint8_t *recons) const override |
Public Member Functions inherited from faiss::IndexBinary | |
| IndexBinary (idx_t d=0, MetricType metric=METRIC_L2) | |
| virtual void | train (idx_t n, const uint8_t *x) |
| virtual void | add_with_ids (idx_t n, const uint8_t *x, const long *xids) |
| virtual void | range_search (idx_t n, const uint8_t *x, int radius, RangeSearchResult *result) const |
| void | assign (idx_t n, const uint8_t *x, idx_t *labels, idx_t k=1) |
| virtual long | remove_ids (const IDSelector &sel) |
| virtual void | reconstruct_n (idx_t i0, idx_t ni, uint8_t *recons) const |
| virtual void | search_and_reconstruct (idx_t n, const uint8_t *x, idx_t k, int32_t *distances, idx_t *labels, uint8_t *recons) const |
| void | display () const |
Protected Member Functions | |
| void | searchFromCpuPaged_ (int n, const uint8_t *x, int k, int32_t *outDistancesData, int *outIndicesData) const |
| void | searchNonPaged_ (int n, const uint8_t *x, int k, int32_t *outDistancesData, int *outIndicesData) const |
Protected Attributes | |
| GpuResources * | resources_ |
| Manages streans, cuBLAS handles and scratch memory for devices. | |
| GpuIndexBinaryFlatConfig | config_ |
| Configuration options. | |
| BinaryFlatIndex * | data_ |
Additional Inherited Members | |
Public Types inherited from faiss::IndexBinary | |
| typedef long | idx_t |
| all indices are this type | |
Public Attributes inherited from faiss::IndexBinary | |
| int | d |
| vector dimension | |
| int | code_size |
| number of bytes per vector ( = d / 8 ) | |
| idx_t | ntotal |
| total nb of indexed vectors | |
| bool | verbose |
| verbosity level | |
| bool | is_trained |
| set if the Index does not require training, or if training is done already | |
| MetricType | metric_type |
| type of metric this index uses for search | |
A GPU version of IndexBinaryFlat for brute-force comparison of bit vectors via Hamming distance
Definition at line 24 of file GpuIndexBinaryFlat.h.
| faiss::gpu::GpuIndexBinaryFlat::GpuIndexBinaryFlat | ( | GpuResources * | resources, |
| const faiss::IndexBinaryFlat * | index, | ||
| GpuIndexBinaryFlatConfig | config = GpuIndexBinaryFlatConfig() |
||
| ) |
Construct from a pre-existing faiss::IndexBinaryFlat instance, copying data over to the given GPU
Definition at line 25 of file GpuIndexBinaryFlat.cu.
|
overridevirtual |
Add n vectors of dimension d to the index.
Vectors are implicitly assigned labels ntotal .. ntotal + n - 1
| x | input matrix, size n * d / 8 |
Implements faiss::IndexBinary.
Definition at line 117 of file GpuIndexBinaryFlat.cu.
| void faiss::gpu::GpuIndexBinaryFlat::copyFrom | ( | const faiss::IndexBinaryFlat * | index | ) |
Initialize ourselves from the given CPU index; will overwrite all data in ourselves
Definition at line 71 of file GpuIndexBinaryFlat.cu.
| void faiss::gpu::GpuIndexBinaryFlat::copyTo | ( | faiss::IndexBinaryFlat * | index | ) | const |
Copy ourselves to the given CPU index; will overwrite all data in the index instance
Definition at line 99 of file GpuIndexBinaryFlat.cu.
|
overridevirtual |
Reconstruct a stored vector.
This function may not be defined for some indexes.
| key | id of the vector to reconstruct |
| recons | reconstucted vector (size d / 8) |
Reimplemented from faiss::IndexBinary.
Definition at line 282 of file GpuIndexBinaryFlat.cu.
|
overridevirtual |
Query n vectors of dimension d to the index.
return at most k vectors. If there are not enough results for a query, the result array is padded with -1s.
| x | input vectors to search, size n * d / 8 |
| labels | output labels of the NNs, size n*k |
| distances | output pairwise distances, size n*k |
Implements faiss::IndexBinary.
Definition at line 148 of file GpuIndexBinaryFlat.cu.
|
protected |
Called from search when the input data is on the CPU; potentially allows for pinned memory usage
Definition at line 253 of file GpuIndexBinaryFlat.cu.
|
protected |
Holds our GPU data containing the list of vectors; is managed via raw pointer so as to allow non-CUDA compilers to see this header
Definition at line 87 of file GpuIndexBinaryFlat.h.
1.8.5