Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
37df2b6f
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
37df2b6f
编写于
11月 20, 2019
作者:
Y
yudong.cai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#346 rename gpu_resource_config.enable_gpu to gpu_resource_config.enable
上级
8c48d95f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
39 deletion
+38
-39
core/conf/server_cpu_config.template
core/conf/server_cpu_config.template
+1
-1
core/conf/server_gpu_config.template
core/conf/server_gpu_config.template
+1
-1
core/src/server/Config.cpp
core/src/server/Config.cpp
+28
-29
core/src/server/Config.h
core/src/server/Config.h
+5
-5
core/unittest/server/test_config.cpp
core/unittest/server/test_config.cpp
+3
-3
未找到文件。
core/conf/server_cpu_config.template
浏览文件 @
37df2b6f
...
...
@@ -36,7 +36,7 @@ engine_config:
gpu_search_threshold: 1000 # threshold beyond which the search computation is executed on GPUs only
gpu_resource_config:
enable
_gpu: false
# whether to enable GPU resources
enable
: false
# whether to enable GPU resources
cache_capacity: 4 # GB, size of GPU memory per card used for cache, must be a positive integer
search_resources: # define the GPU devices used for search computation, must be in format gpux
- gpu0
...
...
core/conf/server_gpu_config.template
浏览文件 @
37df2b6f
...
...
@@ -36,7 +36,7 @@ engine_config:
gpu_search_threshold: 1000 # threshold beyond which the search computation is executed on GPUs only
gpu_resource_config:
enable
_gpu: true
# whether to enable GPU resources
enable
: true
# whether to enable GPU resources
cache_capacity: 4 # GB, size of GPU memory per card used for cache, must be a positive integer
search_resources: # define the GPU devices used for search computation, must be in format gpux
- gpu0
...
...
core/src/server/Config.cpp
浏览文件 @
37df2b6f
...
...
@@ -190,8 +190,8 @@ Config::ValidateConfig() {
/* gpu resource config */
#ifdef MILVUS_GPU_VERSION
bool
resource_enable_gpu
;
s
=
GetGpuResourceConfigEnable
Gpu
(
resource_enable_gpu
);
bool
gpu_resource_enable
;
s
=
GetGpuResourceConfigEnable
(
gpu_resource_enable
);
if
(
!
s
.
ok
())
{
return
s
;
}
...
...
@@ -330,7 +330,7 @@ Config::ResetDefaultConfig() {
/* gpu resource config */
#ifdef MILVUS_GPU_VERSION
s
=
SetGpuResourceConfigEnable
Gpu
(
CONFIG_GPU_RESOURCE_ENABLE_GPU
_DEFAULT
);
s
=
SetGpuResourceConfigEnable
(
CONFIG_GPU_RESOURCE_ENABLE
_DEFAULT
);
if
(
!
s
.
ok
())
{
return
s
;
}
...
...
@@ -641,10 +641,10 @@ Config::CheckEngineConfigGpuSearchThreshold(const std::string& value) {
}
Status
Config
::
CheckGpuResourceConfigEnable
Gpu
(
const
std
::
string
&
value
)
{
Config
::
CheckGpuResourceConfigEnable
(
const
std
::
string
&
value
)
{
if
(
!
ValidationUtil
::
ValidateStringIsBool
(
value
).
ok
())
{
std
::
string
msg
=
"Invalid gpu resource config: "
+
value
+
". Possible reason: gpu_resource_config.enable_gpu
is not a boolean."
;
std
::
string
msg
=
"Invalid gpu resource config: "
+
value
+
". Possible reason: gpu_resource_config.enable
is not a boolean."
;
return
Status
(
SERVER_INVALID_ARGUMENT
,
msg
);
}
return
Status
::
OK
();
...
...
@@ -992,10 +992,9 @@ Config::GetEngineConfigGpuSearchThreshold(int32_t& value) {
}
Status
Config
::
GetGpuResourceConfigEnableGpu
(
bool
&
value
)
{
std
::
string
str
=
GetConfigStr
(
CONFIG_GPU_RESOURCE
,
CONFIG_GPU_RESOURCE_ENABLE_GPU
,
CONFIG_GPU_RESOURCE_ENABLE_GPU_DEFAULT
);
Status
s
=
CheckGpuResourceConfigEnableGpu
(
str
);
Config
::
GetGpuResourceConfigEnable
(
bool
&
value
)
{
std
::
string
str
=
GetConfigStr
(
CONFIG_GPU_RESOURCE
,
CONFIG_GPU_RESOURCE_ENABLE
,
CONFIG_GPU_RESOURCE_ENABLE_DEFAULT
);
Status
s
=
CheckGpuResourceConfigEnable
(
str
);
if
(
!
s
.
ok
())
{
return
s
;
}
...
...
@@ -1006,13 +1005,13 @@ Config::GetGpuResourceConfigEnableGpu(bool& value) {
Status
Config
::
GetGpuResourceConfigCacheCapacity
(
int64_t
&
value
)
{
bool
enable_gpu
=
false
;
Status
s
=
GetGpuResourceConfigEnable
Gpu
(
enable_gpu
);
bool
gpu_resource_enable
=
false
;
Status
s
=
GetGpuResourceConfigEnable
(
gpu_resource_enable
);
if
(
!
s
.
ok
())
{
return
s
;
}
if
(
!
enable_gpu
)
{
std
::
string
msg
=
"GPU not supported. Possible reason: gpu_resource_config.enable
_gpu
is set to false."
;
if
(
!
gpu_resource_enable
)
{
std
::
string
msg
=
"GPU not supported. Possible reason: gpu_resource_config.enable is set to false."
;
return
Status
(
SERVER_UNSUPPORTED_ERROR
,
msg
);
}
std
::
string
str
=
GetConfigStr
(
CONFIG_GPU_RESOURCE
,
CONFIG_GPU_RESOURCE_CACHE_CAPACITY
,
...
...
@@ -1027,13 +1026,13 @@ Config::GetGpuResourceConfigCacheCapacity(int64_t& value) {
Status
Config
::
GetGpuResourceConfigCacheThreshold
(
float
&
value
)
{
bool
enable_gpu
=
false
;
Status
s
=
GetGpuResourceConfigEnable
Gpu
(
enable_gpu
);
bool
gpu_resource_enable
=
false
;
Status
s
=
GetGpuResourceConfigEnable
(
gpu_resource_enable
);
if
(
!
s
.
ok
())
{
return
s
;
}
if
(
!
enable_gpu
)
{
std
::
string
msg
=
"GPU not supported. Possible reason: gpu_resource_config.enable
_gpu
is set to false."
;
if
(
!
gpu_resource_enable
)
{
std
::
string
msg
=
"GPU not supported. Possible reason: gpu_resource_config.enable is set to false."
;
return
Status
(
SERVER_UNSUPPORTED_ERROR
,
msg
);
}
std
::
string
str
=
GetConfigStr
(
CONFIG_GPU_RESOURCE
,
CONFIG_GPU_RESOURCE_CACHE_THRESHOLD
,
...
...
@@ -1048,13 +1047,13 @@ Config::GetGpuResourceConfigCacheThreshold(float& value) {
Status
Config
::
GetGpuResourceConfigSearchResources
(
std
::
vector
<
int32_t
>&
value
)
{
bool
enable_gpu
=
false
;
Status
s
=
GetGpuResourceConfigEnable
Gpu
(
enable_gpu
);
bool
gpu_resource_enable
=
false
;
Status
s
=
GetGpuResourceConfigEnable
(
gpu_resource_enable
);
if
(
!
s
.
ok
())
{
return
s
;
}
if
(
!
enable_gpu
)
{
std
::
string
msg
=
"GPU not supported. Possible reason: gpu_resource_config.enable
_gpu
is set to false."
;
if
(
!
gpu_resource_enable
)
{
std
::
string
msg
=
"GPU not supported. Possible reason: gpu_resource_config.enable is set to false."
;
return
Status
(
SERVER_UNSUPPORTED_ERROR
,
msg
);
}
std
::
string
str
=
GetConfigSequenceStr
(
CONFIG_GPU_RESOURCE
,
CONFIG_GPU_RESOURCE_SEARCH_RESOURCES
,
...
...
@@ -1073,13 +1072,13 @@ Config::GetGpuResourceConfigSearchResources(std::vector<int32_t>& value) {
Status
Config
::
GetGpuResourceConfigBuildIndexResources
(
std
::
vector
<
int32_t
>&
value
)
{
bool
enable_gpu
=
false
;
Status
s
=
GetGpuResourceConfigEnable
Gpu
(
enable_gpu
);
bool
gpu_resource_enable
=
false
;
Status
s
=
GetGpuResourceConfigEnable
(
gpu_resource_enable
);
if
(
!
s
.
ok
())
{
return
s
;
}
if
(
!
enable_gpu
)
{
std
::
string
msg
=
"GPU not supported. Possible reason: gpu_resource_config.enable
_gpu
is set to false."
;
if
(
!
gpu_resource_enable
)
{
std
::
string
msg
=
"GPU not supported. Possible reason: gpu_resource_config.enable is set to false."
;
return
Status
(
SERVER_UNSUPPORTED_ERROR
,
msg
);
}
std
::
string
str
=
...
...
@@ -1295,12 +1294,12 @@ Config::SetEngineConfigGpuSearchThreshold(const std::string& value) {
/* gpu resource config */
Status
Config
::
SetGpuResourceConfigEnable
Gpu
(
const
std
::
string
&
value
)
{
Status
s
=
CheckGpuResourceConfigEnable
Gpu
(
value
);
Config
::
SetGpuResourceConfigEnable
(
const
std
::
string
&
value
)
{
Status
s
=
CheckGpuResourceConfigEnable
(
value
);
if
(
!
s
.
ok
())
{
return
s
;
}
SetConfigValueInMem
(
CONFIG_GPU_RESOURCE
,
CONFIG_GPU_RESOURCE_ENABLE
_GPU
,
value
);
SetConfigValueInMem
(
CONFIG_GPU_RESOURCE
,
CONFIG_GPU_RESOURCE_ENABLE
,
value
);
return
Status
::
OK
();
}
...
...
core/src/server/Config.h
浏览文件 @
37df2b6f
...
...
@@ -85,9 +85,9 @@ static const char* CONFIG_ENGINE_GPU_SEARCH_THRESHOLD_DEFAULT = "1000";
/* gpu resource config */
static
const
char
*
CONFIG_GPU_RESOURCE
=
"gpu_resource_config"
;
static
const
char
*
CONFIG_GPU_RESOURCE_ENABLE
_GPU
=
"enable_gpu
"
;
static
const
char
*
CONFIG_GPU_RESOURCE_ENABLE
=
"enable
"
;
#ifdef MILVUS_GPU_VERSION
static
const
char
*
CONFIG_GPU_RESOURCE_ENABLE_
GPU_
DEFAULT
=
"true"
;
static
const
char
*
CONFIG_GPU_RESOURCE_ENABLE_DEFAULT
=
"true"
;
#else
static
const
char
*
CONFIG_GPU_RESOURCE_ENABLE_GPU_DEFAULT
=
"false"
;
#endif
...
...
@@ -175,7 +175,7 @@ class Config {
/* gpu resource config */
Status
CheckGpuResourceConfigEnable
Gpu
(
const
std
::
string
&
value
);
CheckGpuResourceConfigEnable
(
const
std
::
string
&
value
);
Status
CheckGpuResourceConfigCacheCapacity
(
const
std
::
string
&
value
);
Status
...
...
@@ -244,7 +244,7 @@ class Config {
/* gpu resource config */
Status
GetGpuResourceConfigEnable
Gpu
(
bool
&
value
);
GetGpuResourceConfigEnable
(
bool
&
value
);
Status
GetGpuResourceConfigCacheCapacity
(
int64_t
&
value
);
Status
...
...
@@ -305,7 +305,7 @@ class Config {
/* gpu resource config */
Status
SetGpuResourceConfigEnable
Gpu
(
const
std
::
string
&
value
);
SetGpuResourceConfigEnable
(
const
std
::
string
&
value
);
Status
SetGpuResourceConfigCacheCapacity
(
const
std
::
string
&
value
);
Status
...
...
core/unittest/server/test_config.cpp
浏览文件 @
37df2b6f
...
...
@@ -246,9 +246,9 @@ TEST_F(ConfigTest, SERVER_CONFIG_VALID_TEST) {
/* gpu resource config */
bool
resource_enable_gpu
=
true
;
s
=
config
.
SetGpuResourceConfigEnable
Gpu
(
std
::
to_string
(
resource_enable_gpu
));
s
=
config
.
SetGpuResourceConfigEnable
(
std
::
to_string
(
resource_enable_gpu
));
ASSERT_TRUE
(
s
.
ok
());
s
=
config
.
GetGpuResourceConfigEnable
Gpu
(
bool_val
);
s
=
config
.
GetGpuResourceConfigEnable
(
bool_val
);
ASSERT_TRUE
(
s
.
ok
());
ASSERT_TRUE
(
bool_val
==
resource_enable_gpu
);
...
...
@@ -394,7 +394,7 @@ TEST_F(ConfigTest, SERVER_CONFIG_INVALID_TEST) {
ASSERT_FALSE
(
s
.
ok
());
/* gpu resource config */
s
=
config
.
SetGpuResourceConfigEnable
Gpu
(
"ok"
);
s
=
config
.
SetGpuResourceConfigEnable
(
"ok"
);
ASSERT_FALSE
(
s
.
ok
());
#ifdef MILVUS_GPU_VERSION
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录