提交 35492ec0 编写于 作者: X xj.lin

MS-476 1. add resource mgr config


Former-commit-id: 5cae0ea977e93184ad34de39983ef46cb1ab075b
上级 d97f1bd7
...@@ -74,6 +74,9 @@ resource_config: ...@@ -74,6 +74,9 @@ resource_config:
device_id: 0 device_id: 0
enable_loader: true enable_loader: true
enable_executor: true enable_executor: true
gpu_resource_num: 2
pinned_memory: 300
temp_memory: 300
# gtx1660: # gtx1660:
# type: GPU # type: GPU
......
...@@ -357,9 +357,9 @@ void BasicIndex::SealImpl() { ...@@ -357,9 +357,9 @@ void BasicIndex::SealImpl() {
if (idx != nullptr) { if (idx != nullptr) {
idx->to_readonly(); idx->to_readonly();
} }
else { //else {
KNOHWERE_ERROR_MSG("Seal failed"); // KNOHWERE_ERROR_MSG("Seal failed");
} //}
//#endif //#endif
} }
......
...@@ -31,6 +31,9 @@ StartSchedulerService() { ...@@ -31,6 +31,9 @@ StartSchedulerService() {
auto device_id = resconf.GetInt64Value(server::CONFIG_RESOURCE_DEVICE_ID); auto device_id = resconf.GetInt64Value(server::CONFIG_RESOURCE_DEVICE_ID);
auto enable_loader = resconf.GetBoolValue(server::CONFIG_RESOURCE_ENABLE_LOADER); auto enable_loader = resconf.GetBoolValue(server::CONFIG_RESOURCE_ENABLE_LOADER);
auto enable_executor = resconf.GetBoolValue(server::CONFIG_RESOURCE_ENABLE_EXECUTOR); auto enable_executor = resconf.GetBoolValue(server::CONFIG_RESOURCE_ENABLE_EXECUTOR);
auto pinned_memory = resconf.GetInt64Value(server::CONFIG_RESOURCE_PIN_MEMORY);
auto temp_memory = resconf.GetInt64Value(server::CONFIG_RESOURCE_TEMP_MEMORY);
auto resource_num = resconf.GetInt64Value(server::CONFIG_RESOURCE_NUM);
ResMgrInst::GetInstance()->Add(ResourceFactory::Create(resname, ResMgrInst::GetInstance()->Add(ResourceFactory::Create(resname,
type, type,
...@@ -38,7 +41,9 @@ StartSchedulerService() { ...@@ -38,7 +41,9 @@ StartSchedulerService() {
enable_loader, enable_loader,
enable_executor)); enable_executor));
knowhere::FaissGpuResourceMgr::GetInstance().InitDevice(device_id); pinned_memory = 1024 * 1024 * pinned_memory;
temp_memory = 1024 * 1024 * temp_memory;
knowhere::FaissGpuResourceMgr::GetInstance().InitDevice(device_id, pinned_memory, temp_memory, resource_num);
} }
knowhere::FaissGpuResourceMgr::GetInstance().InitResource(); knowhere::FaissGpuResourceMgr::GetInstance().InitResource();
......
...@@ -56,6 +56,9 @@ static const char* CONFIG_RESOURCE_MEMORY = "memory"; ...@@ -56,6 +56,9 @@ static const char* CONFIG_RESOURCE_MEMORY = "memory";
static const char* CONFIG_RESOURCE_DEVICE_ID = "device_id"; static const char* CONFIG_RESOURCE_DEVICE_ID = "device_id";
static const char* CONFIG_RESOURCE_ENABLE_LOADER = "enable_loader"; static const char* CONFIG_RESOURCE_ENABLE_LOADER = "enable_loader";
static const char* CONFIG_RESOURCE_ENABLE_EXECUTOR = "enable_executor"; static const char* CONFIG_RESOURCE_ENABLE_EXECUTOR = "enable_executor";
static const char* CONFIG_RESOURCE_NUM = "gpu_resource_num";
static const char* CONFIG_RESOURCE_PIN_MEMORY = "pinned_memory";
static const char* CONFIG_RESOURCE_TEMP_MEMORY = "temp_memory";
static const char* CONFIG_RESOURCE_CONNECTIONS = "connections"; static const char* CONFIG_RESOURCE_CONNECTIONS = "connections";
static const char* CONFIG_SPEED_CONNECTIONS = "speed"; static const char* CONFIG_SPEED_CONNECTIONS = "speed";
static const char* CONFIG_ENDPOINT_CONNECTIONS = "endpoint"; static const char* CONFIG_ENDPOINT_CONNECTIONS = "endpoint";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册