Skip to content

Commit 50cab2a

Browse files
committed
create global available devices to access it in const time
1 parent d959343 commit 50cab2a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

onnxruntime/core/providers/openvino/contexts.h

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ struct ProviderInfo {
108108
struct SessionContext : ProviderInfo {
109109
SessionContext(const ProviderInfo& info) : ProviderInfo{info} {}
110110
std::vector<bool> deviceAvailableList = {true, true, true, true, true, true, true, true};
111+
std::vector<std::string> available_devices; // this vector will be used to validate available devices thoughout OVEP lifetime
111112
std::filesystem::path onnx_model_path_name;
112113
uint32_t onnx_opset_version{0};
113114
mutable bool is_wholly_supported_graph = false; // Value is set to mutable to modify from capability

onnxruntime/core/providers/openvino/openvino_execution_provider.cc

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ OpenVINOExecutionProvider::OpenVINOExecutionProvider(const ProviderInfo& info, s
6464
if (info.cache_dir.empty()) {
6565
bool device_found = false;
6666
std::vector<std::string> available_devices = OVCore::Get()->GetAvailableDevices();
67+
for (int i = 0 ; i< available_devices.size() ; i++) {
68+
session_context_.available_devices.push_back(available_devices[i]);
69+
}
6770
// Checking for device_type configuration
6871
if (info.device_type != "") {
6972
if (info.device_type.find("HETERO") != std::string::npos ||

0 commit comments

Comments
 (0)