Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Fix range search benchmark wrong with IP metric type (#632)
Browse files Browse the repository at this point in the history
Signed-off-by: yudong.cai <[email protected]>
  • Loading branch information
cydrain authored Jan 12, 2023
1 parent 087cad0 commit 747cd46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions unittest/benchmark/benchmark_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Benchmark_base {
public:
inline void
normalize(float* arr, int32_t nq, int32_t dim) {
#pragma omp parallel for
for (int32_t i = 0; i < nq; i++) {
double vecLen = 0.0, inv_vecLen = 0.0;
for (int32_t j = 0; j < dim; j++) {
Expand Down
9 changes: 7 additions & 2 deletions unittest/benchmark/hdf5/benchmark_knowhere_float_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,13 @@ class Benchmark_knowhere_float_range : public Benchmark_knowhere, public ::testi
assert(metric_str_ == METRIC_IP_STR || metric_str_ == METRIC_L2_STR);
metric_type_ = (metric_str_ == METRIC_IP_STR) ? knowhere::metric::IP : knowhere::metric::L2;
knowhere::SetMetaMetricType(cfg_, metric_type_);
knowhere::SetMetaRadiusLowBound(cfg_, 0.0f);
knowhere::SetMetaRadiusHighBound(cfg_, *gt_radius_);
if (metric_type_ == knowhere::metric::IP) {
knowhere::SetMetaRadiusLowBound(cfg_, *gt_radius_);
knowhere::SetMetaRadiusHighBound(cfg_, 1.01f);
} else {
knowhere::SetMetaRadiusLowBound(cfg_, 0.0f);
knowhere::SetMetaRadiusHighBound(cfg_, *gt_radius_);
}
knowhere::KnowhereConfig::SetSimdType(knowhere::KnowhereConfig::SimdType::AVX2);
printf("faiss::distance_compute_blas_threshold: %ld\n", knowhere::KnowhereConfig::GetBlasThreshold());
}
Expand Down

0 comments on commit 747cd46

Please sign in to comment.