mirror of https://github.com/milvus-io/milvus.git
Merge pull request #201 from cydrain/0.5.2
#200 disable search resource has only CPUpull/209/head^2
commit
ea505c8642
|
@ -39,6 +39,7 @@ engine_config:
|
|||
gpu_search_threshold: 1000 # threshold beyond which the search computation is executed on GPUs only
|
||||
|
||||
resource_config:
|
||||
search_resources: # define the GPUs used for search computation, must be in format: gpux
|
||||
search_resources: # define the devices used for search computation, must be in format: cpu or gpux
|
||||
- cpu
|
||||
- gpu0
|
||||
index_build_device: gpu0 # GPU used for building index, must be in format: gpux
|
|
@ -716,24 +716,34 @@ Config::CheckResourceConfigSearchResources(const std::vector<std::string>& value
|
|||
return Status(SERVER_INVALID_ARGUMENT, msg);
|
||||
}
|
||||
|
||||
bool cpu_found = false, gpu_found = false;
|
||||
for (auto& device : value) {
|
||||
if (device == "cpu") {
|
||||
cpu_found = true;
|
||||
continue;
|
||||
}
|
||||
if (!CheckGpuDevice(device).ok()) {
|
||||
if (CheckGpuDevice(device).ok()) {
|
||||
gpu_found = true;
|
||||
} else {
|
||||
std::string msg = "Invalid search resource: " + device +
|
||||
". Possible reason: resource_config.search_resources does not match your hardware.";
|
||||
return Status(SERVER_INVALID_ARGUMENT, msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu_found && !gpu_found) {
|
||||
std::string msg =
|
||||
"Invalid search resource. Possible reason: resource_config.search_resources has only CPU resource.";
|
||||
return Status(SERVER_INVALID_ARGUMENT, msg);
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status
|
||||
Config::CheckResourceConfigIndexBuildDevice(const std::string& value) {
|
||||
if (value == "cpu") {
|
||||
return Status::OK();
|
||||
}
|
||||
// if (value == "cpu") {
|
||||
// return Status::OK();
|
||||
// }
|
||||
if (!CheckGpuDevice(value).ok()) {
|
||||
std::string msg = "Invalid index build device: " + value +
|
||||
". Possible reason: resource_config.index_build_device does not match your hardware.";
|
||||
|
|
Loading…
Reference in New Issue