未验证 提交 ba8c5979 编写于 作者: J Jin Hai 提交者: GitHub

Merge pull request #572 from Yukikaze-CZR/0.6.0

#504 The code coverage rate of core/src/scheduler/optimizer is too low
......@@ -22,6 +22,7 @@ Please mark all change in change log and use the ticket from JIRA.
- \#458 - Index data is not compatible between 0.5 and 0.6
- \#465 - Server hang caused by searching with nsg index
- \#486 - gpu no usage during index building
- \#504 - The code coverage rate of core/src/scheduler/optimizer is too low
- \#509 - IVF_PQ index build trapped into dead loop caused by invalid params
- \#513 - Unittest DELETE_BY_RANGE sometimes failed
- \#523 - Erase file data from cache once the file is marked as deleted
......
......@@ -77,8 +77,8 @@ class ExecutionEngine {
virtual Status
CopyToCpu() = 0;
virtual std::shared_ptr<ExecutionEngine>
Clone() = 0;
// virtual std::shared_ptr<ExecutionEngine>
// Clone() = 0;
virtual Status
Merge(const std::string& location) = 0;
......
......@@ -415,18 +415,18 @@ ExecutionEngineImpl::CopyToCpu() {
return Status::OK();
}
ExecutionEnginePtr
ExecutionEngineImpl::Clone() {
if (index_ == nullptr) {
ENGINE_LOG_ERROR << "ExecutionEngineImpl: index is null, failed to clone";
return nullptr;
}
auto ret = std::make_shared<ExecutionEngineImpl>(dim_, location_, index_type_, metric_type_, nlist_);
ret->Init();
ret->index_ = index_->Clone();
return ret;
}
// ExecutionEnginePtr
// ExecutionEngineImpl::Clone() {
// if (index_ == nullptr) {
// ENGINE_LOG_ERROR << "ExecutionEngineImpl: index is null, failed to clone";
// return nullptr;
// }
//
// auto ret = std::make_shared<ExecutionEngineImpl>(dim_, location_, index_type_, metric_type_, nlist_);
// ret->Init();
// ret->index_ = index_->Clone();
// return ret;
//}
Status
ExecutionEngineImpl::Merge(const std::string& location) {
......
......@@ -64,8 +64,8 @@ class ExecutionEngineImpl : public ExecutionEngine {
Status
CopyToCpu() override;
ExecutionEnginePtr
Clone() override;
// ExecutionEnginePtr
// Clone() override;
Status
Merge(const std::string& location) override;
......
......@@ -47,16 +47,16 @@ GPUIDMAP::CopyGpuToCpu(const Config& config) {
return std::make_shared<IDMAP>(new_index);
}
VectorIndexPtr
GPUIDMAP::Clone() {
auto cpu_idx = CopyGpuToCpu(Config());
if (auto idmap = std::dynamic_pointer_cast<IDMAP>(cpu_idx)) {
return idmap->CopyCpuToGpu(gpu_id_, Config());
} else {
KNOWHERE_THROW_MSG("IndexType not Support GpuClone");
}
}
// VectorIndexPtr
// GPUIDMAP::Clone() {
// auto cpu_idx = CopyGpuToCpu(Config());
//
// if (auto idmap = std::dynamic_pointer_cast<IDMAP>(cpu_idx)) {
// return idmap->CopyCpuToGpu(gpu_id_, Config());
// } else {
// KNOWHERE_THROW_MSG("IndexType not Support GpuClone");
// }
//}
BinarySet
GPUIDMAP::SerializeImpl() {
......
......@@ -41,8 +41,8 @@ class GPUIDMAP : public IDMAP, public GPUIndex {
int64_t*
GetRawIds() override;
VectorIndexPtr
Clone() override;
// VectorIndexPtr
// Clone() override;
VectorIndexPtr
CopyGpuToGpu(const int64_t& device_id, const Config& config) override;
......
......@@ -158,11 +158,11 @@ GPUIVF::CopyGpuToCpu(const Config& config) {
}
}
VectorIndexPtr
GPUIVF::Clone() {
auto cpu_idx = CopyGpuToCpu(Config());
return knowhere::cloner::CopyCpuToGpu(cpu_idx, gpu_id_, Config());
}
// VectorIndexPtr
// GPUIVF::Clone() {
// auto cpu_idx = CopyGpuToCpu(Config());
// return knowhere::cloner::CopyCpuToGpu(cpu_idx, gpu_id_, Config());
//}
VectorIndexPtr
GPUIVF::CopyGpuToGpu(const int64_t& device_id, const Config& config) {
......
......@@ -75,8 +75,8 @@ class GPUIVF : public IVF, public GPUIndex {
VectorIndexPtr
CopyGpuToGpu(const int64_t& device_id, const Config& config) override;
VectorIndexPtr
Clone() final;
// VectorIndexPtr
// Clone() final;
protected:
void
......
......@@ -164,15 +164,15 @@ IDMAP::Train(const Config& config) {
index_.reset(index);
}
VectorIndexPtr
IDMAP::Clone() {
std::lock_guard<std::mutex> lk(mutex_);
auto clone_index = faiss::clone_index(index_.get());
std::shared_ptr<faiss::Index> new_index;
new_index.reset(clone_index);
return std::make_shared<IDMAP>(new_index);
}
// VectorIndexPtr
// IDMAP::Clone() {
// std::lock_guard<std::mutex> lk(mutex_);
//
// auto clone_index = faiss::clone_index(index_.get());
// std::shared_ptr<faiss::Index> new_index;
// new_index.reset(clone_index);
// return std::make_shared<IDMAP>(new_index);
//}
VectorIndexPtr
IDMAP::CopyCpuToGpu(const int64_t& device_id, const Config& config) {
......
......@@ -42,8 +42,8 @@ class IDMAP : public VectorIndex, public FaissBaseIndex {
Search(const DatasetPtr& dataset, const Config& config) override;
int64_t
Count() override;
VectorIndexPtr
Clone() override;
// VectorIndexPtr
// Clone() override;
int64_t
Dimension() override;
void
......
......@@ -257,20 +257,20 @@ IVF::CopyCpuToGpu(const int64_t& device_id, const Config& config) {
#endif
}
VectorIndexPtr
IVF::Clone() {
std::lock_guard<std::mutex> lk(mutex_);
auto clone_index = faiss::clone_index(index_.get());
std::shared_ptr<faiss::Index> new_index;
new_index.reset(clone_index);
return Clone_impl(new_index);
}
VectorIndexPtr
IVF::Clone_impl(const std::shared_ptr<faiss::Index>& index) {
return std::make_shared<IVF>(index);
}
// VectorIndexPtr
// IVF::Clone() {
// std::lock_guard<std::mutex> lk(mutex_);
//
// auto clone_index = faiss::clone_index(index_.get());
// std::shared_ptr<faiss::Index> new_index;
// new_index.reset(clone_index);
// return Clone_impl(new_index);
//}
//
// VectorIndexPtr
// IVF::Clone_impl(const std::shared_ptr<faiss::Index>& index) {
// return std::make_shared<IVF>(index);
//}
void
IVF::Seal() {
......
......@@ -38,8 +38,8 @@ class IVF : public VectorIndex, public FaissBaseIndex {
explicit IVF(std::shared_ptr<faiss::Index> index) : FaissBaseIndex(std::move(index)) {
}
VectorIndexPtr
Clone() override;
// VectorIndexPtr
// Clone() override;
IndexModelPtr
Train(const DatasetPtr& dataset, const Config& config) override;
......@@ -81,8 +81,8 @@ class IVF : public VectorIndex, public FaissBaseIndex {
virtual std::shared_ptr<faiss::IVFSearchParameters>
GenParams(const Config& config);
virtual VectorIndexPtr
Clone_impl(const std::shared_ptr<faiss::Index>& index);
// virtual VectorIndexPtr
// Clone_impl(const std::shared_ptr<faiss::Index>& index);
virtual void
search_impl(int64_t n, const float* data, int64_t k, float* distances, int64_t* labels, const Config& cfg);
......
......@@ -63,10 +63,10 @@ IVFPQ::GenParams(const Config& config) {
return params;
}
VectorIndexPtr
IVFPQ::Clone_impl(const std::shared_ptr<faiss::Index>& index) {
return std::make_shared<IVFPQ>(index);
}
// VectorIndexPtr
// IVFPQ::Clone_impl(const std::shared_ptr<faiss::Index>& index) {
// return std::make_shared<IVFPQ>(index);
//}
VectorIndexPtr
IVFPQ::CopyCpuToGpu(const int64_t& device_id, const Config& config) {
......
......@@ -41,8 +41,8 @@ class IVFPQ : public IVF {
std::shared_ptr<faiss::IVFSearchParameters>
GenParams(const Config& config) override;
VectorIndexPtr
Clone_impl(const std::shared_ptr<faiss::Index>& index) override;
// VectorIndexPtr
// Clone_impl(const std::shared_ptr<faiss::Index>& index) override;
};
} // namespace knowhere
......@@ -54,10 +54,10 @@ IVFSQ::Train(const DatasetPtr& dataset, const Config& config) {
return std::make_shared<IVFIndexModel>(ret_index);
}
VectorIndexPtr
IVFSQ::Clone_impl(const std::shared_ptr<faiss::Index>& index) {
return std::make_shared<IVFSQ>(index);
}
// VectorIndexPtr
// IVFSQ::Clone_impl(const std::shared_ptr<faiss::Index>& index) {
// return std::make_shared<IVFSQ>(index);
//}
VectorIndexPtr
IVFSQ::CopyCpuToGpu(const int64_t& device_id, const Config& config) {
......
......@@ -38,8 +38,8 @@ class IVFSQ : public IVF {
CopyCpuToGpu(const int64_t& device_id, const Config& config) override;
protected:
VectorIndexPtr
Clone_impl(const std::shared_ptr<faiss::Index>& index) override;
// VectorIndexPtr
// Clone_impl(const std::shared_ptr<faiss::Index>& index) override;
};
} // namespace knowhere
......@@ -158,10 +158,10 @@ NSG::Dimension() {
return index_->dimension;
}
VectorIndexPtr
NSG::Clone() {
KNOWHERE_THROW_MSG("not support");
}
// VectorIndexPtr
// NSG::Clone() {
// KNOWHERE_THROW_MSG("not support");
//}
void
NSG::Seal() {
......
......@@ -49,8 +49,8 @@ class NSG : public VectorIndex {
Count() override;
int64_t
Dimension() override;
VectorIndexPtr
Clone() override;
// VectorIndexPtr
// Clone() override;
void
Seal() override;
......
......@@ -210,6 +210,9 @@ CPUSPTAGRNG::Load(const BinarySet& binary_set) {
IndexModelPtr
CPUSPTAGRNG::Train(const DatasetPtr& origin, const Config& train_config) {
SetParameters(train_config);
if (train_config != nullptr) {
train_config->CheckValid(); // throw exception
}
DatasetPtr dataset = origin->Clone();
// if (index_ptr_->GetDistCalcMethod() == SPTAG::DistCalcMethod::Cosine
......@@ -295,6 +298,9 @@ CPUSPTAGRNG::SetParameters(const Config& config) {
DatasetPtr
CPUSPTAGRNG::Search(const DatasetPtr& dataset, const Config& config) {
SetParameters(config);
if (config != nullptr) {
config->CheckValid(); // throw exception
}
auto tensor = dataset->tensor()[0];
auto p = (float*)tensor->raw_mutable_data();
for (auto i = 0; i < 10; ++i) {
......@@ -325,10 +331,10 @@ CPUSPTAGRNG::Dimension() {
return index_ptr_->GetFeatureDim();
}
VectorIndexPtr
CPUSPTAGRNG::Clone() {
KNOWHERE_THROW_MSG("not support");
}
// VectorIndexPtr
// CPUSPTAGRNG::Clone() {
// KNOWHERE_THROW_MSG("not support");
//}
void
CPUSPTAGRNG::Seal() {
......
......@@ -36,8 +36,8 @@ class CPUSPTAGRNG : public VectorIndex {
BinarySet
Serialize() override;
VectorIndexPtr
Clone() override;
// VectorIndexPtr
// Clone() override;
void
Load(const BinarySet& index_array) override;
......
......@@ -49,8 +49,8 @@ class VectorIndex : public Index {
Seal() = 0;
// TODO(linxj): Deprecated
virtual VectorIndexPtr
Clone() = 0;
// virtual VectorIndexPtr
// Clone() = 0;
virtual int64_t
Count() = 0;
......
......@@ -180,10 +180,10 @@ struct SPTAGCfg : public Cfg {
SPTAGCfg() = default;
bool
CheckValid() override {
return true;
};
// bool
// CheckValid() override {
// return true;
// };
};
using SPTAGConfig = std::shared_ptr<SPTAGCfg>;
......
......@@ -139,9 +139,9 @@ TEST_F(IDMAPTest, copy_test) {
{
// clone
auto clone_index = index_->Clone();
auto clone_result = clone_index->Search(query_dataset, conf);
AssertAnns(clone_result, nq, k);
// auto clone_index = index_->Clone();
// auto clone_result = clone_index->Search(query_dataset, conf);
// AssertAnns(clone_result, nq, k);
}
{
......@@ -159,9 +159,9 @@ TEST_F(IDMAPTest, copy_test) {
auto new_result = clone_index->Search(query_dataset, conf);
AssertAnns(new_result, nq, k);
auto clone_gpu_idx = clone_index->Clone();
auto clone_gpu_res = clone_gpu_idx->Search(query_dataset, conf);
AssertAnns(clone_gpu_res, nq, k);
// auto clone_gpu_idx = clone_index->Clone();
// auto clone_gpu_res = clone_gpu_idx->Search(query_dataset, conf);
// AssertAnns(clone_gpu_res, nq, k);
// gpu to cpu
auto host_index = knowhere::cloner::CopyGpuToCpu(clone_index, conf);
......
......@@ -62,6 +62,7 @@ class IVFTest : public DataGen, public TestWithParam<::std::tuple<std::string, P
Generate(DIM, NB, NQ);
index_ = IndexFactory(index_type);
conf = ParamGenerator::GetInstance().Gen(parameter_type);
conf->Dump();
}
void
......
......@@ -57,11 +57,13 @@ class NSGInterfaceTest : public DataGen, public ::testing::Test {
tmp_conf->candidate_pool_size = 100;
tmp_conf->metric_type = knowhere::METRICTYPE::L2;
train_conf = tmp_conf;
train_conf->Dump();
auto tmp2_conf = std::make_shared<knowhere::NSGCfg>();
tmp2_conf->k = k;
tmp2_conf->search_length = 30;
search_conf = tmp2_conf;
search_conf->Dump();
}
void
......@@ -92,7 +94,7 @@ TEST_F(NSGInterfaceTest, basic_test) {
ASSERT_EQ(index_->Count(), nb);
ASSERT_EQ(index_->Dimension(), dim);
ASSERT_THROW({ index_->Clone(); }, knowhere::KnowhereException);
// ASSERT_THROW({ index_->Clone(); }, knowhere::KnowhereException);
ASSERT_NO_THROW({
index_->Add(base_dataset, knowhere::Config());
index_->Seal();
......
......@@ -19,19 +19,17 @@
#include "scheduler/SchedInst.h"
#include "scheduler/Utils.h"
#include "scheduler/tasklabel/SpecResLabel.h"
#ifdef MILVUS_GPU_VERSION
namespace milvus {
namespace scheduler {
void
BuildIndexPass::Init() {
#ifdef MILVUS_GPU_VERSION
server::Config& config = server::Config::GetInstance();
Status s = config.GetGpuResourceConfigBuildIndexResources(build_gpu_ids_);
if (!s.ok()) {
throw;
}
#endif
}
bool
......@@ -56,3 +54,4 @@ BuildIndexPass::Run(const TaskPtr& task) {
} // namespace scheduler
} // namespace milvus
#endif
......@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifdef MILVUS_GPU_VERSION
#pragma once
#include <condition_variable>
......@@ -52,3 +53,4 @@ using BuildIndexPassPtr = std::shared_ptr<BuildIndexPass>;
} // namespace scheduler
} // namespace milvus
#endif
......@@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifdef MILVUS_GPU_VERSION
#include "scheduler/optimizer/FaissFlatPass.h"
#include "cache/GpuCacheMgr.h"
#include "scheduler/SchedInst.h"
......@@ -29,7 +29,6 @@ namespace scheduler {
void
FaissFlatPass::Init() {
#ifdef MILVUS_GPU_VERSION
server::Config& config = server::Config::GetInstance();
Status s = config.GetEngineConfigGpuSearchThreshold(threshold_);
if (!s.ok()) {
......@@ -39,7 +38,6 @@ FaissFlatPass::Init() {
if (!s.ok()) {
throw;
}
#endif
}
bool
......@@ -71,3 +69,4 @@ FaissFlatPass::Run(const TaskPtr& task) {
} // namespace scheduler
} // namespace milvus
#endif
......@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifdef MILVUS_GPU_VERSION
#pragma once
#include <condition_variable>
......@@ -54,3 +55,4 @@ using FaissFlatPassPtr = std::shared_ptr<FaissFlatPass>;
} // namespace scheduler
} // namespace milvus
#endif
......@@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifdef MILVUS_GPU_VERSION
#include "scheduler/optimizer/FaissIVFFlatPass.h"
#include "cache/GpuCacheMgr.h"
#include "scheduler/SchedInst.h"
......@@ -72,3 +72,4 @@ FaissIVFFlatPass::Run(const TaskPtr& task) {
} // namespace scheduler
} // namespace milvus
#endif
......@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifdef MILVUS_GPU_VERSION
#pragma once
#include <condition_variable>
......@@ -54,3 +55,4 @@ using FaissIVFFlatPassPtr = std::shared_ptr<FaissIVFFlatPass>;
} // namespace scheduler
} // namespace milvus
#endif
......@@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifdef MILVUS_GPU_VERSION
#include "scheduler/optimizer/FaissIVFSQ8HPass.h"
#include "cache/GpuCacheMgr.h"
#include "scheduler/SchedInst.h"
......@@ -29,7 +29,7 @@ namespace scheduler {
void
FaissIVFSQ8HPass::Init() {
#ifdef MILVUS_GPU_VERSION
#ifdef CUSTOMIZATION
server::Config& config = server::Config::GetInstance();
Status s = config.GetEngineConfigGpuSearchThreshold(threshold_);
if (!s.ok()) {
......@@ -41,6 +41,7 @@ FaissIVFSQ8HPass::Init() {
bool
FaissIVFSQ8HPass::Run(const TaskPtr& task) {
#ifdef CUSTOMIZATION
if (task->Type() != TaskType::SearchTask) {
return false;
}
......@@ -65,7 +66,9 @@ FaissIVFSQ8HPass::Run(const TaskPtr& task) {
auto label = std::make_shared<SpecResLabel>(res_ptr);
task->label() = label;
return true;
#endif
}
} // namespace scheduler
} // namespace milvus
#endif
......@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifdef MILVUS_GPU_VERSION
#pragma once
#include <condition_variable>
......@@ -54,3 +55,4 @@ using FaissIVFSQ8HPassPtr = std::shared_ptr<FaissIVFSQ8HPass>;
} // namespace scheduler
} // namespace milvus
#endif
......@@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifdef MILVUS_GPU_VERSION
#include "scheduler/optimizer/FaissIVFSQ8Pass.h"
#include "cache/GpuCacheMgr.h"
#include "scheduler/SchedInst.h"
......@@ -72,3 +72,4 @@ FaissIVFSQ8Pass::Run(const TaskPtr& task) {
} // namespace scheduler
} // namespace milvus
#endif
......@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifdef MILVUS_GPU_VERSION
#pragma once
#include <condition_variable>
......@@ -54,3 +55,4 @@ using FaissIVFSQ8PassPtr = std::shared_ptr<FaissIVFSQ8Pass>;
} // namespace scheduler
} // namespace milvus
#endif
......@@ -180,13 +180,13 @@ VecIndexImpl::CopyToCpu(const Config& cfg) {
#endif
}
VecIndexPtr
VecIndexImpl::Clone() {
// TODO(linxj): exception handle
auto clone_index = std::make_shared<VecIndexImpl>(index_->Clone(), type);
clone_index->dim = dim;
return clone_index;
}
// VecIndexPtr
// VecIndexImpl::Clone() {
// // TODO(linxj): exception handle
// auto clone_index = std::make_shared<VecIndexImpl>(index_->Clone(), type);
// clone_index->dim = dim;
// return clone_index;
//}
int64_t
VecIndexImpl::GetDeviceId() {
......
......@@ -60,8 +60,8 @@ class VecIndexImpl : public VecIndex {
Status
Load(const knowhere::BinarySet& index_binary) override;
VecIndexPtr
Clone() override;
// VecIndexPtr
// Clone() override;
int64_t
GetDeviceId() override;
......
......@@ -75,8 +75,8 @@ class VecIndex : public cache::DataObj {
CopyToCpu(const Config& cfg = Config()) = 0;
// TODO(linxj): Deprecated
virtual VecIndexPtr
Clone() = 0;
// virtual VecIndexPtr
// Clone() = 0;
virtual int64_t
GetDeviceId() = 0;
......
......@@ -229,6 +229,7 @@ TEST_F(DBTest, DB_TEST) {
}
TEST_F(DBTest, SEARCH_TEST) {
milvus::scheduler::OptimizerInst::GetInstance()->Init();
std::string config_path(CONFIG_PATH);
config_path += CONFIG_FILE;
milvus::server::Config& config = milvus::server::Config::GetInstance();
......@@ -290,8 +291,51 @@ TEST_F(DBTest, SEARCH_TEST) {
milvus::engine::ResultDistances result_distances;
stat = db_->Query(TABLE_NAME, tags, k, nq, 10, xq.data(), result_ids, result_distances);
ASSERT_TRUE(stat.ok());
stat = db_->Query(TABLE_NAME, tags, k, 1100, 10, xq.data(), result_ids, result_distances);
ASSERT_TRUE(stat.ok());
}
index.engine_type_ = (int)milvus::engine::EngineType::FAISS_IVFFLAT;
db_->CreateIndex(TABLE_NAME, index); // wait until build index finish
{
std::vector<std::string> tags;
milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances;
stat = db_->Query(TABLE_NAME, tags, k, nq, 10, xq.data(), result_ids, result_distances);
ASSERT_TRUE(stat.ok());
stat = db_->Query(TABLE_NAME, tags, k, 1100, 10, xq.data(), result_ids, result_distances);
ASSERT_TRUE(stat.ok());
}
index.engine_type_ = (int)milvus::engine::EngineType::FAISS_IVFSQ8;
db_->CreateIndex(TABLE_NAME, index); // wait until build index finish
{
std::vector<std::string> tags;
milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances;
stat = db_->Query(TABLE_NAME, tags, k, nq, 10, xq.data(), result_ids, result_distances);
ASSERT_TRUE(stat.ok());
stat = db_->Query(TABLE_NAME, tags, k, 1100, 10, xq.data(), result_ids, result_distances);
ASSERT_TRUE(stat.ok());
}
#ifdef CUSTOMIZATION
index.engine_type_ = (int)milvus::engine::EngineType::FAISS_IVFSQ8H;
db_->CreateIndex(TABLE_NAME, index); // wait until build index finish
{
std::vector<std::string> tags;
milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances;
stat = db_->Query(TABLE_NAME, tags, k, nq, 10, xq.data(), result_ids, result_distances);
ASSERT_TRUE(stat.ok());
stat = db_->Query(TABLE_NAME, tags, k, 1100, 10, xq.data(), result_ids, result_distances);
ASSERT_TRUE(stat.ok());
}
#endif
{ // search by specify index file
milvus::engine::meta::DatesT dates;
std::vector<std::string> file_ids = {"1", "2", "3", "4", "5", "6"};
......
......@@ -88,12 +88,12 @@ TEST_F(EngineTest, ENGINE_IMPL_TEST) {
status = engine_ptr->CopyToGpu(0, false);
// ASSERT_TRUE(status.ok());
auto new_engine = engine_ptr->Clone();
ASSERT_EQ(new_engine->Dimension(), dimension);
ASSERT_EQ(new_engine->Count(), ids.size());
status = new_engine->CopyToCpu();
// auto new_engine = engine_ptr->Clone();
// ASSERT_EQ(new_engine->Dimension(), dimension);
// ASSERT_EQ(new_engine->Count(), ids.size());
status = engine_ptr->CopyToCpu();
// ASSERT_TRUE(status.ok());
auto engine_build = new_engine->BuildIndex("/tmp/milvus_index_2", milvus::engine::EngineType::FAISS_IVFSQ8);
auto engine_build = engine_ptr->BuildIndex("/tmp/milvus_index_2", milvus::engine::EngineType::FAISS_IVFSQ8);
// ASSERT_TRUE(status.ok());
}
......@@ -37,10 +37,10 @@ class MockVecIndex : public engine::VecIndex {
const float* xt = nullptr) {
}
engine::VecIndexPtr
Clone() override {
return milvus::engine::VecIndexPtr();
}
// engine::VecIndexPtr
// Clone() override {
// return milvus::engine::VecIndexPtr();
// }
int64_t
GetDeviceId() override {
......
......@@ -47,10 +47,10 @@ class MockVecIndex : public milvus::engine::VecIndex {
return milvus::Status();
}
milvus::engine::VecIndexPtr
Clone() override {
return milvus::engine::VecIndexPtr();
}
// milvus::engine::VecIndexPtr
// Clone() override {
// return milvus::engine::VecIndexPtr();
// }
int64_t
GetDeviceId() override {
......@@ -120,7 +120,7 @@ TEST(CacheTest, DUMMY_TEST) {
mock_index.Add(1, nullptr, nullptr);
mock_index.BuildAll(1, nullptr, nullptr, cfg);
mock_index.Search(1, nullptr, nullptr, nullptr, cfg);
mock_index.Clone();
// mock_index.Clone();
mock_index.CopyToCpu(cfg);
mock_index.CopyToGpu(1, cfg);
mock_index.GetDeviceId();
......
......@@ -181,12 +181,22 @@ TEST_P(KnowhereWrapperTest, SERIALIZE_TEST) {
TEST(whatever, test_config) {
milvus::engine::TempMetaConf conf;
conf.nprobe = 16;
auto nsg_conf = std::make_shared<milvus::engine::NSGConfAdapter>();
nsg_conf->Match(conf);
nsg_conf->MatchSearch(conf, milvus::engine::IndexType::FAISS_IVFPQ_GPU);
nsg_conf->MatchSearch(conf, milvus::engine::IndexType::NSG_MIX);
auto pq_conf = std::make_shared<milvus::engine::IVFPQConfAdapter>();
pq_conf->Match(conf);
pq_conf->MatchSearch(conf, milvus::engine::IndexType::FAISS_IVFPQ_MIX);
auto kdt_conf = std::make_shared<milvus::engine::SPTAGKDTConfAdapter>();
kdt_conf->Match(conf);
kdt_conf->MatchSearch(conf, milvus::engine::IndexType::SPTAG_KDT_RNT_CPU);
auto bkt_conf = std::make_shared<milvus::engine::SPTAGBKTConfAdapter>();
bkt_conf->Match(conf);
bkt_conf->MatchSearch(conf, milvus::engine::IndexType::SPTAG_BKT_RNT_CPU);
}
// #include "knowhere/index/vector_index/IndexIDMAP.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册