diff --git a/cpp/src/server/ServerConfig.cpp b/cpp/src/server/ServerConfig.cpp index bb1879e0b4..4a5d0d0931 100644 --- a/cpp/src/server/ServerConfig.cpp +++ b/cpp/src/server/ServerConfig.cpp @@ -84,12 +84,12 @@ ServerError ServerConfig::ValidateConfig() const { size_t gpu_mem = 0; ValidationUtil::GetGpuMemory(gpu_index, gpu_mem); - if(index_building_threshold >= gpu_mem/3) { - std::cout << "Warnning: index_building_threshold is greater than 1/3 of gpu memory, " - << "some index type(such as IVFLAT) may cause cuda::bad_alloc() error" << std::endl; - } else if(index_building_threshold >= gpu_mem) { + if(index_building_threshold >= gpu_mem) { std::cout << "Error: index_building_threshold execeed gpu memory" << std::endl; return SERVER_INVALID_ARGUMENT; + } else if(index_building_threshold >= gpu_mem/3) { + std::cout << "Warnning: index_building_threshold is greater than 1/3 of gpu memory, " + << "some index type(such as IVFLAT) may cause cuda::bad_alloc() error" << std::endl; } //cache config validation @@ -103,7 +103,7 @@ ServerError ServerConfig::ValidateConfig() const { std::cout << "Warnning: cpu_cache_capacity value is too aggressive" << std::endl; } - if(insert_buffer_size + cache_cap >= total_mem) if(cache_cap >= total_mem) { + if(insert_buffer_size + cache_cap >= total_mem) { std::cout << "Error: sum of cpu_cache_capacity and insert_buffer_size execeed system memory" << std::endl; return SERVER_INVALID_ARGUMENT; }