diff --git a/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/NSG.cpp b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/NSG.cpp index 375664fbf818ee8d2c949111d52e75278a3c314d..bdf538c20479ec7e3d4d039fb3b24ef0ecf22e03 100644 --- a/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/NSG.cpp +++ b/cpp/src/core/knowhere/knowhere/index/vector_index/nsg/NSG.cpp @@ -765,8 +765,8 @@ NsgIndex::SetKnnGraph(Graph& g) { } // void NsgIndex::GetKnnGraphFromFile() { -// //std::string filename = "/home/zilliz/opt/workspace/wook/efanna_graph/tests/sift.1M.50NN.graph"; -// std::string filename = "/home/zilliz/opt/workspace/wook/efanna_graph/tests/sift.50NN.graph"; +// //std::string filename = "sift.1M.50NN.graph"; +// std::string filename = "sift.50NN.graph"; // // std::ifstream in(filename, std::ios::binary); // unsigned k; diff --git a/cpp/src/core/thirdparty/SPTAG/build.sh b/cpp/src/core/thirdparty/SPTAG/build.sh index 9b83643df2214ec39ba2f649b86866389153312c..bd9833d605886768ebebcc4385667a81d160a8e4 100755 --- a/cpp/src/core/thirdparty/SPTAG/build.sh +++ b/cpp/src/core/thirdparty/SPTAG/build.sh @@ -9,12 +9,6 @@ cd cmake_build INSTALL_PREFIX=$(pwd)/../../build -BOOST_PATH="/home/zilliz/opt/app/boost" -TBB_PATH="/home/zilliz/opt/app/tbb/tbb" -OPTION="-DBOOST_ROOT=$BOOST_PATH -DTBB_DIR=${TBB_PATH}" - -# CMAKE_CMD="cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ${OPTION} ../" - CMAKE_CMD="cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ../" ${CMAKE_CMD} diff --git a/cpp/src/core/unittest/test_json.cpp b/cpp/src/core/unittest/test_json.cpp deleted file mode 100644 index a3babbc1b7943ac78ceecf74c922eab67113858b..0000000000000000000000000000000000000000 --- a/cpp/src/core/unittest/test_json.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// 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/common/config.h" - -int -main() { - knowhere::Config cfg; - - cfg["size"] = size_t(199); - auto size = cfg.get_with_default("size", 123); - auto size_2 = cfg["size"].as(); - printf("%d", size_2); -} diff --git a/cpp/src/core/unittest/test_nsg.cpp b/cpp/src/core/unittest/test_nsg.cpp deleted file mode 100644 index a4b6006e719a688a1d264101f92c4e7fd0dccb8d..0000000000000000000000000000000000000000 --- a/cpp/src/core/unittest/test_nsg.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// 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 -#include "knowhere/index/index.h" -#include "test/utils.h" - -//#include - -void -load_data(std::string& filename, float*& data, unsigned& num, - unsigned& dim) { // load data with sift10K pattern - std::ifstream in(filename, std::ios::binary); - if (!in.is_open()) { - std::cout << "open file error" << std::endl; - exit(-1); - } - in.read((char*)&dim, 4); - in.seekg(0, std::ios::end); - std::ios::pos_type ss = in.tellg(); - size_t fsize = (size_t)ss; - num = (unsigned)(fsize / (dim + 1) / 4); - data = new float[(size_t)num * (size_t)dim]; - - in.seekg(0, std::ios::beg); - for (size_t i = 0; i < num; i++) { - in.seekg(4, std::ios::cur); - in.read((char*)(data + i * dim), dim * 4); - } - in.close(); -} - -void -test_distance() { - std::vector xb{1, 2, 3, 4}; - std::vector xq{2, 2, 3, 4}; - float r = calculate(xb.data(), xq.data(), 4); - std::cout << r << std::endl; -} - -int -main() { - test_distance(); - - BuildParams params; - params.search_length = 100; - params.candidate_pool_size = 100; - params.out_degree = 50; - - float* data = nullptr; - int64_t* ids = nullptr; - unsigned ntotal, dim; - std::string filename = "/home/zilliz/opt/workspace/wook/efanna_graph/tests/siftsmall/siftsmall_base.fvecs"; - // std::string filename = "/home/zilliz/opt/workspace/wook/efanna_graph/tests/sift/sift_base.fvecs"; - - load_data(filename, data, ntotal, dim); - assert(data); - // float x = calculate(data + dim * 0, data + dim * 62, dim); - // std::cout << x << std::endl; - - NsgIndex index(dim, ntotal); - - auto s = std::chrono::high_resolution_clock::now(); - index.Build_with_ids(ntotal, data, ids, params); - auto e = std::chrono::high_resolution_clock::now(); - std::chrono::duration diff = e - s; - std::cout << "indexing time: " << diff.count() << "\n"; - - int k = 10; - int nq = 1000; - SearchParams s_params; - s_params.search_length = 50; - auto dist = new float[nq * k]; - auto ids_b = new int64_t[nq * k]; - s = std::chrono::high_resolution_clock::now(); - // ProfilerStart("xx.prof"); - index.Search(data, nq, dim, k, dist, ids_b, s_params); - // ProfilerStop(); - e = std::chrono::high_resolution_clock::now(); - diff = e - s; - std::cout << "search time: " << diff.count() << "\n"; - - for (int i = 0; i < k; ++i) { - std::cout << "id " << ids_b[i] << std::endl; - // std::cout << "dist " << dist[i] << std::endl; - } - - delete[] dist; - delete[] ids_b; - - return 0; -} diff --git a/cpp/unittest/server/util_test.cpp b/cpp/unittest/server/util_test.cpp index 7ae1b31711d351241d60a51cb8c7d411a0c672f7..395839a8c03534cb7d0b750bfb391687802fef98 100644 --- a/cpp/unittest/server/util_test.cpp +++ b/cpp/unittest/server/util_test.cpp @@ -107,13 +107,13 @@ TEST(UtilTest, COMMON_TEST) { } TEST(UtilTest, STRINGFUNCTIONS_TEST) { - std::string str = " test zilliz"; + std::string str = " test str"; milvus::server::StringHelpFunctions::TrimStringBlank(str); - ASSERT_EQ(str, "test zilliz"); + ASSERT_EQ(str, "test str"); - str = "\"test zilliz\""; + str = "\"test str\""; milvus::server::StringHelpFunctions::TrimStringQuote(str, "\""); - ASSERT_EQ(str, "test zilliz"); + ASSERT_EQ(str, "test str"); str = "a,b,c"; std::vector result; @@ -376,7 +376,7 @@ TEST(UtilTest, ROLLOUTHANDLER_TEST) { std::ofstream file; file.open(tmp.c_str()); - file << "zilliz" << std::endl; + file << "test" << std::endl; milvus::server::RolloutHandler(tmp.c_str(), 0, list[i]); @@ -386,7 +386,7 @@ TEST(UtilTest, ROLLOUTHANDLER_TEST) { std::string tmp2; file2 >> tmp2; - ASSERT_EQ(tmp2, "zilliz"); + ASSERT_EQ(tmp2, "test"); } boost::filesystem::remove_all(dir2); }