Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Public Attributes | List of all members
faiss::gpu::IndexProxy Class Reference

#include <IndexProxy.h>

Inheritance diagram for faiss::gpu::IndexProxy:
faiss::Index

Public Member Functions

void addIndex (faiss::Index *index)
 
void removeIndex (faiss::Index *index)
 
void runOnIndex (std::function< void(faiss::Index *)> f)
 
void reset () override
 
void train (Index::idx_t n, const float *x) override
 
void add (Index::idx_t n, const float *x) override
 
void search (faiss::Index::idx_t n, const float *x, faiss::Index::idx_t k, float *distances, faiss::Index::idx_t *labels) const override
 
void reconstruct (idx_t, float *v) const override
 reconstructs from the first index
 
int count () const
 
faiss::Indexat (int i)
 
const faiss::Indexat (int i) const
 
- Public Member Functions inherited from faiss::Index
 Index (idx_t d=0, MetricType metric=METRIC_INNER_PRODUCT)
 
virtual void add_with_ids (idx_t n, const float *x, const long *xids)
 
virtual void range_search (idx_t n, const float *x, float radius, RangeSearchResult *result) const
 
void assign (idx_t n, const float *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, float *recons) const
 
void compute_residual (const float *x, float *residual, idx_t key) const
 
void display () const
 

Public Attributes

bool own_fields
 
- Public Attributes inherited from faiss::Index
int d
 vector dimension
 
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
 

Additional Inherited Members

- Public Types inherited from faiss::Index
typedef long idx_t
 all indices are this type
 

Detailed Description

Takes individual faiss::Index instances, and splits queries for sending to each Index instance, and joins the results together when done. Each index is managed by a separate CPU thread.

Definition at line 24 of file IndexProxy.h.

Member Function Documentation

void faiss::gpu::IndexProxy::add ( Index::idx_t  n,
const float *  x 
)
overridevirtual

faiss::Index API All indices receive the same call

Implements faiss::Index.

Definition at line 111 of file IndexProxy.cpp.

void faiss::gpu::IndexProxy::addIndex ( faiss::Index index)

Adds an index that is managed by ourselves. WARNING: once an index is added to this proxy, it becomes unsafe to touch it from any other thread than that on which is managing it, until we are shut down. Use runOnIndex to perform work on it instead.

Definition at line 32 of file IndexProxy.cpp.

void faiss::gpu::IndexProxy::removeIndex ( faiss::Index index)

Remove an index that is managed by ourselves. This will flush all pending work on that index, and then shut down its managing thread, and will remove the index.

Definition at line 67 of file IndexProxy.cpp.

void faiss::gpu::IndexProxy::reset ( )
overridevirtual

faiss::Index API All indices receive the same call

Implements faiss::Index.

Definition at line 100 of file IndexProxy.cpp.

void faiss::gpu::IndexProxy::runOnIndex ( std::function< void(faiss::Index *)>  f)

Run a function on all indices, in the thread that the index is managed in.

Definition at line 85 of file IndexProxy.cpp.

void faiss::gpu::IndexProxy::search ( faiss::Index::idx_t  n,
const float *  x,
faiss::Index::idx_t  k,
float *  distances,
faiss::Index::idx_t labels 
) const
overridevirtual

faiss::Index API Query is partitioned into a slice for each sub-index split by ceil(n / #indices) for our sub-indices

Implements faiss::Index.

Definition at line 124 of file IndexProxy.cpp.

void faiss::gpu::IndexProxy::train ( Index::idx_t  n,
const float *  x 
)
overridevirtual

faiss::Index API All indices receive the same call

Reimplemented from faiss::Index.

Definition at line 106 of file IndexProxy.cpp.


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