From ed105628fcce90b3749b77342465f9a68fb94219 Mon Sep 17 00:00:00 2001 From: "xiaojun.lin" Date: Wed, 18 Sep 2019 17:27:18 +0800 Subject: [PATCH] MS-565 1. refactor dir structure 2. add license 3. del swig Former-commit-id: 580d35b9fe3ea71ebc7d6096fbf5d905351f34f5 --- cpp/src/core/CMakeLists.txt | 2 +- cpp/src/core/include/knowhere/adapter/arrow.h | 18 ----- cpp/src/core/include/knowhere/adapter/sptag.h | 24 ------- cpp/src/core/include/knowhere/common/config.h | 14 ---- .../include/knowhere/common/device_type.h | 10 --- cpp/src/core/include/knowhere/common/error.h | 40 ----------- cpp/src/core/include/knowhere/common/id.h | 42 ------------ cpp/src/core/include/knowhere/common/schema.h | 21 ------ cpp/src/core/include/knowhere/common/tensor.h | 16 ----- cpp/src/core/include/knowhere/index/index.h | 49 ------------- .../core/include/knowhere/index/index_model.h | 24 ------- .../core/include/knowhere/index/index_type.h | 17 ----- .../index/preprocessor/preprocessor.h | 22 ------ .../knowhere/index/vector_index/definitions.h | 14 ---- .../index/vector_index/kdt_parameters.h | 34 ---------- .../knowhere/index/vector_index/nsg/nsg.i | 15 ---- .../index/vector_index/vector_index.h | 45 ------------ cpp/src/core/{src => knowhere}/CMakeLists.txt | 4 +- .../knowhere/adapter/arrow.cpp | 19 +++++- .../core/knowhere/knowhere/adapter/arrow.h | 36 ++++++++++ .../knowhere/adapter/faiss_adopt.h | 0 .../knowhere/adapter/sptag.cpp | 20 +++++- .../core/knowhere/knowhere/adapter/sptag.h | 43 ++++++++++++ .../knowhere/adapter/structure.cpp | 2 +- .../knowhere/adapter/structure.h | 2 +- .../knowhere/common/array.h | 20 +++++- .../knowhere/common/binary_set.h | 20 +++++- .../knowhere/common/buffer.h | 19 ++++++ .../core/knowhere/knowhere/common/config.h | 32 +++++++++ .../knowhere/common/dataset.h | 29 ++++++-- .../knowhere/common/exception.cpp | 3 +- .../knowhere/common/exception.h | 0 cpp/src/core/knowhere/knowhere/common/id.h | 60 ++++++++++++++++ .../core/knowhere/knowhere/common/schema.h | 40 +++++++++++ .../core/knowhere/knowhere/common/tensor.h | 35 ++++++++++ .../knowhere/common/timer.cpp | 2 +- .../knowhere/common/timer.h | 0 cpp/src/core/knowhere/knowhere/index/index.h | 68 +++++++++++++++++++ .../knowhere/knowhere/index/index_model.h | 42 ++++++++++++ .../core/knowhere/knowhere/index/index_type.h | 35 ++++++++++ .../knowhere/index/preprocessor/normalize.cpp | 0 .../knowhere/index/preprocessor/normalize.h | 0 .../index/preprocessor/preprocessor.h | 41 +++++++++++ .../knowhere/index/vector_index/cloner.cpp | 8 +-- .../knowhere/index/vector_index/cloner.h | 0 .../index/vector_index/cpu_kdt_rng.cpp | 23 ++++++- .../knowhere/index/vector_index/cpu_kdt_rng.h | 20 +++++- .../knowhere/index/vector_index/definitions.h | 32 +++++++++ .../knowhere/index/vector_index/gpu_ivf.cpp | 4 +- .../knowhere/index/vector_index/gpu_ivf.h | 18 +++++ .../knowhere/index/vector_index/idmap.cpp | 2 +- .../knowhere/index/vector_index/idmap.h | 0 .../knowhere/index/vector_index/ivf.cpp | 5 +- .../knowhere/index/vector_index/ivf.h | 2 +- .../index/vector_index/kdt_parameters.cpp | 20 +++++- .../index/vector_index/kdt_parameters.h | 52 ++++++++++++++ .../index/vector_index/nsg/index_io.h | 2 +- .../index/vector_index/nsg/neighbor.h | 0 .../knowhere/index/vector_index/nsg/nsg.cpp | 2 +- .../knowhere/index/vector_index/nsg/nsg.h | 0 .../index/vector_index/nsg/nsg_io.cpp | 2 +- .../knowhere/index/vector_index/nsg/nsg_io.h | 0 .../knowhere/index/vector_index/nsg/utils.cpp | 0 .../knowhere/index/vector_index/nsg/utils.h | 2 +- .../knowhere/index/vector_index/nsg_index.cpp | 8 +-- .../knowhere/index/vector_index/nsg_index.h | 2 +- .../index/vector_index/vector_index.h | 64 +++++++++++++++++ cpp/src/core/test/CMakeLists.txt | 46 ++++++------- 68 files changed, 823 insertions(+), 470 deletions(-) delete mode 100644 cpp/src/core/include/knowhere/adapter/arrow.h delete mode 100644 cpp/src/core/include/knowhere/adapter/sptag.h delete mode 100644 cpp/src/core/include/knowhere/common/config.h delete mode 100644 cpp/src/core/include/knowhere/common/device_type.h delete mode 100644 cpp/src/core/include/knowhere/common/error.h delete mode 100644 cpp/src/core/include/knowhere/common/id.h delete mode 100644 cpp/src/core/include/knowhere/common/schema.h delete mode 100644 cpp/src/core/include/knowhere/common/tensor.h delete mode 100644 cpp/src/core/include/knowhere/index/index.h delete mode 100644 cpp/src/core/include/knowhere/index/index_model.h delete mode 100644 cpp/src/core/include/knowhere/index/index_type.h delete mode 100644 cpp/src/core/include/knowhere/index/preprocessor/preprocessor.h delete mode 100644 cpp/src/core/include/knowhere/index/vector_index/definitions.h delete mode 100644 cpp/src/core/include/knowhere/index/vector_index/kdt_parameters.h delete mode 100644 cpp/src/core/include/knowhere/index/vector_index/nsg/nsg.i delete mode 100644 cpp/src/core/include/knowhere/index/vector_index/vector_index.h rename cpp/src/core/{src => knowhere}/CMakeLists.txt (97%) rename cpp/src/core/{src => knowhere}/knowhere/adapter/arrow.cpp (58%) create mode 100644 cpp/src/core/knowhere/knowhere/adapter/arrow.h rename cpp/src/core/{include => knowhere}/knowhere/adapter/faiss_adopt.h (100%) rename cpp/src/core/{src => knowhere}/knowhere/adapter/sptag.cpp (83%) create mode 100644 cpp/src/core/knowhere/knowhere/adapter/sptag.h rename cpp/src/core/{src => knowhere}/knowhere/adapter/structure.cpp (98%) rename cpp/src/core/{include => knowhere}/knowhere/adapter/structure.h (97%) rename cpp/src/core/{include => knowhere}/knowhere/common/array.h (52%) rename cpp/src/core/{include => knowhere}/knowhere/common/binary_set.h (58%) rename cpp/src/core/{include => knowhere}/knowhere/common/buffer.h (56%) create mode 100644 cpp/src/core/knowhere/knowhere/common/config.h rename cpp/src/core/{include => knowhere}/knowhere/common/dataset.h (77%) rename cpp/src/core/{src => knowhere}/knowhere/common/exception.cpp (97%) rename cpp/src/core/{include => knowhere}/knowhere/common/exception.h (100%) create mode 100644 cpp/src/core/knowhere/knowhere/common/id.h create mode 100644 cpp/src/core/knowhere/knowhere/common/schema.h create mode 100644 cpp/src/core/knowhere/knowhere/common/tensor.h rename cpp/src/core/{src => knowhere}/knowhere/common/timer.cpp (98%) rename cpp/src/core/{include => knowhere}/knowhere/common/timer.h (100%) create mode 100644 cpp/src/core/knowhere/knowhere/index/index.h create mode 100644 cpp/src/core/knowhere/knowhere/index/index_model.h create mode 100644 cpp/src/core/knowhere/knowhere/index/index_type.h rename cpp/src/core/{src => knowhere}/knowhere/index/preprocessor/normalize.cpp (100%) rename cpp/src/core/{include => knowhere}/knowhere/index/preprocessor/normalize.h (100%) create mode 100644 cpp/src/core/knowhere/knowhere/index/preprocessor/preprocessor.h rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/cloner.cpp (91%) rename cpp/src/core/{include => knowhere}/knowhere/index/vector_index/cloner.h (100%) rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/cpu_kdt_rng.cpp (83%) rename cpp/src/core/{include => knowhere}/knowhere/index/vector_index/cpu_kdt_rng.h (66%) create mode 100644 cpp/src/core/knowhere/knowhere/index/vector_index/definitions.h rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/gpu_ivf.cpp (99%) rename cpp/src/core/{include => knowhere}/knowhere/index/vector_index/gpu_ivf.h (87%) rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/idmap.cpp (99%) rename cpp/src/core/{include => knowhere}/knowhere/index/vector_index/idmap.h (100%) rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/ivf.cpp (98%) rename cpp/src/core/{include => knowhere}/knowhere/index/vector_index/ivf.h (98%) rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/kdt_parameters.cpp (54%) create mode 100644 cpp/src/core/knowhere/knowhere/index/vector_index/kdt_parameters.h rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/nsg/index_io.h (95%) rename cpp/src/core/{include => knowhere}/knowhere/index/vector_index/nsg/neighbor.h (100%) rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/nsg/nsg.cpp (99%) rename cpp/src/core/{include => knowhere}/knowhere/index/vector_index/nsg/nsg.h (100%) rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/nsg/nsg_io.cpp (97%) rename cpp/src/core/{include => knowhere}/knowhere/index/vector_index/nsg/nsg_io.h (100%) rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/nsg/utils.cpp (100%) rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/nsg/utils.h (95%) rename cpp/src/core/{src => knowhere}/knowhere/index/vector_index/nsg_index.cpp (96%) rename cpp/src/core/{include => knowhere}/knowhere/index/vector_index/nsg_index.h (96%) create mode 100644 cpp/src/core/knowhere/knowhere/index/vector_index/vector_index.h diff --git a/cpp/src/core/CMakeLists.txt b/cpp/src/core/CMakeLists.txt index b18af23f..bef3f5e2 100644 --- a/cpp/src/core/CMakeLists.txt +++ b/cpp/src/core/CMakeLists.txt @@ -84,7 +84,7 @@ include(DefineOptionsCore) include(BuildUtilsCore) include(ThirdPartyPackagesCore) -add_subdirectory(src) +add_subdirectory(knowhere) if (BUILD_COVERAGE STREQUAL "ON") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") diff --git a/cpp/src/core/include/knowhere/adapter/arrow.h b/cpp/src/core/include/knowhere/adapter/arrow.h deleted file mode 100644 index 338ab691..00000000 --- a/cpp/src/core/include/knowhere/adapter/arrow.h +++ /dev/null @@ -1,18 +0,0 @@ - -#pragma once - -#include -#include - - -namespace zilliz { -namespace knowhere { - -ArrayPtr -CopyArray(const ArrayPtr &origin); - -SchemaPtr -CopySchema(const SchemaPtr &origin); - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/adapter/sptag.h b/cpp/src/core/include/knowhere/adapter/sptag.h deleted file mode 100644 index 08c4a625..00000000 --- a/cpp/src/core/include/knowhere/adapter/sptag.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace zilliz { -namespace knowhere { - -std::shared_ptr -ConvertToVectorSet(const DatasetPtr &dataset); - -std::shared_ptr -ConvertToMetadataSet(const DatasetPtr &dataset); - -std::vector -ConvertToQueryResult(const DatasetPtr &dataset, const Config &config); - -DatasetPtr -ConvertToDataset(std::vector query_results); - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/common/config.h b/cpp/src/core/include/knowhere/common/config.h deleted file mode 100644 index 3a3fee12..00000000 --- a/cpp/src/core/include/knowhere/common/config.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - - -namespace zilliz { -namespace knowhere { - - -using Config = jsoncons::json; - - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/common/device_type.h b/cpp/src/core/include/knowhere/common/device_type.h deleted file mode 100644 index 09fa3626..00000000 --- a/cpp/src/core/include/knowhere/common/device_type.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - - -namespace zilliz { -namespace sched { -namespace master { - -} // namespace master -} // namespace sched -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/common/error.h b/cpp/src/core/include/knowhere/common/error.h deleted file mode 100644 index ba7b5cf3..00000000 --- a/cpp/src/core/include/knowhere/common/error.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include "zlibrary/error/error.h" - - -namespace zilliz { -namespace knowhere { - -using Error = zilliz::lib::ErrorCode; - -constexpr Error STORE_SUCCESS = zilliz::lib::SUCCESS_CODE; - -constexpr Error ERROR_CODE_BASE = 0x36000; -constexpr Error ERROR_CODE_END = 0x37000; - -constexpr Error -ToGlobalErrorCode(const Error error_code) { - return zilliz::lib::ToGlobalErrorCode(error_code, ERROR_CODE_BASE); -} - -class Exception : public zilliz::lib::Exception { - public: - Exception(const Error error_code, - const std::string &message = nullptr) - : zilliz::lib::Exception(error_code, "KNOWHERE", message) {} -}; - -constexpr Error UNEXPECTED = ToGlobalErrorCode(0x001); -constexpr Error UNSUPPORTED = ToGlobalErrorCode(0x002); -constexpr Error NULL_POINTER = ToGlobalErrorCode(0x003); -constexpr Error OVERFLOW = ToGlobalErrorCode(0x004); -constexpr Error INVALID_ARGUMENT = ToGlobalErrorCode(0x005); -constexpr Error UNSUPPORTED_TYPE = ToGlobalErrorCode(0x006); - - -} // namespace store -} // namespace zilliz - -using Error = zilliz::store::Error; diff --git a/cpp/src/core/include/knowhere/common/id.h b/cpp/src/core/include/knowhere/common/id.h deleted file mode 100644 index dc823e6e..00000000 --- a/cpp/src/core/include/knowhere/common/id.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -//#include "zcommon/id/id.h" -//using ID = zilliz::common::ID; - -#include -#include - -namespace zilliz { -namespace knowhere { - - - -class ID { - public: - constexpr static int64_t kIDSize = 20; - - public: - const int32_t * - data() const { return content_; } - - int32_t * - mutable_data() { return content_; } - - bool - IsValid() const; - - std::string - ToString() const; - - bool - operator==(const ID &that) const; - - bool - operator<(const ID &that) const; - - protected: - int32_t content_[5] = {}; -}; - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/common/schema.h b/cpp/src/core/include/knowhere/common/schema.h deleted file mode 100644 index fe877214..00000000 --- a/cpp/src/core/include/knowhere/common/schema.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include -#include "arrow/type.h" - - -namespace zilliz { -namespace knowhere { - - -using DataType = arrow::DataType; -using Field = arrow::Field; -using FieldPtr = std::shared_ptr; -using Schema = arrow::Schema; -using SchemaPtr = std::shared_ptr; -using SchemaConstPtr = std::shared_ptr; - - - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/common/tensor.h b/cpp/src/core/include/knowhere/common/tensor.h deleted file mode 100644 index 93b7642c..00000000 --- a/cpp/src/core/include/knowhere/common/tensor.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include -#include "arrow/tensor.h" - - -namespace zilliz { -namespace knowhere { - - -using Tensor = arrow::Tensor; -using TensorPtr = std::shared_ptr; - - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/index/index.h b/cpp/src/core/include/knowhere/index/index.h deleted file mode 100644 index 40f3a8d5..00000000 --- a/cpp/src/core/include/knowhere/index/index.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include -#include "knowhere/common/binary_set.h" -#include "knowhere/common/dataset.h" -#include "knowhere/index/index_type.h" -#include "knowhere/index/index_model.h" -#include "knowhere/index/preprocessor/preprocessor.h" - - -namespace zilliz { -namespace knowhere { - - -class Index { - public: - virtual BinarySet - Serialize() = 0; - - virtual void - Load(const BinarySet &index_binary) = 0; - - // @throw - virtual DatasetPtr - Search(const DatasetPtr &dataset, const Config &config) = 0; - - public: - IndexType - idx_type() const { return idx_type_; } - - void - set_idx_type(IndexType idx_type) { idx_type_ = idx_type; } - - virtual void - set_preprocessor(PreprocessorPtr preprocessor) {} - - virtual void - set_index_model(IndexModelPtr model) {} - - private: - IndexType idx_type_; -}; - - -using IndexPtr = std::shared_ptr; - - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/index/index_model.h b/cpp/src/core/include/knowhere/index/index_model.h deleted file mode 100644 index 4b3a4e43..00000000 --- a/cpp/src/core/include/knowhere/index/index_model.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include -#include "knowhere/common/binary_set.h" - -namespace zilliz { -namespace knowhere { - - -class IndexModel { - public: - virtual BinarySet - Serialize() = 0; - - virtual void - Load(const BinarySet &binary) = 0; -}; - -using IndexModelPtr = std::shared_ptr; - - - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/index/index_type.h b/cpp/src/core/include/knowhere/index/index_type.h deleted file mode 100644 index c7f9e390..00000000 --- a/cpp/src/core/include/knowhere/index/index_type.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - - -namespace zilliz { -namespace knowhere { - - -enum class IndexType { - kUnknown = 0, - kVecIdxBegin = 100, - kVecIVFFlat = kVecIdxBegin, - kVecIdxEnd, -}; - - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/index/preprocessor/preprocessor.h b/cpp/src/core/include/knowhere/index/preprocessor/preprocessor.h deleted file mode 100644 index 368276e5..00000000 --- a/cpp/src/core/include/knowhere/index/preprocessor/preprocessor.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include "knowhere/common/dataset.h" - - -namespace zilliz { -namespace knowhere { - - -class Preprocessor { - public: - virtual DatasetPtr - Preprocess(const DatasetPtr &input) = 0; -}; - - -using PreprocessorPtr = std::shared_ptr; - - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/index/vector_index/definitions.h b/cpp/src/core/include/knowhere/index/vector_index/definitions.h deleted file mode 100644 index 99045975..00000000 --- a/cpp/src/core/include/knowhere/index/vector_index/definitions.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - - -namespace zilliz { -namespace knowhere { - -#define META_ROWS ("rows") -#define META_DIM ("dimension") -#define META_K ("k") - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/index/vector_index/kdt_parameters.h b/cpp/src/core/include/knowhere/index/vector_index/kdt_parameters.h deleted file mode 100644 index 6f2d631d..00000000 --- a/cpp/src/core/include/knowhere/index/vector_index/kdt_parameters.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include - - -namespace zilliz { -namespace knowhere { - -using KDTParameter = std::pair; - -class KDTParameterManagement { - public: - const std::vector & - GetKDTParameters(); - - public: - static KDTParameterManagement & - GetInstance() { - static KDTParameterManagement instance; - return instance; - } - - KDTParameterManagement(const KDTParameterManagement &) = delete; - KDTParameterManagement &operator=(const KDTParameterManagement &) = delete; - private: - KDTParameterManagement(); - - private: - std::vector kdt_parameters_; -}; - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/index/vector_index/nsg/nsg.i b/cpp/src/core/include/knowhere/index/vector_index/nsg/nsg.i deleted file mode 100644 index d66dc490..00000000 --- a/cpp/src/core/include/knowhere/index/vector_index/nsg/nsg.i +++ /dev/null @@ -1,15 +0,0 @@ -%module nsg -%{ -#define SWIG_FILE_WITH_INIT -#include - -/* Include the header in the wrapper code */ -#include "nsg.h" - - -%} - - -/* Parse the header file */ -%include "index.h" - diff --git a/cpp/src/core/include/knowhere/index/vector_index/vector_index.h b/cpp/src/core/include/knowhere/index/vector_index/vector_index.h deleted file mode 100644 index 1618bc01..00000000 --- a/cpp/src/core/include/knowhere/index/vector_index/vector_index.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - - -#include -#include "knowhere/common/config.h" -#include "knowhere/common/dataset.h" -#include "knowhere/index/index.h" -#include "knowhere/index/preprocessor/preprocessor.h" - - -namespace zilliz { -namespace knowhere { - -class VectorIndex; -using VectorIndexPtr = std::shared_ptr; - - -class VectorIndex : public Index { - public: - virtual PreprocessorPtr - BuildPreprocessor(const DatasetPtr &dataset, const Config &config) { return nullptr; } - - virtual IndexModelPtr - Train(const DatasetPtr &dataset, const Config &config) { return nullptr; } - - virtual void - Add(const DatasetPtr &dataset, const Config &config) = 0; - - virtual void - Seal() = 0; - - virtual VectorIndexPtr - Clone() = 0; - - virtual int64_t - Count() = 0; - - virtual int64_t - Dimension() = 0; -}; - - - -} // namespace knowhere -} // namespace zilliz diff --git a/cpp/src/core/src/CMakeLists.txt b/cpp/src/core/knowhere/CMakeLists.txt similarity index 97% rename from cpp/src/core/src/CMakeLists.txt rename to cpp/src/core/knowhere/CMakeLists.txt index a51a62b4..6e6d81c0 100644 --- a/cpp/src/core/src/CMakeLists.txt +++ b/cpp/src/core/knowhere/CMakeLists.txt @@ -5,7 +5,7 @@ include_directories(${TBB_DIR}/include) include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib64) -include_directories(${CORE_SOURCE_DIR}/include) +include_directories(${CORE_SOURCE_DIR}/knowhere) include_directories(${CORE_SOURCE_DIR}/thirdparty) include_directories(${CORE_SOURCE_DIR}/thirdparty/SPTAG/AnnService) include_directories(${CORE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include) @@ -107,7 +107,7 @@ INSTALL(FILES ${CORE_SOURCE_DIR}/thirdparty/tbb/libtbb.so ) set(CORE_INCLUDE_DIRS - ${CORE_SOURCE_DIR}/include + ${CORE_SOURCE_DIR}/knowhere ${CORE_SOURCE_DIR}/thirdparty ${CORE_SOURCE_DIR}/thirdparty/SPTAG/AnnService ${CORE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include diff --git a/cpp/src/core/src/knowhere/adapter/arrow.cpp b/cpp/src/core/knowhere/knowhere/adapter/arrow.cpp similarity index 58% rename from cpp/src/core/src/knowhere/adapter/arrow.cpp rename to cpp/src/core/knowhere/knowhere/adapter/arrow.cpp index c70c5842..c4804d33 100644 --- a/cpp/src/core/src/knowhere/adapter/arrow.cpp +++ b/cpp/src/core/knowhere/knowhere/adapter/arrow.cpp @@ -1,5 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. -#include "knowhere/adapter/arrow.h" + +#include "arrow.h" namespace zilliz { namespace knowhere { diff --git a/cpp/src/core/knowhere/knowhere/adapter/arrow.h b/cpp/src/core/knowhere/knowhere/adapter/arrow.h new file mode 100644 index 00000000..318336e7 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/adapter/arrow.h @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include + +#include "knowhere/common/array.h" + + +namespace zilliz { +namespace knowhere { + +ArrayPtr +CopyArray(const ArrayPtr &origin); + +SchemaPtr +CopySchema(const SchemaPtr &origin); + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/adapter/faiss_adopt.h b/cpp/src/core/knowhere/knowhere/adapter/faiss_adopt.h similarity index 100% rename from cpp/src/core/include/knowhere/adapter/faiss_adopt.h rename to cpp/src/core/knowhere/knowhere/adapter/faiss_adopt.h diff --git a/cpp/src/core/src/knowhere/adapter/sptag.cpp b/cpp/src/core/knowhere/knowhere/adapter/sptag.cpp similarity index 83% rename from cpp/src/core/src/knowhere/adapter/sptag.cpp rename to cpp/src/core/knowhere/knowhere/adapter/sptag.cpp index a724a27d..995d0685 100644 --- a/cpp/src/core/src/knowhere/adapter/sptag.cpp +++ b/cpp/src/core/knowhere/knowhere/adapter/sptag.cpp @@ -1,7 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. #include "knowhere/index/vector_index/definitions.h" -#include "knowhere/adapter/sptag.h" -#include "knowhere/adapter/structure.h" +#include "sptag.h" +#include "structure.h" namespace zilliz { diff --git a/cpp/src/core/knowhere/knowhere/adapter/sptag.h b/cpp/src/core/knowhere/knowhere/adapter/sptag.h new file mode 100644 index 00000000..eb7886c2 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/adapter/sptag.h @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include + +#include + +#include "knowhere/common/dataset.h" + +namespace zilliz { +namespace knowhere { + +std::shared_ptr +ConvertToVectorSet(const DatasetPtr &dataset); + +std::shared_ptr +ConvertToMetadataSet(const DatasetPtr &dataset); + +std::vector +ConvertToQueryResult(const DatasetPtr &dataset, const Config &config); + +DatasetPtr +ConvertToDataset(std::vector query_results); + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/src/knowhere/adapter/structure.cpp b/cpp/src/core/knowhere/knowhere/adapter/structure.cpp similarity index 98% rename from cpp/src/core/src/knowhere/adapter/structure.cpp rename to cpp/src/core/knowhere/knowhere/adapter/structure.cpp index f30479dd..10b6af81 100644 --- a/cpp/src/core/src/knowhere/adapter/structure.cpp +++ b/cpp/src/core/knowhere/knowhere/adapter/structure.cpp @@ -16,7 +16,7 @@ // under the License. -#include "knowhere/adapter/structure.h" +#include "structure.h" namespace zilliz { diff --git a/cpp/src/core/include/knowhere/adapter/structure.h b/cpp/src/core/knowhere/knowhere/adapter/structure.h similarity index 97% rename from cpp/src/core/include/knowhere/adapter/structure.h rename to cpp/src/core/knowhere/knowhere/adapter/structure.h index 9ffac4fd..76a03a23 100644 --- a/cpp/src/core/include/knowhere/adapter/structure.h +++ b/cpp/src/core/knowhere/knowhere/adapter/structure.h @@ -19,7 +19,7 @@ #pragma once #include -#include +#include "knowhere/common/dataset.h" namespace zilliz { diff --git a/cpp/src/core/include/knowhere/common/array.h b/cpp/src/core/knowhere/knowhere/common/array.h similarity index 52% rename from cpp/src/core/include/knowhere/common/array.h rename to cpp/src/core/knowhere/knowhere/common/array.h index f3d03105..1860524e 100644 --- a/cpp/src/core/include/knowhere/common/array.h +++ b/cpp/src/core/knowhere/knowhere/common/array.h @@ -1,7 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + #pragma once #include "arrow/array.h" -#include "knowhere/common/schema.h" +#include "schema.h" namespace zilliz { diff --git a/cpp/src/core/include/knowhere/common/binary_set.h b/cpp/src/core/knowhere/knowhere/common/binary_set.h similarity index 58% rename from cpp/src/core/include/knowhere/common/binary_set.h rename to cpp/src/core/knowhere/knowhere/common/binary_set.h index b83d96df..019c42a2 100644 --- a/cpp/src/core/include/knowhere/common/binary_set.h +++ b/cpp/src/core/knowhere/knowhere/common/binary_set.h @@ -1,3 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + #pragma once #include @@ -5,7 +23,7 @@ #include #include -#include "knowhere/common/id.h" +#include "id.h" namespace zilliz { diff --git a/cpp/src/core/include/knowhere/common/buffer.h b/cpp/src/core/knowhere/knowhere/common/buffer.h similarity index 56% rename from cpp/src/core/include/knowhere/common/buffer.h rename to cpp/src/core/knowhere/knowhere/common/buffer.h index 44867e76..019c0487 100644 --- a/cpp/src/core/include/knowhere/common/buffer.h +++ b/cpp/src/core/knowhere/knowhere/common/buffer.h @@ -1,6 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + #pragma once #include + #include "arrow/buffer.h" diff --git a/cpp/src/core/knowhere/knowhere/common/config.h b/cpp/src/core/knowhere/knowhere/common/config.h new file mode 100644 index 00000000..399555c0 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/common/config.h @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include + + +namespace zilliz { +namespace knowhere { + + +using Config = jsoncons::json; + + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/include/knowhere/common/dataset.h b/cpp/src/core/knowhere/knowhere/common/dataset.h similarity index 77% rename from cpp/src/core/include/knowhere/common/dataset.h rename to cpp/src/core/knowhere/knowhere/common/dataset.h index ee1d6e51..068bbe43 100644 --- a/cpp/src/core/include/knowhere/common/dataset.h +++ b/cpp/src/core/knowhere/knowhere/common/dataset.h @@ -1,12 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + #pragma once #include #include -#include "knowhere/common/array.h" -#include "knowhere/common/buffer.h" -#include "knowhere/common/tensor.h" -#include "knowhere/common/schema.h" -#include "knowhere/common/config.h" + +#include "array.h" +#include "buffer.h" +#include "tensor.h" +#include "schema.h" +#include "config.h" #include "knowhere/adapter/arrow.h" diff --git a/cpp/src/core/src/knowhere/common/exception.cpp b/cpp/src/core/knowhere/knowhere/common/exception.cpp similarity index 97% rename from cpp/src/core/src/knowhere/common/exception.cpp rename to cpp/src/core/knowhere/knowhere/common/exception.cpp index f46cbfc3..fcf3886d 100644 --- a/cpp/src/core/src/knowhere/common/exception.cpp +++ b/cpp/src/core/knowhere/knowhere/common/exception.cpp @@ -16,9 +16,10 @@ // under the License. -#include "knowhere/common/exception.h" #include +#include "exception.h" + namespace zilliz { namespace knowhere { diff --git a/cpp/src/core/include/knowhere/common/exception.h b/cpp/src/core/knowhere/knowhere/common/exception.h similarity index 100% rename from cpp/src/core/include/knowhere/common/exception.h rename to cpp/src/core/knowhere/knowhere/common/exception.h diff --git a/cpp/src/core/knowhere/knowhere/common/id.h b/cpp/src/core/knowhere/knowhere/common/id.h new file mode 100644 index 00000000..87e1467c --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/common/id.h @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +//#include "zcommon/id/id.h" +//using ID = zilliz::common::ID; + +#include +#include + +namespace zilliz { +namespace knowhere { + + + +class ID { + public: + constexpr static int64_t kIDSize = 20; + + public: + const int32_t * + data() const { return content_; } + + int32_t * + mutable_data() { return content_; } + + bool + IsValid() const; + + std::string + ToString() const; + + bool + operator==(const ID &that) const; + + bool + operator<(const ID &that) const; + + protected: + int32_t content_[5] = {}; +}; + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/knowhere/knowhere/common/schema.h b/cpp/src/core/knowhere/knowhere/common/schema.h new file mode 100644 index 00000000..1ab3d42f --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/common/schema.h @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include + +#include "arrow/type.h" + + +namespace zilliz { +namespace knowhere { + + +using DataType = arrow::DataType; +using Field = arrow::Field; +using FieldPtr = std::shared_ptr; +using Schema = arrow::Schema; +using SchemaPtr = std::shared_ptr; +using SchemaConstPtr = std::shared_ptr; + + + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/knowhere/knowhere/common/tensor.h b/cpp/src/core/knowhere/knowhere/common/tensor.h new file mode 100644 index 00000000..8b92f1f8 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/common/tensor.h @@ -0,0 +1,35 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include + +#include "arrow/tensor.h" + + +namespace zilliz { +namespace knowhere { + + +using Tensor = arrow::Tensor; +using TensorPtr = std::shared_ptr; + + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/src/knowhere/common/timer.cpp b/cpp/src/core/knowhere/knowhere/common/timer.cpp similarity index 98% rename from cpp/src/core/src/knowhere/common/timer.cpp rename to cpp/src/core/knowhere/knowhere/common/timer.cpp index 08654413..f57de535 100644 --- a/cpp/src/core/src/knowhere/common/timer.cpp +++ b/cpp/src/core/knowhere/knowhere/common/timer.cpp @@ -18,7 +18,7 @@ #include // TODO(linxj): using Log instead -#include "knowhere/common/timer.h" +#include "timer.h" namespace zilliz { namespace knowhere { diff --git a/cpp/src/core/include/knowhere/common/timer.h b/cpp/src/core/knowhere/knowhere/common/timer.h similarity index 100% rename from cpp/src/core/include/knowhere/common/timer.h rename to cpp/src/core/knowhere/knowhere/common/timer.h diff --git a/cpp/src/core/knowhere/knowhere/index/index.h b/cpp/src/core/knowhere/knowhere/index/index.h new file mode 100644 index 00000000..275a5fd3 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/index/index.h @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include + +#include "knowhere/common/binary_set.h" +#include "knowhere/common/dataset.h" +#include "index_type.h" +#include "index_model.h" +#include "knowhere/index/preprocessor/preprocessor.h" + + +namespace zilliz { +namespace knowhere { + + +class Index { + public: + virtual BinarySet + Serialize() = 0; + + virtual void + Load(const BinarySet &index_binary) = 0; + + // @throw + virtual DatasetPtr + Search(const DatasetPtr &dataset, const Config &config) = 0; + + public: + IndexType + idx_type() const { return idx_type_; } + + void + set_idx_type(IndexType idx_type) { idx_type_ = idx_type; } + + virtual void + set_preprocessor(PreprocessorPtr preprocessor) {} + + virtual void + set_index_model(IndexModelPtr model) {} + + private: + IndexType idx_type_; +}; + + +using IndexPtr = std::shared_ptr; + + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/knowhere/knowhere/index/index_model.h b/cpp/src/core/knowhere/knowhere/index/index_model.h new file mode 100644 index 00000000..d00a629d --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/index/index_model.h @@ -0,0 +1,42 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include +#include "knowhere/common/binary_set.h" + +namespace zilliz { +namespace knowhere { + + +class IndexModel { + public: + virtual BinarySet + Serialize() = 0; + + virtual void + Load(const BinarySet &binary) = 0; +}; + +using IndexModelPtr = std::shared_ptr; + + + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/knowhere/knowhere/index/index_type.h b/cpp/src/core/knowhere/knowhere/index/index_type.h new file mode 100644 index 00000000..3ece6287 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/index/index_type.h @@ -0,0 +1,35 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + + +namespace zilliz { +namespace knowhere { + + +enum class IndexType { + kUnknown = 0, + kVecIdxBegin = 100, + kVecIVFFlat = kVecIdxBegin, + kVecIdxEnd, +}; + + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/src/knowhere/index/preprocessor/normalize.cpp b/cpp/src/core/knowhere/knowhere/index/preprocessor/normalize.cpp similarity index 100% rename from cpp/src/core/src/knowhere/index/preprocessor/normalize.cpp rename to cpp/src/core/knowhere/knowhere/index/preprocessor/normalize.cpp diff --git a/cpp/src/core/include/knowhere/index/preprocessor/normalize.h b/cpp/src/core/knowhere/knowhere/index/preprocessor/normalize.h similarity index 100% rename from cpp/src/core/include/knowhere/index/preprocessor/normalize.h rename to cpp/src/core/knowhere/knowhere/index/preprocessor/normalize.h diff --git a/cpp/src/core/knowhere/knowhere/index/preprocessor/preprocessor.h b/cpp/src/core/knowhere/knowhere/index/preprocessor/preprocessor.h new file mode 100644 index 00000000..10f05442 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/index/preprocessor/preprocessor.h @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include + +#include "knowhere/common/dataset.h" + + +namespace zilliz { +namespace knowhere { + + +class Preprocessor { + public: + virtual DatasetPtr + Preprocess(const DatasetPtr &input) = 0; +}; + + +using PreprocessorPtr = std::shared_ptr; + + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/src/knowhere/index/vector_index/cloner.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/cloner.cpp similarity index 91% rename from cpp/src/core/src/knowhere/index/vector_index/cloner.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/cloner.cpp index f5bcfb89..4519def3 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/cloner.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/cloner.cpp @@ -17,10 +17,10 @@ #include "knowhere/common/exception.h" -#include "knowhere/index/vector_index/cloner.h" -#include "knowhere/index/vector_index/ivf.h" -#include "knowhere/index/vector_index/gpu_ivf.h" -#include "knowhere/index/vector_index/idmap.h" +#include "cloner.h" +#include "ivf.h" +#include "gpu_ivf.h" +#include "idmap.h" namespace zilliz { diff --git a/cpp/src/core/include/knowhere/index/vector_index/cloner.h b/cpp/src/core/knowhere/knowhere/index/vector_index/cloner.h similarity index 100% rename from cpp/src/core/include/knowhere/index/vector_index/cloner.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/cloner.h diff --git a/cpp/src/core/src/knowhere/index/vector_index/cpu_kdt_rng.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/cpu_kdt_rng.cpp similarity index 83% rename from cpp/src/core/src/knowhere/index/vector_index/cpu_kdt_rng.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/cpu_kdt_rng.cpp index 08053981..d588efb7 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/cpu_kdt_rng.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/cpu_kdt_rng.cpp @@ -1,3 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + #include #include @@ -7,10 +24,10 @@ #undef mkdir -#include "knowhere/index/vector_index/cpu_kdt_rng.h" -#include "knowhere/index/vector_index/definitions.h" +#include "cpu_kdt_rng.h" +#include "definitions.h" //#include "knowhere/index/preprocessor/normalize.h" -#include "knowhere/index/vector_index/kdt_parameters.h" +#include "kdt_parameters.h" #include "knowhere/adapter/sptag.h" #include "knowhere/common/exception.h" diff --git a/cpp/src/core/include/knowhere/index/vector_index/cpu_kdt_rng.h b/cpp/src/core/knowhere/knowhere/index/vector_index/cpu_kdt_rng.h similarity index 66% rename from cpp/src/core/include/knowhere/index/vector_index/cpu_kdt_rng.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/cpu_kdt_rng.h index 0e1cc55e..35d48899 100644 --- a/cpp/src/core/include/knowhere/index/vector_index/cpu_kdt_rng.h +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/cpu_kdt_rng.h @@ -1,8 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + #pragma once #include #include -#include "knowhere/index/vector_index/vector_index.h" +#include "vector_index.h" #include "knowhere/index/index_model.h" #include diff --git a/cpp/src/core/knowhere/knowhere/index/vector_index/definitions.h b/cpp/src/core/knowhere/knowhere/index/vector_index/definitions.h new file mode 100644 index 00000000..3db32e00 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/definitions.h @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include + + +namespace zilliz { +namespace knowhere { + +#define META_ROWS ("rows") +#define META_DIM ("dimension") +#define META_K ("k") + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/src/knowhere/index/vector_index/gpu_ivf.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/gpu_ivf.cpp similarity index 99% rename from cpp/src/core/src/knowhere/index/vector_index/gpu_ivf.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/gpu_ivf.cpp index 590ded16..fd04501c 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/gpu_ivf.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/gpu_ivf.cpp @@ -27,9 +27,9 @@ #include "knowhere/common/exception.h" -#include "knowhere/index/vector_index/cloner.h" +#include "cloner.h" #include "knowhere/adapter/faiss_adopt.h" -#include "knowhere/index/vector_index/gpu_ivf.h" +#include "gpu_ivf.h" #include diff --git a/cpp/src/core/include/knowhere/index/vector_index/gpu_ivf.h b/cpp/src/core/knowhere/knowhere/index/vector_index/gpu_ivf.h similarity index 87% rename from cpp/src/core/include/knowhere/index/vector_index/gpu_ivf.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/gpu_ivf.h index 8eed6f8f..429a9416 100644 --- a/cpp/src/core/include/knowhere/index/vector_index/gpu_ivf.h +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/gpu_ivf.h @@ -1,3 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + #pragma once #include diff --git a/cpp/src/core/src/knowhere/index/vector_index/idmap.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/idmap.cpp similarity index 99% rename from cpp/src/core/src/knowhere/index/vector_index/idmap.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/idmap.cpp index 142d06b5..b4085e6d 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/idmap.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/idmap.cpp @@ -25,7 +25,7 @@ #include "knowhere/common/exception.h" #include "knowhere/adapter/faiss_adopt.h" -#include "knowhere/index/vector_index/idmap.h" +#include "idmap.h" namespace zilliz { diff --git a/cpp/src/core/include/knowhere/index/vector_index/idmap.h b/cpp/src/core/knowhere/knowhere/index/vector_index/idmap.h similarity index 100% rename from cpp/src/core/include/knowhere/index/vector_index/idmap.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/idmap.h diff --git a/cpp/src/core/src/knowhere/index/vector_index/ivf.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/ivf.cpp similarity index 98% rename from cpp/src/core/src/knowhere/index/vector_index/ivf.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/ivf.cpp index acfbb176..6d724790 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/ivf.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/ivf.cpp @@ -25,13 +25,12 @@ #include #include #include -#include #include "knowhere/common/exception.h" -#include "knowhere/index/vector_index/ivf.h" +#include "ivf.h" #include "knowhere/adapter/faiss_adopt.h" -#include "knowhere/index/vector_index/gpu_ivf.h" +#include "gpu_ivf.h" namespace zilliz { diff --git a/cpp/src/core/include/knowhere/index/vector_index/ivf.h b/cpp/src/core/knowhere/knowhere/index/vector_index/ivf.h similarity index 98% rename from cpp/src/core/include/knowhere/index/vector_index/ivf.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/ivf.h index e8ac6cae..c23b5abc 100644 --- a/cpp/src/core/include/knowhere/index/vector_index/ivf.h +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/ivf.h @@ -25,7 +25,7 @@ #include #include -#include "knowhere/index/vector_index/vector_index.h" +#include "vector_index.h" namespace zilliz { diff --git a/cpp/src/core/src/knowhere/index/vector_index/kdt_parameters.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/kdt_parameters.cpp similarity index 54% rename from cpp/src/core/src/knowhere/index/vector_index/kdt_parameters.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/kdt_parameters.cpp index 9f62b5d3..b0ed9f6d 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/kdt_parameters.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/kdt_parameters.cpp @@ -1,6 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + #include -#include "knowhere/index/vector_index/kdt_parameters.h" + +#include "kdt_parameters.h" namespace zilliz { diff --git a/cpp/src/core/knowhere/knowhere/index/vector_index/kdt_parameters.h b/cpp/src/core/knowhere/knowhere/index/vector_index/kdt_parameters.h new file mode 100644 index 00000000..03f660a0 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/kdt_parameters.h @@ -0,0 +1,52 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + +#include +#include + + +namespace zilliz { +namespace knowhere { + +using KDTParameter = std::pair; + +class KDTParameterManagement { + public: + const std::vector & + GetKDTParameters(); + + public: + static KDTParameterManagement & + GetInstance() { + static KDTParameterManagement instance; + return instance; + } + + KDTParameterManagement(const KDTParameterManagement &) = delete; + KDTParameterManagement &operator=(const KDTParameterManagement &) = delete; + private: + KDTParameterManagement(); + + private: + std::vector kdt_parameters_; +}; + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/src/knowhere/index/vector_index/nsg/index_io.h b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/index_io.h similarity index 95% rename from cpp/src/core/src/knowhere/index/vector_index/nsg/index_io.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg/index_io.h index fd8fc9e7..60e27bd7 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/nsg/index_io.h +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/index_io.h @@ -18,7 +18,7 @@ #pragma once -#include "knowhere/index/vector_index/nsg/nsg.h" +#include "nsg.h" namespace zilliz { namespace knowhere { diff --git a/cpp/src/core/include/knowhere/index/vector_index/nsg/neighbor.h b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/neighbor.h similarity index 100% rename from cpp/src/core/include/knowhere/index/vector_index/nsg/neighbor.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg/neighbor.h diff --git a/cpp/src/core/src/knowhere/index/vector_index/nsg/nsg.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg.cpp similarity index 99% rename from cpp/src/core/src/knowhere/index/vector_index/nsg/nsg.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg.cpp index d3efc5e3..d42f4c56 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/nsg/nsg.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg.cpp @@ -22,7 +22,7 @@ #include #include -#include "knowhere/index/vector_index/nsg/nsg.h" +#include "nsg.h" #include "knowhere/common/exception.h" #include "knowhere/common/timer.h" #include "utils.h" diff --git a/cpp/src/core/include/knowhere/index/vector_index/nsg/nsg.h b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg.h similarity index 100% rename from cpp/src/core/include/knowhere/index/vector_index/nsg/nsg.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg.h diff --git a/cpp/src/core/src/knowhere/index/vector_index/nsg/nsg_io.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg_io.cpp similarity index 97% rename from cpp/src/core/src/knowhere/index/vector_index/nsg/nsg_io.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg_io.cpp index 283e8cc7..34d629ec 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/nsg/nsg_io.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg_io.cpp @@ -18,7 +18,7 @@ #include -#include "knowhere/index/vector_index/nsg/nsg_io.h" +#include "nsg_io.h" namespace zilliz { diff --git a/cpp/src/core/include/knowhere/index/vector_index/nsg/nsg_io.h b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg_io.h similarity index 100% rename from cpp/src/core/include/knowhere/index/vector_index/nsg/nsg_io.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg/nsg_io.h diff --git a/cpp/src/core/src/knowhere/index/vector_index/nsg/utils.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/utils.cpp similarity index 100% rename from cpp/src/core/src/knowhere/index/vector_index/nsg/utils.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg/utils.cpp diff --git a/cpp/src/core/src/knowhere/index/vector_index/nsg/utils.h b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/utils.h similarity index 95% rename from cpp/src/core/src/knowhere/index/vector_index/nsg/utils.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg/utils.h index 82c8a00d..a57a7738 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/nsg/utils.h +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/utils.h @@ -23,7 +23,7 @@ #include -#include "knowhere/index/vector_index/nsg/nsg.h" +#include "nsg.h" #include "knowhere/common/config.h" diff --git a/cpp/src/core/src/knowhere/index/vector_index/nsg_index.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg_index.cpp similarity index 96% rename from cpp/src/core/src/knowhere/index/vector_index/nsg_index.cpp rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg_index.cpp index 550efef7..724c80df 100644 --- a/cpp/src/core/src/knowhere/index/vector_index/nsg_index.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg_index.cpp @@ -16,12 +16,12 @@ // under the License. -#include "knowhere/index/vector_index/nsg_index.h" +#include "nsg_index.h" #include "knowhere/index/vector_index/nsg/nsg.h" #include "knowhere/index/vector_index/nsg/nsg_io.h" -#include "knowhere/index/vector_index/idmap.h" -#include "knowhere/index/vector_index/ivf.h" -#include "knowhere/index/vector_index/gpu_ivf.h" +#include "idmap.h" +#include "ivf.h" +#include "gpu_ivf.h" #include "knowhere/adapter/faiss_adopt.h" #include "knowhere/common/exception.h" #include "knowhere/common/timer.h" diff --git a/cpp/src/core/include/knowhere/index/vector_index/nsg_index.h b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg_index.h similarity index 96% rename from cpp/src/core/include/knowhere/index/vector_index/nsg_index.h rename to cpp/src/core/knowhere/knowhere/index/vector_index/nsg_index.h index a0829f38..e63dbb03 100644 --- a/cpp/src/core/include/knowhere/index/vector_index/nsg_index.h +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg_index.h @@ -18,7 +18,7 @@ #pragma once -#include "knowhere/index/vector_index/vector_index.h" +#include "vector_index.h" namespace zilliz { diff --git a/cpp/src/core/knowhere/knowhere/index/vector_index/vector_index.h b/cpp/src/core/knowhere/knowhere/index/vector_index/vector_index.h new file mode 100644 index 00000000..1828e357 --- /dev/null +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/vector_index.h @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + +#pragma once + + +#include + +#include "knowhere/common/config.h" +#include "knowhere/common/dataset.h" +#include "knowhere/index/index.h" +#include "knowhere/index/preprocessor/preprocessor.h" + + +namespace zilliz { +namespace knowhere { + +class VectorIndex; +using VectorIndexPtr = std::shared_ptr; + + +class VectorIndex : public Index { + public: + virtual PreprocessorPtr + BuildPreprocessor(const DatasetPtr &dataset, const Config &config) { return nullptr; } + + virtual IndexModelPtr + Train(const DatasetPtr &dataset, const Config &config) { return nullptr; } + + virtual void + Add(const DatasetPtr &dataset, const Config &config) = 0; + + virtual void + Seal() = 0; + + virtual VectorIndexPtr + Clone() = 0; + + virtual int64_t + Count() = 0; + + virtual int64_t + Dimension() = 0; +}; + + + +} // namespace knowhere +} // namespace zilliz diff --git a/cpp/src/core/test/CMakeLists.txt b/cpp/src/core/test/CMakeLists.txt index cba8a03b..5b8dca2e 100644 --- a/cpp/src/core/test/CMakeLists.txt +++ b/cpp/src/core/test/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories(${CORE_SOURCE_DIR}/thirdparty) include_directories(${CORE_SOURCE_DIR}/thirdparty/SPTAG/AnnService) -include_directories(${CORE_SOURCE_DIR}/include) +include_directories(${CORE_SOURCE_DIR}/knowhere) include_directories(${CORE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include) include_directories(/usr/local/cuda/include) link_directories(/usr/local/cuda/lib64) @@ -25,13 +25,13 @@ set(basic_libs # set(ivf_srcs - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/ivf.cpp - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/gpu_ivf.cpp - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/cloner.cpp - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/idmap.cpp - ${CORE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp - ${CORE_SOURCE_DIR}/src/knowhere/common/exception.cpp - ${CORE_SOURCE_DIR}/src/knowhere/common/timer.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/ivf.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/gpu_ivf.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/cloner.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/idmap.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/adapter/structure.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/common/exception.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/common/timer.cpp utils.cpp ) if(NOT TARGET test_ivf) @@ -41,13 +41,13 @@ target_link_libraries(test_ivf ${depend_libs} ${unittest_libs} ${basic_libs}) # set(idmap_srcs - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/idmap.cpp - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/ivf.cpp - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/cloner.cpp - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/gpu_ivf.cpp - ${CORE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp - ${CORE_SOURCE_DIR}/src/knowhere/common/exception.cpp - ${CORE_SOURCE_DIR}/src/knowhere/common/timer.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/idmap.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/ivf.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/cloner.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/gpu_ivf.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/adapter/structure.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/common/exception.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/common/timer.cpp utils.cpp ) if(NOT TARGET test_idmap) @@ -57,14 +57,14 @@ target_link_libraries(test_idmap ${depend_libs} ${unittest_libs} ${basic_libs}) # set(kdt_srcs - ${CORE_SOURCE_DIR}/src/knowhere/index/preprocessor/normalize.cpp - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/kdt_parameters.cpp - ${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/cpu_kdt_rng.cpp - ${CORE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp - ${CORE_SOURCE_DIR}/src/knowhere/adapter/sptag.cpp - ${CORE_SOURCE_DIR}/src/knowhere/common/exception.cpp - ${CORE_SOURCE_DIR}/src/knowhere/adapter/arrow.cpp - ${CORE_SOURCE_DIR}/src/knowhere/common/timer.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/preprocessor/normalize.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/kdt_parameters.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/index/vector_index/cpu_kdt_rng.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/adapter/structure.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/adapter/sptag.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/common/exception.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/adapter/arrow.cpp + ${CORE_SOURCE_DIR}/knowhere/knowhere/common/timer.cpp utils.cpp ) if(NOT TARGET test_kdt) -- GitLab