diff --git a/cpp/cmake/ThirdPartyPackages.cmake b/cpp/cmake/ThirdPartyPackages.cmake index b4b21b8085e4a910e57bfab46d0a4c1be27b3f9a..8b888519f9e5b31a5fabd22ba881adde949f83d5 100644 --- a/cpp/cmake/ThirdPartyPackages.cmake +++ b/cpp/cmake/ThirdPartyPackages.cmake @@ -534,7 +534,7 @@ if(MILVUS_BOOST_VENDORED) "" ${EP_LOG_OPTIONS}) set(Boost_INCLUDE_DIR "${BOOST_PREFIX}") - set(Boost_INCLUDE_DIRS "${BOOST_INCLUDE_DIR}") + set(Boost_INCLUDE_DIRS "${Boost_INCLUDE_DIR}") add_dependencies(boost_system_static boost_ep) add_dependencies(boost_filesystem_static boost_ep) add_dependencies(boost_serialization_static boost_ep) diff --git a/cpp/src/db/Factories.cpp b/cpp/src/db/Factories.cpp index 3cfb9a6eb3c6938c73cfcf232960b194a1096a3a..442dca297421eadbe2016430b646df7ff8848afb 100644 --- a/cpp/src/db/Factories.cpp +++ b/cpp/src/db/Factories.cpp @@ -26,8 +26,6 @@ namespace zilliz { namespace milvus { namespace engine { -#define USE_NEW_MEM_MANAGER 1 - DBMetaOptions DBMetaOptionsFactory::Build(const std::string& path) { auto p = path; if(p == "") { diff --git a/cpp/unittest/CMakeLists.txt b/cpp/unittest/CMakeLists.txt index 8675bf8735eca1468fe760aef609e1542b3e7e4d..225aca2c8135a4efd3603d50d12e839ca9f582a1 100644 --- a/cpp/unittest/CMakeLists.txt +++ b/cpp/unittest/CMakeLists.txt @@ -37,7 +37,7 @@ set(unittest_libs ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so ) -#add_subdirectory(server) +add_subdirectory(server) add_subdirectory(db) add_subdirectory(index_wrapper) #add_subdirectory(faiss_wrapper) diff --git a/cpp/unittest/db/CMakeLists.txt b/cpp/unittest/db/CMakeLists.txt index 2d360a5d62db13a902fc01e2dfc1f97ad32dac73..60c22d0ee29b002f43ab2aef2c10e17e6a4eeaee 100644 --- a/cpp/unittest/db/CMakeLists.txt +++ b/cpp/unittest/db/CMakeLists.txt @@ -24,6 +24,8 @@ link_directories("/usr/local/cuda/lib64") include_directories(/usr/include/mysql) +#add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) + set(db_test_src #${unittest_srcs} ${config_files} @@ -40,8 +42,8 @@ cuda_add_executable(db_test ${db_test_src}) set(db_libs sqlite - boost_system - boost_filesystem + boost_system_static + boost_filesystem_static lz4 mysqlpp ) @@ -59,6 +61,6 @@ set(knowhere_libs cublas ) -target_link_libraries(db_test ${db_libs} ${unittest_libs} ${knowhere_libs}) +target_link_libraries(db_test ${knowhere_libs} ${db_libs} ${unittest_libs}) install(TARGETS db_test DESTINATION bin) diff --git a/cpp/unittest/faiss_wrapper/CMakeLists.txt b/cpp/unittest/faiss_wrapper/CMakeLists.txt index f044df8d8cf225ff8235896d6d8c8bd972dcefd7..ff2535e3fd676144353756295fb5ab62e835cc43 100644 --- a/cpp/unittest/faiss_wrapper/CMakeLists.txt +++ b/cpp/unittest/faiss_wrapper/CMakeLists.txt @@ -22,13 +22,13 @@ add_executable(wrapper_test ${wrapper_test_src}) set(wrapper_libs stdc++ - boost_system - boost_filesystem + boost_system_static + boost_filesystem_static libgpufaiss.a faiss cudart cublas - sqlite3 + sqlite snappy bz2 z diff --git a/cpp/unittest/license/CMakeLists.txt b/cpp/unittest/license/CMakeLists.txt index 93af82ed56bbdbaccf5e16daa1e31ca1cf81c5f4..39d0ede19785702c889861a448f8e8871b65c4ca 100644 --- a/cpp/unittest/license/CMakeLists.txt +++ b/cpp/unittest/license/CMakeLists.txt @@ -33,11 +33,11 @@ set(db_libs nvidia-ml cudart cublas - boost_system - boost_filesystem + boost_system_static + boost_filesystem_static lz4 crypto - boost_serialization + boost_serialization_static ) target_link_libraries(license_test ${db_libs} ${unittest_libs}) diff --git a/cpp/unittest/metrics/CMakeLists.txt b/cpp/unittest/metrics/CMakeLists.txt index e55f99eb3e4abd4b13f5f0faf4757390d86be44e..28a438e344ef3bf22cfc487808dee0b9253800e4 100644 --- a/cpp/unittest/metrics/CMakeLists.txt +++ b/cpp/unittest/metrics/CMakeLists.txt @@ -78,8 +78,8 @@ target_link_libraries(metrics_test cudart cublas sqlite - boost_system - boost_filesystem + boost_system_static + boost_filesystem_static lz4 metrics gtest diff --git a/cpp/unittest/server/CMakeLists.txt b/cpp/unittest/server/CMakeLists.txt index 94a581d2761616d985be5b8b127368c5dabf0ba1..29a54fddb8d135881f6d0db9b7385c79661d079b 100644 --- a/cpp/unittest/server/CMakeLists.txt +++ b/cpp/unittest/server/CMakeLists.txt @@ -39,9 +39,9 @@ set(require_libs stdc++ cudart cublas - sqlite3 - boost_system - boost_filesystem + sqlite + boost_system_static + boost_filesystem_static snappy z bz2 diff --git a/cpp/unittest/server/cache_test.cpp b/cpp/unittest/server/cache_test.cpp index 8c323d81d3e7f7d0cfcc2eab4510414f5df07283..4b40861d0bbe307ee8138e69cd0efcb40813348f 100644 --- a/cpp/unittest/server/cache_test.cpp +++ b/cpp/unittest/server/cache_test.cpp @@ -8,6 +8,7 @@ #include "cache/GpuCacheMgr.h" #include "wrapper/Index.h" +#include "wrapper/knowhere/vec_index.h" using namespace zilliz::milvus; @@ -26,6 +27,54 @@ public: } }; +class MockVecIndex : public engine::VecIndex { +public: + virtual void BuildAll(const long &nb, + const float *xb, + const long *ids, + const engine::Config &cfg, + const long &nt = 0, + const float *xt = nullptr) { + + } + + virtual void Add(const long &nb, + const float *xb, + const long *ids, + const engine::Config &cfg = engine::Config()) { + + } + + virtual void Search(const long &nq, + const float *xq, + float *dist, + long *ids, + const engine::Config &cfg = engine::Config()) { + + } + + virtual int64_t Dimension() { + return dimension_; + } + + virtual int64_t Count() { + return ntotal_; + } + + virtual zilliz::knowhere::BinarySet Serialize() { + zilliz::knowhere::BinarySet binset; + return binset; + } + + virtual void Load(const zilliz::knowhere::BinarySet &index_binary) { + + } + +public: + int64_t dimension_ = 512; + int64_t ntotal_ = 0; +}; + } TEST(CacheTest, CPU_CACHE_TEST) { @@ -40,9 +89,9 @@ TEST(CacheTest, CPU_CACHE_TEST) { const int dim = 256; for (int i = 0; i < 20; i++) { - std::shared_ptr raw_index(faiss::index_factory(dim, "IDMap,Flat")); - engine::Index_ptr index = std::make_shared(raw_index); - index->ntotal = 1000000;//less 1G per index + MockVecIndex* mock_index = new MockVecIndex(); + mock_index->ntotal_ = 1000000;//less 1G per index + engine::Index_ptr index(mock_index); cpu_mgr->InsertItem("index_" + std::to_string(i), index); } @@ -65,9 +114,9 @@ TEST(CacheTest, CPU_CACHE_TEST) { g_num = 5; cpu_mgr->SetCapacity(g_num * gbyte); - std::shared_ptr raw_index(faiss::index_factory(dim, "IDMap,Flat")); - engine::Index_ptr index = std::make_shared(raw_index); - index->ntotal = 6000000;//6G less + MockVecIndex* mock_index = new MockVecIndex(); + mock_index->ntotal_ = 6000000;//6G less + engine::Index_ptr index(mock_index); cpu_mgr->InsertItem("index_6g", index); ASSERT_EQ(cpu_mgr->ItemCount(), 0);//data greater than capacity can not be inserted sucessfully @@ -82,9 +131,9 @@ TEST(CacheTest, GPU_CACHE_TEST) { const int dim = 256; for(int i = 0; i < 20; i++) { - std::shared_ptr raw_index(faiss::index_factory(dim, "IDMap,Flat")); - engine::Index_ptr index = std::make_shared(raw_index); - index->ntotal = 1000; + MockVecIndex* mock_index = new MockVecIndex(); + mock_index->ntotal_ = 1000; + engine::Index_ptr index(mock_index); cache::DataObjPtr obj = std::make_shared(index); @@ -117,9 +166,9 @@ TEST(CacheTest, INVALID_TEST) { { LessItemCacheMgr mgr; for(int i = 0; i < 20; i++) { - std::shared_ptr raw_index(faiss::index_factory(2, "IDMap,Flat")); - engine::Index_ptr index = std::make_shared(raw_index); - index->ntotal = 2; + MockVecIndex* mock_index = new MockVecIndex(); + mock_index->ntotal_ = 2; + engine::Index_ptr index(mock_index); cache::DataObjPtr obj = std::make_shared(index); mgr.InsertItem("index_" + std::to_string(i), obj); diff --git a/cpp/unittest/storage/CMakeLists.txt b/cpp/unittest/storage/CMakeLists.txt index 6b4303b70ab32eaedee3b4540e14b31541c9a531..d4deaefab84f94d407b2d538416358bc2e735081 100644 --- a/cpp/unittest/storage/CMakeLists.txt +++ b/cpp/unittest/storage/CMakeLists.txt @@ -25,7 +25,7 @@ set(s3_client_libs stdc++ aws-cpp-sdk-s3 aws-cpp-sdk-core - boost_filesystem + boost_filesystem_static ) target_link_libraries(s3_test ${s3_client_libs} diff --git a/cpp/unittest/utils/CMakeLists.txt b/cpp/unittest/utils/CMakeLists.txt index a46a3b05e1bcec1b0eae4b4932320be0c7c0ebdd..61e4459462ea21b4f4b6da8fab8dbc033a90b13f 100644 --- a/cpp/unittest/utils/CMakeLists.txt +++ b/cpp/unittest/utils/CMakeLists.txt @@ -25,6 +25,6 @@ add_executable(valication_util_test target_link_libraries(valication_util_test ${unittest_libs} - boost_filesystem) + boost_filesystem_static) install(TARGETS valication_util_test DESTINATION bin) \ No newline at end of file