mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
Merge branch 'branch-0.4.0' into 'branch-0.4.0'
MS-355 Add copy interface in ExcutionEngine See merge request megasearch/milvus!363 Former-commit-id: 4f19f0cdd109e74fdec0d9d5b992a6b7c384b8d7
This commit is contained in:
commit
d5b6eceb66
@ -15,6 +15,7 @@ Please mark all change in change log and use the ticket from JIRA.
|
||||
- MS-348 - Add ResourceFactory Test
|
||||
- MS-350 - Remove knowhere submodule
|
||||
- MS-354 - Add task class and interface in scheduler
|
||||
- MS-355 - Add copy interface in ExcutionEngine
|
||||
|
||||
## New Feature
|
||||
- MS-343 - Implement ResourceMgr
|
||||
|
||||
@ -42,6 +42,10 @@ public:
|
||||
|
||||
virtual Status Load(bool to_cache = true) = 0;
|
||||
|
||||
virtual Status CopyToGpu(uint64_t device_id) = 0;
|
||||
|
||||
virtual Status CopyToCpu() = 0;
|
||||
|
||||
virtual Status Merge(const std::string& location) = 0;
|
||||
|
||||
virtual Status Search(long n,
|
||||
|
||||
@ -143,6 +143,32 @@ Status ExecutionEngineImpl::Load(bool to_cache) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status ExecutionEngineImpl::CopyToGpu(uint64_t device_id) {
|
||||
try {
|
||||
index_ = index_->CopyToGpu(device_id);
|
||||
ENGINE_LOG_DEBUG << "CPU to GPU" << device_id;
|
||||
} catch (knowhere::KnowhereException &e) {
|
||||
ENGINE_LOG_ERROR << e.what();
|
||||
return Status::Error(e.what());
|
||||
} catch (std::exception &e) {
|
||||
return Status::Error(e.what());
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status ExecutionEngineImpl::CopyToCpu() {
|
||||
try {
|
||||
index_ = index_->CopyToCpu();
|
||||
ENGINE_LOG_DEBUG << "GPU to CPU";
|
||||
} catch (knowhere::KnowhereException &e) {
|
||||
ENGINE_LOG_ERROR << e.what();
|
||||
return Status::Error(e.what());
|
||||
} catch (std::exception &e) {
|
||||
return Status::Error(e.what());
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status ExecutionEngineImpl::Merge(const std::string &location) {
|
||||
if (location == location_) {
|
||||
return Status::Error("Cannot Merge Self");
|
||||
|
||||
@ -18,7 +18,7 @@ namespace engine {
|
||||
|
||||
|
||||
class ExecutionEngineImpl : public ExecutionEngine {
|
||||
public:
|
||||
public:
|
||||
|
||||
ExecutionEngineImpl(uint16_t dimension,
|
||||
const std::string &location,
|
||||
@ -42,6 +42,10 @@ class ExecutionEngineImpl : public ExecutionEngine {
|
||||
|
||||
Status Load(bool to_cache) override;
|
||||
|
||||
Status CopyToGpu(uint64_t device_id) override;
|
||||
|
||||
Status CopyToCpu() override;
|
||||
|
||||
Status Merge(const std::string &location) override;
|
||||
|
||||
Status Search(long n,
|
||||
@ -56,12 +60,12 @@ class ExecutionEngineImpl : public ExecutionEngine {
|
||||
|
||||
Status Init() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
VecIndexPtr CreatetVecIndex(EngineType type);
|
||||
|
||||
VecIndexPtr Load(const std::string &location);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
VecIndexPtr index_ = nullptr;
|
||||
EngineType build_type;
|
||||
EngineType current_type;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user