[AUTO] Initialize variable / reduce variable copy (#16743)
* [AUTO] Initialize variable / reduce variable copy Signed-off-by: Peter Chen <peter.chen@intel.com> * Be compatible with C++11 https://stackoverflow.com/questions/18184096 Signed-off-by: Peter Chen <peter.chen@intel.com> * Fix C7555 C7555 “use of designated initializers requires at least ‘/std:c++latest’” in extern “C” code. Signed-off-by: Peter Chen <peter.chen@intel.com> * Init in constructor and use auto const & Signed-off-by: Peter Chen <peter.chen@intel.com> * Fix cpplint issue common.hpp:72: You don't need a ; after a } Signed-off-by: Peter Chen <peter.chen@intel.com> * Support all possible parameter numbers (0-6) Signed-off-by: Peter Chen <peter.chen@intel.com> * Fix cpplint issues Signed-off-by: Peter Chen <peter.chen@intel.com> --------- Signed-off-by: Peter Chen <peter.chen@intel.com>
This commit is contained in:
@@ -237,7 +237,7 @@ IE::Parameter AutoExecutableNetwork::GetMetric(const std::string& name) const {
|
||||
if (_autoSchedule->_pCTPUTLoadContext) {
|
||||
std::vector<std::string> exeDevices = {};
|
||||
std::lock_guard<std::mutex> lock(_autoSContext->_confMutex);
|
||||
for (auto n : _autoSContext->_devicePriorities) {
|
||||
for (auto const & n : _autoSContext->_devicePriorities) {
|
||||
exeDevices.push_back(n.deviceName);
|
||||
}
|
||||
execution_devices = decltype(ov::execution_devices)::value_type {exeDevices};
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
public:
|
||||
AutoLoadContext _loadContext[CONTEXTNUM];
|
||||
std::unique_ptr<AutoLoadContext[]> _pCTPUTLoadContext = nullptr;
|
||||
size_t _nCTputDeviceNums;
|
||||
size_t _nCTputDeviceNums = 0;
|
||||
|
||||
protected:
|
||||
void GenerateWorkers(const std::string& device, const SoExecNetwork& executableNetwork) override;
|
||||
|
||||
@@ -69,6 +69,11 @@ struct DeviceInformation {
|
||||
std::string defaultDeviceID;
|
||||
DeviceName uniqueName;
|
||||
unsigned int devicePriority;
|
||||
DeviceInformation(DeviceName dn = {}, std::map<std::string, std::string> conf = {},
|
||||
int nReq = -1, std::string defaultID = {}, DeviceName uName = {}, unsigned int priority = 0)
|
||||
: deviceName(dn), config(conf),
|
||||
numRequestsPerDevices(nReq), defaultDeviceID(defaultID), uniqueName(uName), devicePriority(priority)
|
||||
{}
|
||||
};
|
||||
|
||||
struct WorkerInferRequest {
|
||||
|
||||
@@ -108,7 +108,7 @@ IE::Parameter MultiExecutableNetwork::GetMetric(const std::string& name) const {
|
||||
};
|
||||
} else if (name == ov::device::properties) {
|
||||
ov::AnyMap all_devices = {};
|
||||
for (auto network : _multiSContext->_networksPerDevice) {
|
||||
for (auto const & network : _multiSContext->_networksPerDevice) {
|
||||
ov::AnyMap device_properties = {};
|
||||
auto device_supported_metrics = network.second->GetMetric(METRIC_KEY(SUPPORTED_METRICS));
|
||||
for (auto&& property_name : device_supported_metrics.as<std::vector<std::string>>()) {
|
||||
@@ -123,7 +123,7 @@ IE::Parameter MultiExecutableNetwork::GetMetric(const std::string& name) const {
|
||||
return all_devices;
|
||||
} else if (name == ov::optimal_number_of_infer_requests) {
|
||||
unsigned int res = 0u;
|
||||
for (auto n : _multiSContext->_networksPerDevice) {
|
||||
for (auto const & n : _multiSContext->_networksPerDevice) {
|
||||
try {
|
||||
res += n.second->GetMetric(METRIC_KEY(
|
||||
OPTIMAL_NUMBER_OF_INFER_REQUESTS)).as<unsigned int>();
|
||||
|
||||
@@ -300,7 +300,7 @@ InferenceEngine::Parameter MultiDeviceInferencePlugin::GetMetric(const std::stri
|
||||
} else if (name == METRIC_KEY(OPTIMIZATION_CAPABILITIES)) {
|
||||
auto deviceList = GetCore()->GetAvailableDevices();
|
||||
std::vector<std::string> capabilities;
|
||||
for (auto device : deviceList) {
|
||||
for (auto const & device : deviceList) {
|
||||
auto devCapabilities = GetCore()->GetMetric(device, ov::device::capabilities.name()).as<std::vector<std::string>>();
|
||||
capabilities.insert(capabilities.end(), devCapabilities.begin(), devCapabilities.end());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user