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

Commit

Permalink
Add STATISTICS_LEVEL for knowhere and faiss (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
cydrain authored Mar 18, 2022
1 parent a0af665 commit 7e2d03f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions knowhere/archive/KnowhereConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ KnowhereConfig::SetClusteringType(const ClusteringType clustering_type) {
#endif
}

#if 0
void
KnowhereConfig::SetStatisticsLevel(const int64_t stat_level) {
KnowhereConfig::SetStatisticsLevel(const int32_t stat_level) {
#ifdef __APPLE__
// do nothing
#elif __linux__
Expand All @@ -120,7 +119,6 @@ KnowhereConfig::SetStatisticsLevel(const int64_t stat_level) {
KNOWHERE_THROW_MSG("Unsupported SetStatisticsLevel on current platform!");
#endif
}
#endif

void
KnowhereConfig::SetLogHandler() {
Expand Down
4 changes: 1 addition & 3 deletions knowhere/archive/KnowhereConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ class KnowhereConfig {
/**
* set Statistics Level [0, 3]
*/
#if 0
static void
SetStatisticsLevel(const int64_t stat_level);
#endif
SetStatisticsLevel(const int32_t stat_level);

// todo: add log level?
/**
Expand Down
2 changes: 2 additions & 0 deletions thirdparty/faiss/faiss/FaissHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace faiss {

int32_t STATISTICS_LEVEL = 0;

/* set default to AVX */
sq_get_distance_computer_func_ptr sq_get_distance_computer = sq_get_distance_computer_avx;
sq_sel_quantizer_func_ptr sq_sel_quantizer = sq_select_quantizer_avx;
Expand Down
2 changes: 2 additions & 0 deletions thirdparty/faiss/faiss/FaissHook.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace faiss {

extern int32_t STATISTICS_LEVEL;

typedef SQDistanceComputer* (*sq_get_distance_computer_func_ptr)(MetricType, QuantizerType, size_t, const std::vector<float>&);
typedef Quantizer* (*sq_sel_quantizer_func_ptr)(QuantizerType, size_t, const std::vector<float>&);
typedef InvertedListScanner* (*sq_sel_inv_list_scanner_func_ptr)(MetricType, const ScalarQuantizer*, const Index*, size_t, bool, bool);
Expand Down

0 comments on commit 7e2d03f

Please sign in to comment.