diff --git a/ci/jenkinsfile/packaged_milvus.groovy b/ci/jenkinsfile/packaged_milvus.groovy index 407b100589d284c0052a868c188a119c7c43de33..1d30e21910648fb288d43ac81ae5932e961e49a3 100644 --- a/ci/jenkinsfile/packaged_milvus.groovy +++ b/ci/jenkinsfile/packaged_milvus.groovy @@ -1,7 +1,7 @@ container('milvus-build-env') { timeout(time: 5, unit: 'MINUTES') { dir ("milvus_engine") { - dir ("cpp") { + dir ("core") { gitlabCommitStatus(name: 'Packaged Engine') { if (fileExists('milvus')) { try { diff --git a/ci/jenkinsfile/packaged_milvus_no_ut.groovy b/ci/jenkinsfile/packaged_milvus_no_ut.groovy index b6c31540a1817296dcf3e25edc7281c4d6f17d39..bc68be374a27f85fb75a1b2ad095ab415e346242 100644 --- a/ci/jenkinsfile/packaged_milvus_no_ut.groovy +++ b/ci/jenkinsfile/packaged_milvus_no_ut.groovy @@ -1,7 +1,7 @@ container('milvus-build-env') { timeout(time: 5, unit: 'MINUTES') { dir ("milvus_engine") { - dir ("cpp") { + dir ("core") { gitlabCommitStatus(name: 'Packaged Engine') { if (fileExists('milvus')) { try { diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 8b6b125b8e8296d76c96201dca0499ed454ae721..bbd58fb28d237d64b49074ff8f8ad9a7426e7981 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -9,14 +9,17 @@ Please mark all change in change log and use the ticket from JIRA. - MS-572 - Milvus crash when get SIGINT - MS-577 - Unittest Query randomly hung - MS-587 - Count get wrong result after adding vectors and index built immediately -- MS-599 - search wrong result when table created with metric_type: IP +- MS-599 - Search wrong result when table created with metric_type: IP - MS-601 - Docker logs error caused by get CPUTemperature error - MS-622 - Delete vectors should be failed if date range is invalid - MS-620 - Get table row counts display wrong error code -- MS-637 - out of memory when load too many tasks +- MS-637 - Out of memory when load too many tasks - MS-640 - Cache object size calculate incorrect - MS-641 - Segment fault(signal 11) in PickToLoad - MS-639 - SQ8H index created failed and server hang +- MS-647 - [monitor] grafana display average cpu-temp +- MS-644 - Search crashed with index-type: flat +- MS-624 - Search vectors failed if time ranges long enough - MS-652 - IVFSQH quantization double free ## Improvement diff --git a/core/cmake/ThirdPartyPackages.cmake b/core/cmake/ThirdPartyPackages.cmake index 5347aa0acaf5c516ca33c79f0d0f47a2db13a22e..a7632831b07cf809b0dad9f33e90547a6c9238c7 100644 --- a/core/cmake/ThirdPartyPackages.cmake +++ b/core/cmake/ThirdPartyPackages.cmake @@ -370,9 +370,9 @@ if(DEFINED ENV{MILVUS_GRPC_URL}) set(GRPC_SOURCE_URL "$ENV{MILVUS_GRPC_URL}") else() set(GRPC_SOURCE_URL - "http://git.zilliz.tech/kun.yu/grpc/-/archive/master/grpc-master.tar.gz") + "https://github.com/youny626/grpc-milvus/archive/${GRPC_VERSION}.zip") endif() -set(GRPC_MD5 "7ec59ad54c85a12dcbbfede09bf413a9") +set(GRPC_MD5 "fdd2656424c0e0e046b21354513fc70f") # ---------------------------------------------------------------------- diff --git a/core/src/db/meta/Meta.h b/core/src/db/meta/Meta.h index 8167834568fff65d863c587363259177fe93e323..ec4b66916d9db9e83d5859ce8ee9b3f27065f268 100644 --- a/core/src/db/meta/Meta.h +++ b/core/src/db/meta/Meta.h @@ -81,7 +81,7 @@ class Meta { UpdateTableFiles(TableFilesSchema& files) = 0; virtual Status - FilesToSearch(const std::string& table_id, const std::vector& ids, const DatesT& partition, + FilesToSearch(const std::string& table_id, const std::vector& ids, const DatesT& dates, DatePartionedTableFilesSchema& files) = 0; virtual Status diff --git a/core/src/db/meta/MySQLMetaImpl.cpp b/core/src/db/meta/MySQLMetaImpl.cpp index f9f1569a65854c0199af68651e1e136ca606bc13..44594636ad502240d089fed7fe62bb4f3a315a9c 100644 --- a/core/src/db/meta/MySQLMetaImpl.cpp +++ b/core/src/db/meta/MySQLMetaImpl.cpp @@ -1088,7 +1088,7 @@ MySQLMetaImpl::FilesToIndex(TableFilesSchema& files) { } Status -MySQLMetaImpl::FilesToSearch(const std::string& table_id, const std::vector& ids, const DatesT& partition, +MySQLMetaImpl::FilesToSearch(const std::string& table_id, const std::vector& ids, const DatesT& dates, DatePartionedTableFilesSchema& files) { files.clear(); @@ -1108,9 +1108,9 @@ MySQLMetaImpl::FilesToSearch(const std::string& table_id, const std::vector& ids, const DatesT& partition, + FilesToSearch(const std::string& table_id, const std::vector& ids, const DatesT& dates, DatePartionedTableFilesSchema& files) override; Status diff --git a/core/src/db/meta/SqliteMetaImpl.cpp b/core/src/db/meta/SqliteMetaImpl.cpp index dd9bb6fd300bff7dc15470c61ad92c92f0a1b2e8..3fed2a81d4d47ead873a0f4451baee7270f0750c 100644 --- a/core/src/db/meta/SqliteMetaImpl.cpp +++ b/core/src/db/meta/SqliteMetaImpl.cpp @@ -159,7 +159,7 @@ SqliteMetaImpl::Initialize() { Status SqliteMetaImpl::DropPartitionsByDates(const std::string &table_id, const DatesT &dates) { - if (dates.size() == 0) { + if (dates.empty()) { return Status::OK(); } @@ -171,16 +171,35 @@ SqliteMetaImpl::DropPartitionsByDates(const std::string &table_id, } try { + //sqlite_orm has a bug, 'in' statement cannot handle too many elements + //so we split one query into multi-queries, this is a work-around!! + std::vector split_dates; + split_dates.push_back(DatesT()); + const size_t batch_size = 30; + for(DateT date : dates) { + DatesT& last_batch = *split_dates.rbegin(); + last_batch.push_back(date); + if(last_batch.size() > batch_size) { + split_dates.push_back(DatesT()); + } + } + //multi-threads call sqlite update may get exception('bad logic', etc), so we add a lock here std::lock_guard meta_lock(meta_mutex_); - ConnectorPtr->update_all( - set( - c(&TableFileSchema::file_type_) = (int) TableFileSchema::TO_DELETE, - c(&TableFileSchema::updated_time_) = utils::GetMicroSecTimeStamp()), - where( - c(&TableFileSchema::table_id_) == table_id and - in(&TableFileSchema::date_, dates))); + for(auto& batch_dates : split_dates) { + if(batch_dates.empty()) { + continue; + } + + ConnectorPtr->update_all( + set( + c(&TableFileSchema::file_type_) = (int)TableFileSchema::TO_DELETE, + c(&TableFileSchema::updated_time_) = utils::GetMicroSecTimeStamp()), + where( + c(&TableFileSchema::table_id_) == table_id and + in(&TableFileSchema::date_, batch_dates))); + } ENGINE_LOG_DEBUG << "Successfully drop partitions, table id = " << table_schema.table_id_; } catch (std::exception &e) { @@ -673,7 +692,7 @@ SqliteMetaImpl::FilesToIndex(TableFilesSchema &files) { Status SqliteMetaImpl::FilesToSearch(const std::string &table_id, const std::vector &ids, - const DatesT &partition, + const DatesT &dates, DatePartionedTableFilesSchema &files) { files.clear(); server::MetricCollector metric; @@ -702,23 +721,54 @@ SqliteMetaImpl::FilesToSearch(const std::string &table_id, auto status = DescribeTable(table_schema); if (!status.ok()) { return status; } + //sqlite_orm has a bug, 'in' statement cannot handle too many elements + //so we split one query into multi-queries, this is a work-around!! + std::vector split_dates; + split_dates.push_back(DatesT()); + const size_t batch_size = 30; + for(DateT date : dates) { + DatesT& last_batch = *split_dates.rbegin(); + last_batch.push_back(date); + if(last_batch.size() > batch_size) { + split_dates.push_back(DatesT()); + } + } + + //perform query decltype(ConnectorPtr->select(select_columns)) selected; - if (partition.empty() && ids.empty()) { + if (dates.empty() && ids.empty()) { auto filter = where(match_tableid and match_type); selected = ConnectorPtr->select(select_columns, filter); - } else if (partition.empty() && !ids.empty()) { + } else if (dates.empty() && !ids.empty()) { auto match_fileid = in(&TableFileSchema::id_, ids); auto filter = where(match_tableid and match_fileid and match_type); selected = ConnectorPtr->select(select_columns, filter); - } else if (!partition.empty() && ids.empty()) { - auto match_date = in(&TableFileSchema::date_, partition); - auto filter = where(match_tableid and match_date and match_type); - selected = ConnectorPtr->select(select_columns, filter); - } else if (!partition.empty() && !ids.empty()) { - auto match_fileid = in(&TableFileSchema::id_, ids); - auto match_date = in(&TableFileSchema::date_, partition); - auto filter = where(match_tableid and match_fileid and match_date and match_type); - selected = ConnectorPtr->select(select_columns, filter); + } else if (!dates.empty() && ids.empty()) { + for(auto& batch_dates : split_dates) { + if(batch_dates.empty()) { + continue; + } + auto match_date = in(&TableFileSchema::date_, batch_dates); + auto filter = where(match_tableid and match_date and match_type); + auto batch_selected = ConnectorPtr->select(select_columns, filter); + for (auto &file : batch_selected) { + selected.push_back(file); + } + } + + } else if (!dates.empty() && !ids.empty()) { + for(auto& batch_dates : split_dates) { + if(batch_dates.empty()) { + continue; + } + auto match_fileid = in(&TableFileSchema::id_, ids); + auto match_date = in(&TableFileSchema::date_, batch_dates); + auto filter = where(match_tableid and match_fileid and match_date and match_type); + auto batch_selected = ConnectorPtr->select(select_columns, filter); + for (auto &file : batch_selected) { + selected.push_back(file); + } + } } Status ret; diff --git a/core/src/db/meta/SqliteMetaImpl.h b/core/src/db/meta/SqliteMetaImpl.h index dc132c41ec5dd3b9e675898b0deaae64a227c5cf..c8b99b358ad56235cca6a1fc3d12d0cae55d810e 100644 --- a/core/src/db/meta/SqliteMetaImpl.h +++ b/core/src/db/meta/SqliteMetaImpl.h @@ -89,7 +89,7 @@ class SqliteMetaImpl : public Meta { UpdateTableFiles(TableFilesSchema& files) override; Status - FilesToSearch(const std::string& table_id, const std::vector& ids, const DatesT& partition, + FilesToSearch(const std::string& table_id, const std::vector& ids, const DatesT& dates, DatePartionedTableFilesSchema& files) override; Status diff --git a/core/src/metrics/PrometheusMetrics.cpp b/core/src/metrics/PrometheusMetrics.cpp index 182f14d46c6da125f840243ffd41a7d14c296f95..770b34dc47c69e81b781bdedd4ce68f83b575a17 100644 --- a/core/src/metrics/PrometheusMetrics.cpp +++ b/core/src/metrics/PrometheusMetrics.cpp @@ -222,10 +222,19 @@ PrometheusMetrics::CPUTemperature() { std::vector CPU_temperatures = server::SystemInfo::GetInstance().CPUTemperature(); + float avg_cpu_temp = 0; for (int i = 0; i < CPU_temperatures.size(); ++i) { - prometheus::Gauge& cpu_temp = CPU_temperature_.Add({{"CPU", std::to_string(i)}}); - cpu_temp.Set(CPU_temperatures[i]); + avg_cpu_temp += CPU_temperatures[i]; } + avg_cpu_temp /= CPU_temperatures.size(); + + prometheus::Gauge& cpu_temp = CPU_temperature_.Add({{"CPU", std::to_string(0)}}); + cpu_temp.Set(avg_cpu_temp); + + // for (int i = 0; i < CPU_temperatures.size(); ++i) { + // prometheus::Gauge& cpu_temp = CPU_temperature_.Add({{"CPU", std::to_string(i)}}); + // cpu_temp.Set(CPU_temperatures[i]); + // } } void diff --git a/core/src/scheduler/action/PushTaskToNeighbour.cpp b/core/src/scheduler/action/PushTaskToNeighbour.cpp index b42234d0f6f9f36f20c8eb29d0de39fa10f687b5..7fbcf77afc123a84f807f20d7f43a2e3ade58d3a 100644 --- a/core/src/scheduler/action/PushTaskToNeighbour.cpp +++ b/core/src/scheduler/action/PushTaskToNeighbour.cpp @@ -110,16 +110,18 @@ Action::DefaultLabelTaskScheduler(ResourceMgrWPtr res_mgr, ResourcePtr resource, bool moved = false; // to support test task, REFACTOR - if (auto index_engine = search_task->index_engine_) { - auto location = index_engine->GetLocation(); - - for (auto i = 0; i < res_mgr.lock()->GetNumGpuResource(); ++i) { - auto index = milvus::cache::GpuCacheMgr::GetInstance(i)->GetIndex(location); - if (index != nullptr) { - moved = true; - auto dest_resource = res_mgr.lock()->GetResource(ResourceType::GPU, i); - PushTaskToResource(event->task_table_item_->task, dest_resource); - break; + if (resource->type() == ResourceType::CPU) { + if (auto index_engine = search_task->index_engine_) { + auto location = index_engine->GetLocation(); + + for (auto i = 0; i < res_mgr.lock()->GetNumGpuResource(); ++i) { + auto index = milvus::cache::GpuCacheMgr::GetInstance(i)->GetIndex(location); + if (index != nullptr) { + moved = true; + auto dest_resource = res_mgr.lock()->GetResource(ResourceType::GPU, i); + PushTaskToResource(event->task_table_item_->task, dest_resource); + break; + } } } } diff --git a/core/src/scheduler/task/SearchTask.cpp b/core/src/scheduler/task/SearchTask.cpp index b5f1599eba269c0ed35b2330a3efc225293a9dc7..b7a1e211d2b1b23dee3f903e0e7e130de1e98efe 100644 --- a/core/src/scheduler/task/SearchTask.cpp +++ b/core/src/scheduler/task/SearchTask.cpp @@ -315,10 +315,10 @@ XSearchTask::MergeTopkArray(std::vector& tar_ids, std::vector& t return; } - std::vector id_buf(nq * topk, -1); - std::vector dist_buf(nq * topk, 0.0); - uint64_t output_k = std::min(topk, tar_input_k + src_input_k); + std::vector id_buf(nq * output_k, -1); + std::vector dist_buf(nq * output_k, 0.0); + uint64_t buf_k, src_k, tar_k; uint64_t src_idx, tar_idx, buf_idx; uint64_t src_input_k_multi_i, tar_input_k_multi_i, buf_k_multi_i; @@ -349,6 +349,7 @@ XSearchTask::MergeTopkArray(std::vector& tar_ids, std::vector& t if (src_k < src_input_k) { while (buf_k < output_k && src_k < src_input_k) { src_idx = src_input_k_multi_i + src_k; + buf_idx = buf_k_multi_i + buf_k; id_buf[buf_idx] = src_ids[src_idx]; dist_buf[buf_idx] = src_distance[src_idx]; src_k++; @@ -356,6 +357,8 @@ XSearchTask::MergeTopkArray(std::vector& tar_ids, std::vector& t } } else { while (buf_k < output_k && tar_k < tar_input_k) { + tar_idx = tar_input_k_multi_i + tar_k; + buf_idx = buf_k_multi_i + buf_k; id_buf[buf_idx] = tar_ids[tar_idx]; dist_buf[buf_idx] = tar_distance[tar_idx]; tar_k++; diff --git a/core/unittest/db/test_search.cpp b/core/unittest/db/test_search.cpp index b0ce9a28b6e407a74af198837d5597584c902ddc..dc393b7a26f1e9f233865c75702eab2b320e8038 100644 --- a/core/unittest/db/test_search.cpp +++ b/core/unittest/db/test_search.cpp @@ -110,87 +110,102 @@ CheckTopkResult(const std::vector& input_ids_1, } // namespace -TEST(DBSearchTest, TOPK_TEST) { - uint64_t NQ = 15; - uint64_t TOP_K = 64; - bool ascending; +void MergeTopkToResultSetTest(uint64_t topk_1, uint64_t topk_2, uint64_t nq, uint64_t topk, bool ascending) { std::vector ids1, ids2; std::vector dist1, dist2; ms::ResultSet result; + BuildResult(ids1, dist1, topk_1, nq, ascending); + BuildResult(ids2, dist2, topk_2, nq, ascending); + ms::XSearchTask::MergeTopkToResultSet(ids1, dist1, topk_1, nq, topk, ascending, result); + ms::XSearchTask::MergeTopkToResultSet(ids2, dist2, topk_2, nq, topk, ascending, result); + CheckTopkResult(ids1, dist1, ids2, dist2, topk, nq, ascending, result); +} + +TEST(DBSearchTest, MERGE_RESULT_SET_TEST) { + uint64_t NQ = 15; + uint64_t TOP_K = 64; /* test1, id1/dist1 valid, id2/dist2 empty */ - ascending = true; - BuildResult(ids1, dist1, TOP_K, NQ, ascending); - ms::XSearchTask::MergeTopkToResultSet(ids1, dist1, TOP_K, NQ, TOP_K, ascending, result); - CheckTopkResult(ids1, dist1, ids2, dist2, TOP_K, NQ, ascending, result); + MergeTopkToResultSetTest(TOP_K, 0, NQ, TOP_K, true); + MergeTopkToResultSetTest(TOP_K, 0, NQ, TOP_K, false); /* test2, id1/dist1 valid, id2/dist2 valid */ - BuildResult(ids2, dist2, TOP_K, NQ, ascending); - ms::XSearchTask::MergeTopkToResultSet(ids2, dist2, TOP_K, NQ, TOP_K, ascending, result); - CheckTopkResult(ids1, dist1, ids2, dist2, TOP_K, NQ, ascending, result); + MergeTopkToResultSetTest(TOP_K, TOP_K, NQ, TOP_K, true); + MergeTopkToResultSetTest(TOP_K, TOP_K, NQ, TOP_K, false); /* test3, id1/dist1 small topk */ - ids1.clear(); - dist1.clear(); - result.clear(); - BuildResult(ids1, dist1, TOP_K/2, NQ, ascending); - ms::XSearchTask::MergeTopkToResultSet(ids1, dist1, TOP_K/2, NQ, TOP_K, ascending, result); - ms::XSearchTask::MergeTopkToResultSet(ids2, dist2, TOP_K, NQ, TOP_K, ascending, result); - CheckTopkResult(ids1, dist1, ids2, dist2, TOP_K, NQ, ascending, result); + MergeTopkToResultSetTest(TOP_K/2, TOP_K, NQ, TOP_K, true); + MergeTopkToResultSetTest(TOP_K/2, TOP_K, NQ, TOP_K, false); /* test4, id1/dist1 small topk, id2/dist2 small topk */ - ids2.clear(); - dist2.clear(); - result.clear(); - BuildResult(ids2, dist2, TOP_K/3, NQ, ascending); - ms::XSearchTask::MergeTopkToResultSet(ids1, dist1, TOP_K/2, NQ, TOP_K, ascending, result); - ms::XSearchTask::MergeTopkToResultSet(ids2, dist2, TOP_K/3, NQ, TOP_K, ascending, result); - CheckTopkResult(ids1, dist1, ids2, dist2, TOP_K, NQ, ascending, result); - -///////////////////////////////////////////////////////////////////////////////////////// - ascending = false; - ids1.clear(); - dist1.clear(); - ids2.clear(); - dist2.clear(); - result.clear(); + MergeTopkToResultSetTest(TOP_K/2, TOP_K/3, NQ, TOP_K, true); + MergeTopkToResultSetTest(TOP_K/2, TOP_K/3, NQ, TOP_K, false); +} + +void MergeTopkArrayTest(uint64_t topk_1, uint64_t topk_2, uint64_t nq, uint64_t topk, bool ascending) { + std::vector ids1, ids2; + std::vector dist1, dist2; + ms::ResultSet result; + BuildResult(ids1, dist1, topk_1, nq, ascending); + BuildResult(ids2, dist2, topk_2, nq, ascending); + uint64_t result_topk = std::min(topk, topk_1 + topk_2); + ms::XSearchTask::MergeTopkArray(ids1, dist1, topk_1, ids2, dist2, topk_2, nq, topk, ascending); + if (ids1.size() != result_topk * nq) { + std::cout << ids1.size() << " " << result_topk * nq << std::endl; + } + ASSERT_TRUE(ids1.size() == result_topk * nq); + ASSERT_TRUE(dist1.size() == result_topk * nq); + for (uint64_t i = 0; i < nq; i++) { + for (uint64_t k = 1; k < result_topk; k++) { + if (ascending) { + if (dist1[i * result_topk + k] < dist1[i * result_topk + k - 1]) { + std::cout << dist1[i * result_topk + k - 1] << " " << dist1[i * result_topk + k] << std::endl; + } + ASSERT_TRUE(dist1[i * result_topk + k] >= dist1[i * result_topk + k - 1]); + } else { + if (dist1[i * result_topk + k] > dist1[i * result_topk + k - 1]) { + std::cout << dist1[i * result_topk + k - 1] << " " << dist1[i * result_topk + k] << std::endl; + } + ASSERT_TRUE(dist1[i * result_topk + k] <= dist1[i * result_topk + k - 1]); + } + } + } +} + +TEST(DBSearchTest, MERGE_ARRAY_TEST) { + uint64_t NQ = 15; + uint64_t TOP_K = 64; /* test1, id1/dist1 valid, id2/dist2 empty */ - BuildResult(ids1, dist1, TOP_K, NQ, ascending); - ms::XSearchTask::MergeTopkToResultSet(ids1, dist1, TOP_K, NQ, TOP_K, ascending, result); - CheckTopkResult(ids1, dist1, ids2, dist2, TOP_K, NQ, ascending, result); + MergeTopkArrayTest(TOP_K, 0, NQ, TOP_K, true); + MergeTopkArrayTest(TOP_K, 0, NQ, TOP_K, false); + MergeTopkArrayTest(0, TOP_K, NQ, TOP_K, true); + MergeTopkArrayTest(0, TOP_K, NQ, TOP_K, false); /* test2, id1/dist1 valid, id2/dist2 valid */ - BuildResult(ids2, dist2, TOP_K, NQ, ascending); - ms::XSearchTask::MergeTopkToResultSet(ids2, dist2, TOP_K, NQ, TOP_K, ascending, result); - CheckTopkResult(ids1, dist1, ids2, dist2, TOP_K, NQ, ascending, result); + MergeTopkArrayTest(TOP_K, TOP_K, NQ, TOP_K, true); + MergeTopkArrayTest(TOP_K, TOP_K, NQ, TOP_K, false); /* test3, id1/dist1 small topk */ - ids1.clear(); - dist1.clear(); - result.clear(); - BuildResult(ids1, dist1, TOP_K/2, NQ, ascending); - ms::XSearchTask::MergeTopkToResultSet(ids1, dist1, TOP_K/2, NQ, TOP_K, ascending, result); - ms::XSearchTask::MergeTopkToResultSet(ids2, dist2, TOP_K, NQ, TOP_K, ascending, result); - CheckTopkResult(ids1, dist1, ids2, dist2, TOP_K, NQ, ascending, result); + MergeTopkArrayTest(TOP_K/2, TOP_K, NQ, TOP_K, true); + MergeTopkArrayTest(TOP_K/2, TOP_K, NQ, TOP_K, false); + MergeTopkArrayTest(TOP_K, TOP_K/2, NQ, TOP_K, true); + MergeTopkArrayTest(TOP_K, TOP_K/2, NQ, TOP_K, false); /* test4, id1/dist1 small topk, id2/dist2 small topk */ - ids2.clear(); - dist2.clear(); - result.clear(); - BuildResult(ids2, dist2, TOP_K/3, NQ, ascending); - ms::XSearchTask::MergeTopkToResultSet(ids1, dist1, TOP_K/2, NQ, TOP_K, ascending, result); - ms::XSearchTask::MergeTopkToResultSet(ids2, dist2, TOP_K/3, NQ, TOP_K, ascending, result); - CheckTopkResult(ids1, dist1, ids2, dist2, TOP_K, NQ, ascending, result); + MergeTopkArrayTest(TOP_K/2, TOP_K/3, NQ, TOP_K, true); + MergeTopkArrayTest(TOP_K/2, TOP_K/3, NQ, TOP_K, false); + MergeTopkArrayTest(TOP_K/3, TOP_K/2, NQ, TOP_K, true); + MergeTopkArrayTest(TOP_K/3, TOP_K/2, NQ, TOP_K, false); } TEST(DBSearchTest, REDUCE_PERF_TEST) { int32_t index_file_num = 478; /* sift1B dataset, index files num */ bool ascending = true; - std::vector thread_vec = {4, 8, 11}; - std::vector nq_vec = {1, 10, 100, 1000}; - std::vector topk_vec = {1, 4, 16, 64, 256, 1024}; + std::vector thread_vec = {4, 8}; + std::vector nq_vec = {1, 10, 100}; + std::vector topk_vec = {1, 4, 16, 64}; int32_t NQ = nq_vec[nq_vec.size()-1]; int32_t TOPK = topk_vec[topk_vec.size()-1];