diff --git a/AutoTune.cpp b/AutoTune.cpp index a3f2117ce..2c6a2b938 100644 --- a/AutoTune.cpp +++ b/AutoTune.cpp @@ -51,23 +51,23 @@ OneRecallAtRCriterion::OneRecallAtRCriterion (idx_t nq, idx_t R): AutoTuneCriterion(nq, R), R(R) {} -double OneRecallAtRCriterion::evaluate (const float *D, const idx_t *I) const -{ - FAISS_THROW_IF_NOT_MSG ( - (gt_I.size() == gt_nnn * nq && gt_nnn >= 1 && nnn >= R), - "ground truth not initialized"); - idx_t n_ok = 0; - for (idx_t q = 0; q < nq; q++) { - idx_t gt_nn = gt_I [q * gt_nnn]; - const idx_t *I_line = I + q * nnn; - for (int i = 0; i < R; i++) { - if (I_line[i] == gt_nn) { - n_ok++; - break; - } - } +double OneRecallAtRCriterion::evaluate(const float* /*D*/, const idx_t* I) + const { + FAISS_THROW_IF_NOT_MSG( + (gt_I.size() == gt_nnn * nq && gt_nnn >= 1 && nnn >= R), + "ground truth not initialized"); + idx_t n_ok = 0; + for (idx_t q = 0; q < nq; q++) { + idx_t gt_nn = gt_I[q * gt_nnn]; + const idx_t* I_line = I + q * nnn; + for (int i = 0; i < R; i++) { + if (I_line[i] == gt_nn) { + n_ok++; + break; + } } - return n_ok / double (nq); + } + return n_ok / double(nq); } @@ -75,12 +75,12 @@ IntersectionCriterion::IntersectionCriterion (idx_t nq, idx_t R): AutoTuneCriterion(nq, R), R(R) {} -double IntersectionCriterion::evaluate (const float *D, const idx_t *I) const -{ - FAISS_THROW_IF_NOT_MSG ( - (gt_I.size() == gt_nnn * nq && gt_nnn >= R && nnn >= R), - "ground truth not initialized"); - long n_ok = 0; +double IntersectionCriterion::evaluate(const float* /*D*/, const idx_t* I) + const { + FAISS_THROW_IF_NOT_MSG( + (gt_I.size() == gt_nnn * nq && gt_nnn >= R && nnn >= R), + "ground truth not initialized"); + long n_ok = 0; #pragma omp parallel for reduction(+: n_ok) for (idx_t q = 0; q < nq; q++) { n_ok += ranklist_intersection_size ( diff --git a/Index.cpp b/Index.cpp index 7c520079b..8fdfdf788 100644 --- a/Index.cpp +++ b/Index.cpp @@ -27,15 +27,14 @@ void Index::assign (idx_t n, const float * x, idx_t * labels, idx_t k) search (n, x, k, distances, labels); } - -void Index::add_with_ids (idx_t n, const float * x, const long *xids) -{ +void Index::add_with_ids( + idx_t /*n*/, + const float* /*x*/, + const long* /*xids*/) { FAISS_THROW_MSG ("add_with_ids not implemented for this type of index"); } - -long Index::remove_ids (const IDSelector & sel) -{ +long Index::remove_ids(const IDSelector& /*sel*/) { FAISS_THROW_MSG ("remove_ids not implemented for this type of index"); return -1; } diff --git a/Index.h b/Index.h index ce435cc54..4f55e5723 100644 --- a/Index.h +++ b/Index.h @@ -86,8 +86,8 @@ struct Index { * @param n nb of training vectors * @param x training vecors, size n * d */ - virtual void train (idx_t n, const float *x) { - // does nothing by default + virtual void train(idx_t /*n*/, const float* /*x*/) { + // does nothing by default } /** Add n vectors of dimension d to the index. diff --git a/IndexIVF.cpp b/IndexIVF.cpp index d1f8d476a..c08a03ae9 100644 --- a/IndexIVF.cpp +++ b/IndexIVF.cpp @@ -128,11 +128,10 @@ void IndexIVF::train (idx_t n, const float *x) is_trained = true; } -void IndexIVF::train_residual (idx_t n, const float *x) -{ - if (verbose) - printf ("IndexIVF: no residual training\n"); - // does nothing by default +void IndexIVF::train_residual(idx_t /*n*/, const float* /*x*/) { + if (verbose) + printf("IndexIVF: no residual training\n"); + // does nothing by default } diff --git a/IndexIVFPQ.cpp b/IndexIVFPQ.cpp index 4d61c1683..c837f8910 100644 --- a/IndexIVFPQ.cpp +++ b/IndexIVFPQ.cpp @@ -1368,8 +1368,7 @@ void IndexIVFPQR::merge_from_residuals (IndexIVF &other_in) other.refine_codes.clear(); } -long IndexIVFPQR::remove_ids (const IDSelector & sel) -{ +long IndexIVFPQR::remove_ids(const IDSelector& /*sel*/) { FAISS_THROW_MSG("not implemented"); return 0; } diff --git a/IndexPQ.cpp b/IndexPQ.cpp index 808f471ca..0a39ee83a 100644 --- a/IndexPQ.cpp +++ b/IndexPQ.cpp @@ -786,6 +786,7 @@ MultiIndexQuantizer::MultiIndexQuantizer (int d, Index(d, METRIC_L2), pq(d, M, nbits) { is_trained = false; + pq.verbose = verbose; } @@ -880,11 +881,10 @@ void MultiIndexQuantizer::reconstruct (idx_t key, float * recons) const } else FAISS_THROW_MSG( "only 1 or 2 bytes per index supported"); } - -void MultiIndexQuantizer::add (idx_t n, const float *x) -{ - FAISS_THROW_MSG ( "This index has virtual elements, " - "it does not support add"); +void MultiIndexQuantizer::add(idx_t /*n*/, const float* /*x*/) { + FAISS_THROW_MSG( + "This index has virtual elements, " + "it does not support add"); } void MultiIndexQuantizer::reset () diff --git a/MetaIndexes.cpp b/MetaIndexes.cpp index c2042c1c5..04dd1cf2b 100644 --- a/MetaIndexes.cpp +++ b/MetaIndexes.cpp @@ -607,9 +607,8 @@ void IndexSplitVectors::sync_with_sub_indexes () } -void IndexSplitVectors::add (idx_t n, const float *x) -{ - FAISS_THROW_MSG ("not implemented"); +void IndexSplitVectors::add(idx_t /*n*/, const float* /*x*/) { + FAISS_THROW_MSG("not implemented"); } namespace { @@ -709,10 +708,8 @@ void IndexSplitVectors::search ( } - -void IndexSplitVectors::train (idx_t n, const float *x) -{ - FAISS_THROW_MSG ("not implemented"); +void IndexSplitVectors::train(idx_t /*n*/, const float* /*x*/) { + FAISS_THROW_MSG("not implemented"); } void IndexSplitVectors::reset () diff --git a/docs/html/AutoTune_8cpp_source.html b/docs/html/AutoTune_8cpp_source.html index 860971b16..bed528cd9 100644 --- a/docs/html/AutoTune_8cpp_source.html +++ b/docs/html/AutoTune_8cpp_source.html @@ -136,23 +136,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
51  AutoTuneCriterion(nq, R), R(R)
52 {}
53 
-
54 double OneRecallAtRCriterion::evaluate (const float *D, const idx_t *I) const
-
55 {
-
56  FAISS_THROW_IF_NOT_MSG (
-
57  (gt_I.size() == gt_nnn * nq && gt_nnn >= 1 && nnn >= R),
-
58  "ground truth not initialized");
-
59  idx_t n_ok = 0;
-
60  for (idx_t q = 0; q < nq; q++) {
-
61  idx_t gt_nn = gt_I [q * gt_nnn];
-
62  const idx_t *I_line = I + q * nnn;
-
63  for (int i = 0; i < R; i++) {
-
64  if (I_line[i] == gt_nn) {
-
65  n_ok++;
-
66  break;
-
67  }
-
68  }
-
69  }
-
70  return n_ok / double (nq);
+
54 double OneRecallAtRCriterion::evaluate(const float* /*D*/, const idx_t* I)
+
55  const {
+
56  FAISS_THROW_IF_NOT_MSG(
+
57  (gt_I.size() == gt_nnn * nq && gt_nnn >= 1 && nnn >= R),
+
58  "ground truth not initialized");
+
59  idx_t n_ok = 0;
+
60  for (idx_t q = 0; q < nq; q++) {
+
61  idx_t gt_nn = gt_I[q * gt_nnn];
+
62  const idx_t* I_line = I + q * nnn;
+
63  for (int i = 0; i < R; i++) {
+
64  if (I_line[i] == gt_nn) {
+
65  n_ok++;
+
66  break;
+
67  }
+
68  }
+
69  }
+
70  return n_ok / double(nq);
71 }
72 
73 
@@ -160,12 +160,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
75  AutoTuneCriterion(nq, R), R(R)
76 {}
77 
-
78 double IntersectionCriterion::evaluate (const float *D, const idx_t *I) const
-
79 {
-
80  FAISS_THROW_IF_NOT_MSG (
-
81  (gt_I.size() == gt_nnn * nq && gt_nnn >= R && nnn >= R),
-
82  "ground truth not initialized");
-
83  long n_ok = 0;
+
78 double IntersectionCriterion::evaluate(const float* /*D*/, const idx_t* I)
+
79  const {
+
80  FAISS_THROW_IF_NOT_MSG(
+
81  (gt_I.size() == gt_nnn * nq && gt_nnn >= R && nnn >= R),
+
82  "ground truth not initialized");
+
83  long n_ok = 0;
84 #pragma omp parallel for reduction(+: n_ok)
85  for (idx_t q = 0; q < nq; q++) {
86  n_ok += ranklist_intersection_size (
@@ -805,9 +805,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
720  }
721  } else if (!index && (stok == "SQ8" || stok == "SQ4")) {
722  ScalarQuantizer::QuantizerType qt =
-
723  stok == "SQ8" ? ScalarQuantizer::QT_8bit :
-
724  stok == "SQ4" ? ScalarQuantizer::QT_4bit :
-
725  ScalarQuantizer::QT_4bit;
+
723  stok == "SQ8" ? ScalarQuantizer::QT_8bit :
+
724  stok == "SQ4" ? ScalarQuantizer::QT_4bit :
+
725  ScalarQuantizer::QT_4bit;
726  if (coarse_quantizer) {
727  IndexIVFScalarQuantizer *index_ivf =
728  new IndexIVFScalarQuantizer (
@@ -922,7 +922,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::IndexIVF
Definition: IndexIVF.h:45
faiss::ParameterSpace::parameter_ranges
std::vector< ParameterRange > parameter_ranges
all tunable parameters
Definition: AutoTune.h:134
faiss::OperatingPoint::key
std::string key
key that identifies this op pt
Definition: AutoTune.h:89
-
faiss::ScalarQuantizer::QuantizerType
QuantizerType
Definition: IndexIVFScalarQuantizer.h:36
+
faiss::ScalarQuantizer::QuantizerType
QuantizerType
Definition: IndexScalarQuantizer.h:32
faiss::IndexFlat
Definition: IndexFlat.h:23
faiss::OperatingPoint::cno
long cno
integer identifer
Definition: AutoTune.h:90
faiss::IndexIVFPQR
Definition: IndexIVFPQ.h:198
@@ -933,6 +933,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::OperatingPoints::display
void display(bool only_optimal=true) const
easy-to-read output
Definition: AutoTune.cpp:221
faiss::IndexPQ
Definition: IndexPQ.h:28
faiss::OperatingPoint::perf
double perf
performance measure (output of a Criterion)
Definition: AutoTune.h:87
+
faiss::ScalarQuantizer::QT_4bit
4 bits per component
Definition: IndexScalarQuantizer.h:34
faiss::OperatingPoints
Definition: AutoTune.h:93
faiss::OperatingPoints::t_for_perf
double t_for_perf(double perf) const
get time required to obtain a given performance measure
Definition: AutoTune.cpp:174
faiss::AutoTuneCriterion::nnn
idx_t nnn
nb of NNs that the query should request
Definition: AutoTune.h:29
@@ -969,12 +970,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::Index::verbose
bool verbose
verbosity level
Definition: Index.h:66
faiss::getmillisecs
double getmillisecs()
ms elapsed since some arbitrary epoch
Definition: utils.cpp:70
faiss::AutoTuneCriterion::gt_D
std::vector< float > gt_D
Ground-truth distances (size nq * gt_nnn)
Definition: AutoTune.h:32
-
faiss::IndexIVFScalarQuantizer
Definition: IndexIVFScalarQuantizer.h:86
+
faiss::IndexIVFScalarQuantizer
Definition: IndexScalarQuantizer.h:129
faiss::ParameterSpace::combination_name
std::string combination_name(size_t cno) const
get string representation of the combination
Definition: AutoTune.cpp:277
faiss::Index::search
virtual void search(idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const =0
faiss::MultiIndexQuantizer
Definition: IndexPQ.h:135
faiss::ParameterSpace::update_bounds
void update_bounds(size_t cno, const OperatingPoint &op, double *upper_bound_perf, double *lower_bound_t) const
Definition: AutoTune.cpp:501
-
faiss::ScalarQuantizer::QT_8bit
8 bits per component
Definition: IndexIVFScalarQuantizer.h:37
faiss::VectorTransform
Definition: VectorTransform.h:28
faiss::IndexPreTransform::own_fields
bool own_fields
! the sub-index
Definition: VectorTransform.h:244
faiss::ParameterSpace::initialize
virtual void initialize(const Index *index)
initialize with reasonable parameters for the index
Definition: AutoTune.cpp:331
@@ -984,7 +984,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::ParameterSpace::n_combinations
size_t n_combinations() const
nb of combinations, = product of values sizes
Definition: AutoTune.cpp:268
faiss::Index::metric_type
MetricType metric_type
type of metric this index uses for search
Definition: Index.h:72
faiss::ParameterSpace::set_index_parameters
void set_index_parameters(Index *index, size_t cno) const
set a combination of parameters on an index
Definition: AutoTune.cpp:389
-
faiss::ScalarQuantizer::QT_4bit
4 bits per component
Definition: IndexIVFScalarQuantizer.h:38
+
faiss::ScalarQuantizer::QT_8bit
8 bits per component
Definition: IndexScalarQuantizer.h:33
faiss::Index
Definition: Index.h:60
faiss::IndexPQ::ST_PQ
asymmetric product quantizer (default)
Definition: IndexPQ.h:76
faiss::ParameterSpace::display
void display() const
print a description on stdout
Definition: AutoTune.cpp:483
diff --git a/docs/html/Clustering_8cpp_source.html b/docs/html/Clustering_8cpp_source.html index 3ef3aa772..7d009b374 100644 --- a/docs/html/Clustering_8cpp_source.html +++ b/docs/html/Clustering_8cpp_source.html @@ -234,7 +234,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
149  fvec_renorm_L2 (d, k, cur_centroids.data());
150 
151  if (!index.is_trained)
-
152  index.train (k, cur_centroids.data());
+
152  index.train (k, cur_centroids.data());
153 
154  FAISS_THROW_IF_NOT (index.ntotal == 0);
155  index.add (k, cur_centroids.data());
@@ -267,7 +267,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
182 
183  index.reset ();
184  if (update_index)
-
185  index.train (k, cur_centroids.data());
+
185  index.train (k, cur_centroids.data());
186 
187  assert (index.ntotal == 0);
188  index.add (k, cur_centroids.data());
@@ -305,6 +305,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::ClusteringParameters::nredo
int nredo
redo clustering this many times and keep best
Definition: Clustering.h:26
faiss::ClusteringParameters::ClusteringParameters
ClusteringParameters()
sets reasonable defaults
Definition: Clustering.cpp:27
faiss::Index::reset
virtual void reset()=0
removes all elements from the database.
+
faiss::Index::train
virtual void train(idx_t, const float *)
Definition: Index.h:89
faiss::IndexFlatL2
Definition: IndexFlat.h:79
faiss::Clustering::Clustering
Clustering(int d, int k)
the only mandatory parameters are k and d
Definition: Clustering.cpp:39
faiss::Clustering::k
size_t k
nb of centroids
Definition: Clustering.h:59
@@ -325,7 +326,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::Index
Definition: Index.h:60
faiss::Clustering::train
virtual void train(idx_t n, const float *x, faiss::Index &index)
Index is used during the assignment stage.
Definition: Clustering.cpp:66
faiss::Index::is_trained
bool is_trained
set if the Index does not require training, or if training is done already
Definition: Index.h:69
-
faiss::Index::train
virtual void train(idx_t n, const float *x)
Definition: Index.h:89
faiss::ClusteringParameters::spherical
bool spherical
do we want normalized centroids?
Definition: Clustering.h:29
faiss::ClusteringParameters::max_points_per_centroid
int max_points_per_centroid
to limit size of dataset
Definition: Clustering.h:33
diff --git a/docs/html/FlatIndex_8cu_source.html b/docs/html/FlatIndex_8cu_source.html index 64f26c4f7..8020c350c 100644 --- a/docs/html/FlatIndex_8cu_source.html +++ b/docs/html/FlatIndex_8cu_source.html @@ -205,8 +205,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
116  Tensor<int, 2, true>& outIndices,
117  bool exactDistance,
118  int tileSize) {
-
119  auto stream = resources_->getDefaultStreamCurrentDevice();
-
120  auto& mem = resources_->getMemoryManagerCurrentDevice();
+
119  auto stream = resources_->getDefaultStreamCurrentDevice();
+
120  auto& mem = resources_->getMemoryManagerCurrentDevice();
121 
122  if (useFloat16_) {
123  // We need to convert to float16
@@ -368,7 +368,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
279 
280 } }
faiss::gpu::FlatIndex::getVectorsFloat32Copy
DeviceTensor< float, 2, true > getVectorsFloat32Copy(cudaStream_t stream)
Definition: FlatIndex.cu:91
+
faiss::gpu::GpuResources::getDefaultStreamCurrentDevice
cudaStream_t getDefaultStreamCurrentDevice()
Calls getDefaultStream with the current device.
Definition: GpuResources.cpp:25
faiss::gpu::FlatIndex::getSize
int getSize() const
Returns the number of vectors we contain.
Definition: FlatIndex.cu:47
+
faiss::gpu::GpuResources::getMemoryManagerCurrentDevice
DeviceMemory & getMemoryManagerCurrentDevice()
Calls getMemoryManager for the current device.
Definition: GpuResources.cpp:35
faiss::gpu::Tensor::copyTo
__host__ void copyTo(Tensor< T, Dim, Contig, IndexT, PtrTraits > &t, cudaStream_t stream)
Copies ourselves into a tensor; sizes must match.
Definition: Tensor-inl.cuh:139
faiss::gpu::FlatIndex::reserve
void reserve(size_t numVecs, cudaStream_t stream)
Reserve storage that can contain at least this many vectors.
Definition: FlatIndex.cu:68
faiss::gpu::FlatIndex::add
void add(const float *data, int numVecs, cudaStream_t stream)
Definition: FlatIndex.cu:201
diff --git a/docs/html/GpuIndexFlat_8cu_source.html b/docs/html/GpuIndexFlat_8cu_source.html index bfb01454f..a811d6efd 100644 --- a/docs/html/GpuIndexFlat_8cu_source.html +++ b/docs/html/GpuIndexFlat_8cu_source.html @@ -201,7 +201,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
112  if (index->ntotal > 0) {
113  data_->add(index->xb.data(),
114  index->ntotal,
-
115  resources_->getDefaultStream(device_));
+
115  resources_->getDefaultStream(device_));
116  }
117 }
118 
@@ -216,7 +216,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
127  FAISS_ASSERT(data_->getSize() == this->ntotal);
128  index->xb.resize(this->ntotal * this->d);
129 
-
130  auto stream = resources_->getDefaultStream(device_);
+
130  auto stream = resources_->getDefaultStream(device_);
131 
132  if (this->ntotal > 0) {
133  if (config_.useFloat16) {
@@ -253,7 +253,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
164 
165  // To avoid multiple re-allocations, ensure we have enough storage
166  // available
-
167  data_->reserve(n, resources_->getDefaultStream(device_));
+
167  data_->reserve(n, resources_->getDefaultStream(device_));
168 
169  // If we're not operating in float16 mode, we don't need the input
170  // data to be resident on our device; we can add directly.
@@ -282,7 +282,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
193  "GPU index only supports up to %zu indices",
194  (size_t) std::numeric_limits<int>::max());
195 
-
196  data_->add(x, n, resources_->getDefaultStream(device_));
+
196  data_->add(x, n, resources_->getDefaultStream(device_));
197  this->ntotal += n;
198 }
199 
@@ -310,7 +310,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
221  (int) k); // select limitation
222 
223  DeviceScope scope(device_);
-
224  auto stream = resources_->getDefaultStream(device_);
+
224  auto stream = resources_->getDefaultStream(device_);
225 
226  // The input vectors may be too large for the GPU, but we still
227  // assume that the output distances and labels are not.
@@ -391,7 +391,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
302  Tensor<float, 2, true> outDistances(outDistancesData, {n, k});
303  Tensor<int, 2, true> outIndices(outIndicesData, {n, k});
304 
-
305  auto stream = resources_->getDefaultStream(device_);
+
305  auto stream = resources_->getDefaultStream(device_);
306 
307  // Make sure arguments are on the device we desire; use temporary
308  // memory allocations to move it if necessary
@@ -709,6 +709,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::gpu::GpuIndexConfig::device
int device
GPU device on which the index is resident.
Definition: GpuIndex.h:27
faiss::gpu::GpuIndex
Definition: GpuIndex.h:35
faiss::gpu::GpuIndexFlatL2::GpuIndexFlatL2
GpuIndexFlatL2(GpuResources *resources, faiss::IndexFlatL2 *index, GpuIndexFlatConfig config=GpuIndexFlatConfig())
Definition: GpuIndexFlat.cu:549
+
faiss::gpu::GpuResources::getDefaultStream
virtual cudaStream_t getDefaultStream(int device)=0
faiss::Index::d
int d
vector dimension
Definition: Index.h:64
faiss::gpu::GpuIndexFlatConfig
Definition: GpuIndexFlat.h:27
faiss::gpu::IntToLong
Definition: GpuIndexFlat.cu:200
diff --git a/docs/html/GpuIndexIVFFlat_8cu_source.html b/docs/html/GpuIndexIVFFlat_8cu_source.html index 1848a3e69..304cd850a 100644 --- a/docs/html/GpuIndexIVFFlat_8cu_source.html +++ b/docs/html/GpuIndexIVFFlat_8cu_source.html @@ -296,7 +296,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
207  FAISS_ASSERT(index_);
208  FAISS_ASSERT(n > 0);
209 
-
210  auto stream = resources_->getDefaultStreamCurrentDevice();
+
210  auto stream = resources_->getDefaultStreamCurrentDevice();
211 
212  auto deviceVecs =
213  toDevice<float, 2>(resources_,
@@ -362,6 +362,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
273 } } // namespace
faiss::gpu::IVFFlat
Definition: IVFFlat.cuh:17
faiss::gpu::GpuIndexIVFFlat::GpuIndexIVFFlat
GpuIndexIVFFlat(GpuResources *resources, const faiss::IndexIVFFlat *index, GpuIndexIVFFlatConfig config=GpuIndexIVFFlatConfig())
Definition: GpuIndexIVFFlat.cu:25
+
faiss::gpu::GpuResources::getDefaultStreamCurrentDevice
cudaStream_t getDefaultStreamCurrentDevice()
Calls getDefaultStream with the current device.
Definition: GpuResources.cpp:25
faiss::gpu::GpuIndexIVFFlat::searchImpl_
void searchImpl_(faiss::Index::idx_t n, const float *x, faiss::Index::idx_t k, float *distances, faiss::Index::idx_t *labels) const override
Called from GpuIndex for search.
Definition: GpuIndexIVFFlat.cu:233
faiss::gpu::IVFBase::getDim
int getDim() const
Return the number of dimensions we are indexing.
Definition: IVFBase.cu:100
faiss::gpu::GpuIndexFlat::getGpuData
FlatIndex * getGpuData()
For internal access.
Definition: GpuIndexFlat.h:120
diff --git a/docs/html/GpuIndexIVFPQ_8cu_source.html b/docs/html/GpuIndexIVFPQ_8cu_source.html index 449c86cc5..0ce51697f 100644 --- a/docs/html/GpuIndexIVFPQ_8cu_source.html +++ b/docs/html/GpuIndexIVFPQ_8cu_source.html @@ -272,7 +272,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
183 
184  fromDevice<float, 3>(devPQCentroids,
185  index->pq.centroids.data(),
-
186  resources_->getDefaultStream(device_));
+
186  resources_->getDefaultStream(device_));
187 
188  if (ivfpqConfig_.usePrecomputedTables) {
189  index->precompute_table();
@@ -413,7 +413,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
324  FAISS_ASSERT(index_);
325  FAISS_ASSERT(n > 0);
326 
-
327  auto stream = resources_->getDefaultStreamCurrentDevice();
+
327  auto stream = resources_->getDefaultStreamCurrentDevice();
328 
329  auto deviceVecs =
330  toDevice<float, 2>(resources_,
@@ -568,6 +568,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::IndexIVFPQ::precompute_table
void precompute_table()
build precomputed table
Definition: IndexIVFPQ.cpp:391
faiss::gpu::GpuIndexIVFPQ::reset
void reset() override
Definition: GpuIndexIVFPQ.cu:245
faiss::ProductQuantizer::nbits
size_t nbits
number of bits per quantization index
Definition: ProductQuantizer.h:29
+
faiss::gpu::GpuResources::getDefaultStreamCurrentDevice
cudaStream_t getDefaultStreamCurrentDevice()
Calls getDefaultStream with the current device.
Definition: GpuResources.cpp:25
faiss::gpu::GpuIndexIVFPQConfig::usePrecomputedTables
bool usePrecomputedTables
Definition: GpuIndexIVFPQ.h:36
faiss::IndexIVFPQ::polysemous_training
PolysemousTraining * polysemous_training
if NULL, use default
Definition: IndexIVFPQ.h:36
faiss::ProductQuantizer::byte_per_idx
size_t byte_per_idx
nb bytes per code component (1 or 2)
Definition: ProductQuantizer.h:33
@@ -585,6 +586,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::gpu::GpuResources
Definition: GpuResources.h:23
faiss::gpu::GpuIndexIVFPQ::getBitsPerCode
int getBitsPerCode() const
Return the number of bits per PQ code.
Definition: GpuIndexIVFPQ.cu:225
faiss::gpu::GpuIndexIVFPQConfig::useFloat16LookupTables
bool useFloat16LookupTables
Definition: GpuIndexIVFPQ.h:32
+
faiss::gpu::GpuResources::getDefaultStream
virtual cudaStream_t getDefaultStream(int device)=0
faiss::IndexIVF::ids
std::vector< std::vector< long > > ids
Inverted lists for indexes.
Definition: IndexIVF.h:55
faiss::gpu::GpuIndexIVF
Definition: GpuIndexIVF.h:37
faiss::Index::d
int d
vector dimension
Definition: Index.h:64
@@ -627,7 +629,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
faiss::ProductQuantizer
Definition: ProductQuantizer.h:25
faiss::gpu::GpuIndexIVF::copyFrom
void copyFrom(const faiss::IndexIVF *index)
Copy what we need from the CPU equivalent.
Definition: GpuIndexIVF.cu:80
faiss::Index::is_trained
bool is_trained
set if the Index does not require training, or if training is done already
Definition: Index.h:69
-
faiss::Index::compute_residual
void compute_residual(const float *x, float *residual, idx_t key) const
Definition: Index.cpp:58
+
faiss::Index::compute_residual
void compute_residual(const float *x, float *residual, idx_t key) const
Definition: Index.cpp:57
faiss::gpu::GpuIndexIVFPQ::getPrecomputedCodes
bool getPrecomputedCodes() const
Are pre-computed codes enabled?
Definition: GpuIndexIVFPQ.cu:215
faiss::gpu::GpuIndexIVFConfig::indicesOptions
IndicesOptions indicesOptions
Index storage options for the GPU.
Definition: GpuIndexIVF.h:31
faiss::gpu::IVFBase::reclaimMemory
size_t reclaimMemory()
Definition: IVFBase.cu:105
diff --git a/docs/html/GpuResources_8cpp_source.html b/docs/html/GpuResources_8cpp_source.html index be86d152d..454bc0b88 100644 --- a/docs/html/GpuResources_8cpp_source.html +++ b/docs/html/GpuResources_8cpp_source.html @@ -106,31 +106,54 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
17 }
18 
19 cublasHandle_t
-
20 GpuResources::getBlasHandleCurrentDevice() {
-
21  return getBlasHandle(getCurrentDevice());
+
20 GpuResources::getBlasHandleCurrentDevice() {
+
21  return getBlasHandle(getCurrentDevice());
22 }
23 
24 cudaStream_t
-
25 GpuResources::getDefaultStreamCurrentDevice() {
-
26  return getDefaultStream(getCurrentDevice());
+
25 GpuResources::getDefaultStreamCurrentDevice() {
+
26  return getDefaultStream(getCurrentDevice());
27 }
28 
29 std::vector<cudaStream_t>
-
30 GpuResources::getAlternateStreamsCurrentDevice() {
-
31  return getAlternateStreams(getCurrentDevice());
+
30 GpuResources::getAlternateStreamsCurrentDevice() {
+
31  return getAlternateStreams(getCurrentDevice());
32 }
33 
-
34 DeviceMemory&
-
35 GpuResources::getMemoryManagerCurrentDevice() {
-
36  return getMemoryManager(getCurrentDevice());
+
34 DeviceMemory&
+
35 GpuResources::getMemoryManagerCurrentDevice() {
+
36  return getMemoryManager(getCurrentDevice());
37 }
38 
39 cudaStream_t
-
40 GpuResources::getAsyncCopyStreamCurrentDevice() {
-
41  return getAsyncCopyStream(getCurrentDevice());
+
40 GpuResources::getAsyncCopyStreamCurrentDevice() {
+
41  return getAsyncCopyStream(getCurrentDevice());
42 }
43 
-
44 } } // namespace
+
44 void
+
45 GpuResources::syncDefaultStream(int device) {
+
46  CUDA_VERIFY(cudaStreamSynchronize(getDefaultStream(device)));
+
47 }
+
48 
+
49 void
+
50 GpuResources::syncDefaultStreamCurrentDevice() {
+
51  syncDefaultStream(getCurrentDevice());
+
52 }
+
53 
+
54 } } // namespace
+
faiss::gpu::GpuResources::getDefaultStreamCurrentDevice
cudaStream_t getDefaultStreamCurrentDevice()
Calls getDefaultStream with the current device.
Definition: GpuResources.cpp:25
+
faiss::gpu::GpuResources::getBlasHandle
virtual cublasHandle_t getBlasHandle(int device)=0
Returns the cuBLAS handle that we use for the given device.
+
faiss::gpu::GpuResources::getDefaultStream
virtual cudaStream_t getDefaultStream(int device)=0
+
faiss::gpu::GpuResources::getBlasHandleCurrentDevice
cublasHandle_t getBlasHandleCurrentDevice()
Calls getBlasHandle with the current device.
Definition: GpuResources.cpp:20
+
faiss::gpu::GpuResources::getMemoryManagerCurrentDevice
DeviceMemory & getMemoryManagerCurrentDevice()
Calls getMemoryManager for the current device.
Definition: GpuResources.cpp:35
+
faiss::gpu::GpuResources::syncDefaultStreamCurrentDevice
void syncDefaultStreamCurrentDevice()
Calls syncDefaultStream for the current device.
Definition: GpuResources.cpp:50
+
faiss::gpu::GpuResources::getAsyncCopyStreamCurrentDevice
cudaStream_t getAsyncCopyStreamCurrentDevice()
Calls getAsyncCopyStream for the current device.
Definition: GpuResources.cpp:40
+
faiss::gpu::GpuResources::getAlternateStreamsCurrentDevice
std::vector< cudaStream_t > getAlternateStreamsCurrentDevice()
Calls getAlternateStreams for the current device.
Definition: GpuResources.cpp:30
+
faiss::gpu::GpuResources::getAsyncCopyStream
virtual cudaStream_t getAsyncCopyStream(int device)=0
Returns the stream on which we perform async CPU &lt;-&gt; GPU copies.
+
faiss::gpu::GpuResources::syncDefaultStream
void syncDefaultStream(int device)
Definition: GpuResources.cpp:45
+
faiss::gpu::GpuResources::getMemoryManager
virtual DeviceMemory & getMemoryManager(int device)=0
Returns the temporary memory manager for the given device.
+
faiss::gpu::DeviceMemory
Manages temporary memory allocations on a GPU device.
Definition: DeviceMemory.h:46
+
faiss::gpu::GpuResources::getAlternateStreams
virtual std::vector< cudaStream_t > getAlternateStreams(int device)=0
Returns the set of alternative streams that we use for the given device.