[CVS-78727] bug fix for -d AUTO:CPU,GPU the return device should be AUTO only (#10417)

Signed-off-by: xuejun <xuejun.zhai@intel.com>
This commit is contained in:
Xuejun Zhai 2022-02-18 14:56:56 +08:00 committed by GitHub
parent 17311c46b3
commit 2ac15eae3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -402,6 +402,8 @@ int main(int argc, char* argv[]) {
setThroughputStreams();
} else if (device.find("GNA") != std::string::npos) {
set_infer_precision();
} else if (device.find("AUTO") != std::string::npos) {
device_nstreams.erase(device);
}
}

View File

@ -109,12 +109,17 @@ std::vector<std::string> parse_devices(const std::string& device_string) {
std::string comma_separated_devices = device_string;
auto colon = comma_separated_devices.find(":");
if (colon != std::string::npos) {
if (comma_separated_devices.substr(0, colon) == "AUTO") {
std::vector<std::string> result;
result.push_back("AUTO");
return result;
}
auto bracket = comma_separated_devices.find("("); // e.g. in BATCH:GPU(4)
comma_separated_devices = comma_separated_devices.substr(colon + 1, bracket - colon - 1);
}
if ((comma_separated_devices == "AUTO") || (comma_separated_devices == "MULTI") ||
(comma_separated_devices == "HETERO"))
if ((comma_separated_devices == "MULTI") || (comma_separated_devices == "HETERO"))
return std::vector<std::string>();
auto devices = split(comma_separated_devices, ',');
return devices;
}