MS-249 Check machine hardware during initialize

Former-commit-id: e513499fb015a6867a762a10b629dd774182f21a
pull/191/head
starlord 2019-07-22 11:15:11 +08:00
parent fe63fb509a
commit eb1d1e393f
1 changed files with 5 additions and 5 deletions

View File

@ -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;
}