mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-06 10:52:56 +08:00
Signed-off-by: feisiyicl <7764126@qq.com>
This commit is contained in:
parent
a76e705a92
commit
9b2368016c
@ -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,29 +51,31 @@ FaissGpuResourceMgr::InitDevice(int64_t device_id, int64_t pin_mem_size, int64_t
|
||||
|
||||
void
|
||||
FaissGpuResourceMgr::InitResource() {
|
||||
if (is_init)
|
||||
return;
|
||||
if (!initialized_) {
|
||||
std::lock_guard<std::mutex> lock(init_mutex_);
|
||||
|
||||
is_init = true;
|
||||
if (!initialized_) {
|
||||
for (auto& device : devices_params_) {
|
||||
auto& device_id = device.first;
|
||||
|
||||
for (auto& device : devices_params_) {
|
||||
auto& device_id = device.first;
|
||||
mutex_cache_.emplace(device_id, std::make_unique<std::mutex>());
|
||||
|
||||
mutex_cache_.emplace(device_id, std::make_unique<std::mutex>());
|
||||
auto& device_param = device.second;
|
||||
auto& bq = idle_map_[device_id];
|
||||
|
||||
auto& device_param = device.second;
|
||||
auto& bq = idle_map_[device_id];
|
||||
for (int64_t i = 0; i < device_param.resource_num; ++i) {
|
||||
auto raw_resource = std::make_shared<faiss::gpu::StandardGpuResources>();
|
||||
|
||||
for (int64_t i = 0; i < device_param.resource_num; ++i) {
|
||||
auto raw_resource = std::make_shared<faiss::gpu::StandardGpuResources>();
|
||||
// TODO(linxj): enable set pinned memory
|
||||
auto res_wrapper = std::make_shared<Resource>(raw_resource);
|
||||
AllocateTempMem(res_wrapper, device_id, 0);
|
||||
|
||||
// TODO(linxj): enable set pinned memory
|
||||
auto res_wrapper = std::make_shared<Resource>(raw_resource);
|
||||
AllocateTempMem(res_wrapper, device_id, 0);
|
||||
|
||||
bq.Put(res_wrapper);
|
||||
bq.Put(res_wrapper);
|
||||
}
|
||||
LOG_KNOWHERE_DEBUG_ << "DEVICEID " << device_id << ", resource count " << bq.Size();
|
||||
}
|
||||
initialized_ = true;
|
||||
}
|
||||
LOG_KNOWHERE_DEBUG_ << "DEVICEID " << device_id << ", resource count " << bq.Size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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_;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user