diff --git a/core/src/cache/CacheMgr.h b/core/src/cache/CacheMgr.h index c7ab9e26ab..114b089c8f 100644 --- a/core/src/cache/CacheMgr.h +++ b/core/src/cache/CacheMgr.h @@ -57,12 +57,6 @@ class CacheMgr { void SetCapacity(int64_t capacity); - void - Lock(); - - void - Unlock(); - protected: CacheMgr(); @@ -70,7 +64,6 @@ class CacheMgr { protected: std::shared_ptr> cache_; - std::mutex mutex_; }; } // namespace cache diff --git a/core/src/cache/CacheMgr.inl b/core/src/cache/CacheMgr.inl index 606510c66c..b45b403595 100644 --- a/core/src/cache/CacheMgr.inl +++ b/core/src/cache/CacheMgr.inl @@ -133,17 +133,5 @@ CacheMgr::SetCapacity(int64_t capacity) { cache_->set_capacity(capacity); } -template -void -CacheMgr::Lock() { - mutex_.lock(); -} - -template -void -CacheMgr::Unlock() { - mutex_.unlock(); -} - } // namespace cache } // namespace milvus diff --git a/core/src/cache/GpuCacheMgr.cpp b/core/src/cache/GpuCacheMgr.cpp index 30e4ec4c5a..b371f8f57a 100644 --- a/core/src/cache/GpuCacheMgr.cpp +++ b/core/src/cache/GpuCacheMgr.cpp @@ -84,9 +84,7 @@ GpuCacheMgr::GetInstance(int64_t gpu_id) { void GpuCacheMgr::OnGpuCacheCapacityChanged(int64_t capacity) { for (auto& iter : instance_) { - iter.second->Lock(); iter.second->SetCapacity(capacity * G_BYTE); - iter.second->Unlock(); } } diff --git a/core/src/db/engine/ExecutionEngineImpl.cpp b/core/src/db/engine/ExecutionEngineImpl.cpp index e367a35907..8be6ec8898 100644 --- a/core/src/db/engine/ExecutionEngineImpl.cpp +++ b/core/src/db/engine/ExecutionEngineImpl.cpp @@ -555,11 +555,9 @@ ExecutionEngineImpl::CopyToGpu(uint64_t device_id, bool hybrid) { */ ENGINE_LOG_DEBUG << "CPU to GPU" << device_id << " start"; auto gpu_cache_mgr = cache::GpuCacheMgr::GetInstance(device_id); - // gpu_cache_mgr->Lock(); // gpu_cache_mgr->Reserve(index_->Size()); index_ = knowhere::cloner::CopyCpuToGpu(index_, device_id, knowhere::Config()); // gpu_cache_mgr->InsertItem(location_, std::static_pointer_cast(index_)); - // gpu_cache_mgr->Unlock(); ENGINE_LOG_DEBUG << "CPU to GPU" << device_id << " finished"; } catch (std::exception& e) { ENGINE_LOG_ERROR << e.what(); @@ -577,10 +575,8 @@ ExecutionEngineImpl::CopyToIndexFileToGpu(uint64_t device_id) { // the ToIndexData is only a placeholder, cpu-copy-to-gpu action is performed in if (index_) { auto gpu_cache_mgr = milvus::cache::GpuCacheMgr::GetInstance(device_id); - gpu_cache_mgr->Lock(); gpu_num_ = device_id; gpu_cache_mgr->Reserve(index_->Size()); - gpu_cache_mgr->Unlock(); } #endif return Status::OK(); @@ -964,10 +960,8 @@ ExecutionEngineImpl::GetVectorByID(const int64_t& id, uint8_t* vector, bool hybr Status ExecutionEngineImpl::Cache() { auto cpu_cache_mgr = milvus::cache::CpuCacheMgr::GetInstance(); - cpu_cache_mgr->Lock(); cache::DataObjPtr obj = std::static_pointer_cast(index_); cpu_cache_mgr->InsertItem(location_, obj); - cpu_cache_mgr->Unlock(); return Status::OK(); }