Skip to content

Commit

Permalink
delete useless deps for milvus lite on knowhere (#960)
Browse files Browse the repository at this point in the history
Signed-off-by: yusheng.ma <[email protected]>
  • Loading branch information
Presburger authored Nov 20, 2024
1 parent 985c8e6 commit 4caec1d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
21 changes: 16 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ knowhere_option(WITH_LIGHT "Build with light weight version" OFF)
# cardinal is an enterprise vector search engine and can only be enabled for
# cloud environment
knowhere_option(WITH_CARDINAL "Build with cardinal" OFF)
knowhere_option(CARDINAL_VERSION_FORCE_CHECKOUT "Force checkout cardinal version" OFF)
knowhere_option(CARDINAL_VERSION_FORCE_CHECKOUT
"Force checkout cardinal version" OFF)
# this is needed for clang on ubuntu:20.04, otherwise the linked fails with
# 'undefined reference' error. fmt v9 was used by the time the error was
# encountered. clang on ubuntu:22.04 seems to be unaffected. gcc seems to be
Expand Down Expand Up @@ -97,10 +98,10 @@ find_package(nlohmann_json REQUIRED)
find_package(glog REQUIRED)
find_package(prometheus-cpp REQUIRED)
if(NOT WITH_RAFT)
find_package(fmt REQUIRED)
find_package(fmt REQUIRED)
endif()
if(NOT WITH_LIGHT)
find_package(opentelemetry-cpp REQUIRED)
find_package(opentelemetry-cpp REQUIRED)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_OSX_DEPLOYMENT_TARGET
Expand Down Expand Up @@ -131,8 +132,18 @@ if(NOT WITH_LIGHT)
endif()

if(WITH_LIGHT)
knowhere_file_glob(GLOB_RECURSE KNOWHERE_SRCS src/common/*.cc
src/index/hnsw/hnsw.cc src/io/*.cc src/index/index_factory.cc)
knowhere_file_glob(
GLOB_RECURSE
KNOWHERE_SRCS
src/common/*.cc
src/index/ivf/ivf.cc
src/index/index_node_data_mock_wrapper.cc
src/index/index_static.cc
src/index/index.cc
src/index/interrupt.cc
src/index/sparse/*.cc
src/io/*.cc
src/index/index_factory.cc)
knowhere_file_glob(GLOB_RECURSE KNOWHERE_TRACER_SRCS src/common/tracer.cc
src/common/prometheus_client.cc)
list(REMOVE_ITEM KNOWHERE_SRCS ${KNOWHERE_TRACER_SRCS})
Expand Down
6 changes: 5 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class KnowhereConan(ConanFile):
"with_benchmark": [True, False],
"with_coverage": [True, False],
"with_faiss_tests": [True, False],
"with_light": [True, False],
}
default_options = {
"shared": True,
Expand All @@ -50,6 +51,7 @@ class KnowhereConan(ConanFile):
"boost:without_test": True,
"fmt:header_only": True,
"with_faiss_tests": False,
"with_light": False,
}

exports_sources = (
Expand Down Expand Up @@ -95,7 +97,8 @@ def requirements(self):
self.requires("fmt/9.1.0")
self.requires("folly/2023.10.30.08@milvus/dev")
self.requires("libcurl/8.2.1")
self.requires("opentelemetry-cpp/1.8.1.1@milvus/dev")
if not self.options.with_light:
self.requires("opentelemetry-cpp/1.8.1.1@milvus/dev")
if self.settings.os != "Macos":
self.requires("libunwind/1.7.2")
if self.options.with_ut:
Expand Down Expand Up @@ -164,6 +167,7 @@ def generate(self):
tc.variables["WITH_BENCHMARK"] = self.options.with_benchmark
tc.variables["WITH_COVERAGE"] = self.options.with_coverage
tc.variables["WITH_FAISS_TESTS"] = self.options.with_faiss_tests
tc.variables["WITH_LIGHT"] = self.options.with_light
tc.generate()

deps = CMakeDeps(self)
Expand Down
4 changes: 2 additions & 2 deletions src/common/comp/brute_force.cc
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ BruteForce::SearchSparseWithBuf(const DataSetPtr base_dataset, const DataSetPtr
float* distances, const Json& config, const BitsetView& bitset) {
auto base = static_cast<const sparse::SparseRow<float>*>(base_dataset->GetTensor());
auto rows = base_dataset->GetRows();
auto dim = base_dataset->GetDim();
auto xb_id_offset = base_dataset->GetTensorBeginId();

auto xq = static_cast<const sparse::SparseRow<float>*>(query_dataset->GetTensor());
Expand All @@ -555,6 +554,7 @@ BruteForce::SearchSparseWithBuf(const DataSetPtr base_dataset, const DataSetPtr

#if defined(NOT_COMPILE_FOR_SWIG) && !defined(KNOWHERE_WITH_LIGHT)
// LCOV_EXCL_START
auto dim = base_dataset->GetDim();
std::shared_ptr<tracer::trace::Span> span = nullptr;
if (cfg.trace_id.has_value()) {
auto trace_id_str = tracer::GetIDFromHexStr(cfg.trace_id.value());
Expand Down Expand Up @@ -776,7 +776,6 @@ BruteForce::AnnIterator<knowhere::sparse::SparseRow<float>>(const DataSetPtr bas
const BitsetView& bitset) {
auto base = static_cast<const sparse::SparseRow<float>*>(base_dataset->GetTensor());
auto rows = base_dataset->GetRows();
auto dim = base_dataset->GetDim();
auto xb_id_offset = base_dataset->GetTensorBeginId();

auto xq = static_cast<const sparse::SparseRow<float>*>(query_dataset->GetTensor());
Expand All @@ -795,6 +794,7 @@ BruteForce::AnnIterator<knowhere::sparse::SparseRow<float>>(const DataSetPtr bas

#if defined(NOT_COMPILE_FOR_SWIG) && !defined(KNOWHERE_WITH_LIGHT)
// LCOV_EXCL_START
auto dim = base_dataset->GetDim();
std::shared_ptr<tracer::trace::Span> span = nullptr;
if (cfg.trace_id.has_value()) {
auto trace_id_str = tracer::GetIDFromHexStr(cfg.trace_id.value());
Expand Down

0 comments on commit 4caec1d

Please sign in to comment.