Commit 360655d9 authored by 余昆's avatar 余昆
Browse files

Add ToIndexData for CopyToIndexFileToGpu


Former-commit-id: 7e799f058b2bbd4bd4bbc897a2b6c2479391112a
parent 6fa33108
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -243,12 +243,9 @@ ExecutionEngineImpl::CopyToGpu(uint64_t device_id) {

Status
ExecutionEngineImpl::CopyToIndexFileToGpu(uint64_t device_id) {
    auto index = cache::GpuCacheMgr::GetInstance(device_id)->GetIndex(location_);
    bool already_in_cache = (index != nullptr);
    if (!already_in_cache) {
        cache::DataObjPtr obj = std::make_shared<cache::DataObj>(nullptr, PhysicalSize());
    auto to_index_data = std::make_shared<ToIndexData>(PhysicalSize());
    cache::DataObjPtr obj = std::static_pointer_cast<cache::DataObj>(to_index_data);
    milvus::cache::GpuCacheMgr::GetInstance(device_id)->InsertItem(location_, obj);
    }
    return Status::OK();
}

+11 −0
Original line number Diff line number Diff line
@@ -111,5 +111,16 @@ class BFIndex : public VecIndexImpl {
    GetRawIds();
};

class ToIndexData : public cache::DataObj {
 public:
    ToIndexData(int64_t size) : size_(size) {}

    int64_t
    Size() override {return size_;}

 private:
    int64_t size_;
};

}  // namespace engine
}  // namespace milvus