未验证 提交 9b236801 编写于 作者: F feisiyicl 提交者: GitHub

#1946 fix load index file CPU2GPU fail during searching (#2182)

Signed-off-by: Nfeisiyicl <7764126@qq.com>
上级 a76e705a
......@@ -7,6 +7,7 @@ Please mark all change in change log and use the issue from GitHub
## Bug
- \#1705 Limit the insert data batch size
- \#1929 Skip MySQL meta schema field width check
- \#1946 Fix load index file CPU2GPU fail during searching
- \#1997 Index file missed after compact
- \#2073 Fix CheckDBConfigBackendUrl error message
- \#2076 CheckMetricConfigAddress error message
......
......@@ -51,11 +51,10 @@ FaissGpuResourceMgr::InitDevice(int64_t device_id, int64_t pin_mem_size, int64_t
void
FaissGpuResourceMgr::InitResource() {
if (is_init)
return;
is_init = true;
if (!initialized_) {
std::lock_guard<std::mutex> lock(init_mutex_);
if (!initialized_) {
for (auto& device : devices_params_) {
auto& device_id = device.first;
......@@ -75,6 +74,9 @@ FaissGpuResourceMgr::InitResource() {
}
LOG_KNOWHERE_DEBUG_ << "DEVICEID " << device_id << ", resource count " << bq.Size();
}
initialized_ = true;
}
}
}
ResPtr
......@@ -115,7 +117,7 @@ FaissGpuResourceMgr::Free() {
bq.Take();
}
}
is_init = false;
initialized_ = false;
}
void
......
......@@ -77,7 +77,8 @@ class FaissGpuResourceMgr {
Dump();
protected:
bool is_init = false;
bool initialized_ = false;
std::mutex init_mutex_;
std::map<int64_t, std::unique_ptr<std::mutex>> mutex_cache_;
std::map<int64_t, DeviceParams> devices_params_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册