mirror of https://github.com/milvus-io/milvus.git
#346 rename gpu_resource_config.enable_gpu to gpu_resource_config.enable
parent
8c48d95faf
commit
37df2b6fc4
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -190,8 +190,8 @@ Config::ValidateConfig() {
|
|||
|
||||
/* gpu resource config */
|
||||
#ifdef MILVUS_GPU_VERSION
|
||||
bool resource_enable_gpu;
|
||||
s = GetGpuResourceConfigEnableGpu(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 = SetGpuResourceConfigEnableGpu(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::CheckGpuResourceConfigEnableGpu(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 = GetGpuResourceConfigEnableGpu(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 = GetGpuResourceConfigEnableGpu(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 = GetGpuResourceConfigEnableGpu(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 = GetGpuResourceConfigEnableGpu(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::SetGpuResourceConfigEnableGpu(const std::string& value) {
|
||||
Status s = CheckGpuResourceConfigEnableGpu(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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
CheckGpuResourceConfigEnableGpu(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
|
||||
GetGpuResourceConfigEnableGpu(bool& value);
|
||||
GetGpuResourceConfigEnable(bool& value);
|
||||
Status
|
||||
GetGpuResourceConfigCacheCapacity(int64_t& value);
|
||||
Status
|
||||
|
@ -305,7 +305,7 @@ class Config {
|
|||
|
||||
/* gpu resource config */
|
||||
Status
|
||||
SetGpuResourceConfigEnableGpu(const std::string& value);
|
||||
SetGpuResourceConfigEnable(const std::string& value);
|
||||
Status
|
||||
SetGpuResourceConfigCacheCapacity(const std::string& value);
|
||||
Status
|
||||
|
|
|
@ -246,9 +246,9 @@ TEST_F(ConfigTest, SERVER_CONFIG_VALID_TEST) {
|
|||
|
||||
/* gpu resource config */
|
||||
bool resource_enable_gpu = true;
|
||||
s = config.SetGpuResourceConfigEnableGpu(std::to_string(resource_enable_gpu));
|
||||
s = config.SetGpuResourceConfigEnable(std::to_string(resource_enable_gpu));
|
||||
ASSERT_TRUE(s.ok());
|
||||
s = config.GetGpuResourceConfigEnableGpu(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.SetGpuResourceConfigEnableGpu("ok");
|
||||
s = config.SetGpuResourceConfigEnable("ok");
|
||||
ASSERT_FALSE(s.ok());
|
||||
|
||||
#ifdef MILVUS_GPU_VERSION
|
||||
|
|
Loading…
Reference in New Issue