mirror of https://github.com/milvus-io/milvus.git
The GPU cache holds much more data than the configured value (#4720)
* The GPU cache holds much more data than the configured value Signed-off-by: cmli <chengming.li@zilliz.com> * update changelog and remove the useless variable G_BYTE and unit Signed-off-by: cmli <chengming.li@zilliz.com>pull/4728/head
parent
09f0730f8d
commit
e8afb2ba65
|
@ -6,6 +6,7 @@ Please mark all change in change log and use the issue from GitHub
|
|||
## Bug
|
||||
- \#4683 A negative zero may be returned if the metric_type is Tanimoto
|
||||
- \#4678 Server crash on BinaryFlat if dimension is not a power of 2
|
||||
- \#4720 The GPU cache holds much more data than the configured value
|
||||
|
||||
## Feature
|
||||
|
||||
|
|
|
@ -21,18 +21,13 @@
|
|||
namespace milvus {
|
||||
namespace cache {
|
||||
|
||||
namespace {
|
||||
// constexpr int64_t unit = 1024 * 1024 * 1024;
|
||||
constexpr int64_t unit = 1;
|
||||
} // namespace
|
||||
|
||||
CpuCacheMgr::CpuCacheMgr() {
|
||||
// All config values have been checked in Config::ValidateConfig()
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
|
||||
int64_t cpu_cache_cap;
|
||||
config.GetCacheConfigCpuCacheCapacity(cpu_cache_cap);
|
||||
int64_t cap = cpu_cache_cap * unit;
|
||||
int64_t cap = cpu_cache_cap;
|
||||
LOG_SERVER_DEBUG_ << "cpu cache.size: " << cap;
|
||||
LOG_SERVER_INFO_ << "cpu cache.size: " << cap;
|
||||
cache_ = std::make_shared<Cache<DataObjPtr>>(cap, 1UL << 32, "[CACHE CPU]");
|
||||
|
@ -59,7 +54,7 @@ CpuCacheMgr::GetIndex(const std::string& key) {
|
|||
|
||||
void
|
||||
CpuCacheMgr::OnCpuCacheCapacityChanged(int64_t value) {
|
||||
SetCapacity(value * unit);
|
||||
SetCapacity(value);
|
||||
}
|
||||
|
||||
} // namespace cache
|
||||
|
|
|
@ -24,17 +24,13 @@ namespace cache {
|
|||
std::mutex GpuCacheMgr::global_mutex_;
|
||||
std::unordered_map<int64_t, GpuCacheMgrPtr> GpuCacheMgr::instance_;
|
||||
|
||||
namespace {
|
||||
constexpr int64_t G_BYTE = 1024 * 1024 * 1024;
|
||||
}
|
||||
|
||||
GpuCacheMgr::GpuCacheMgr(int64_t gpu_id) : gpu_id_(gpu_id) {
|
||||
// All config values have been checked in Config::ValidateConfig()
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
|
||||
int64_t gpu_cache_cap;
|
||||
config.GetGpuResourceConfigCacheCapacity(gpu_cache_cap);
|
||||
int64_t cap = gpu_cache_cap * G_BYTE;
|
||||
int64_t cap = gpu_cache_cap;
|
||||
std::string header = "[CACHE GPU" + std::to_string(gpu_id) + "]";
|
||||
cache_ = std::make_shared<Cache<DataObjPtr>>(cap, 1UL << 32, header);
|
||||
|
||||
|
@ -84,7 +80,7 @@ GpuCacheMgr::GetInstance(int64_t gpu_id) {
|
|||
void
|
||||
GpuCacheMgr::OnGpuCacheCapacityChanged(int64_t capacity) {
|
||||
for (auto& iter : instance_) {
|
||||
iter.second->SetCapacity(capacity * G_BYTE);
|
||||
iter.second->SetCapacity(capacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue