@@ -64,8 +64,33 @@ struct OpenVINO_Provider : Provider {
6464
6565 std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory (const void * void_params) override {
6666 auto & params = *reinterpret_cast <const OrtOpenVINOProviderOptions*>(void_params);
67+ std::string device_type = params.device_type ;
68+ int num_of_threads = 1 ;
69+ std::set<std::string> ov_supported_device_types = {" CPU_FP32" , " CPU_FP16" , " GPU_FP32" ,
70+ " GPU.0_FP32" , " GPU.1_FP32" , " GPU_FP16" ,
71+ " GPU.0_FP16" , " GPU.1_FP16" ,
72+ " NPU_FP16" , " NPU_U8" };
73+
74+ if (!((ov_supported_device_types.find (device_type) != ov_supported_device_types.end ()) ||
75+ (device_type.find (" HETERO:" ) == 0 ) || (device_type.find (" MULTI:" ) == 0 ) || (device_type.find (" AUTO:" ) == 0 ))) {
76+ LOGS_DEFAULT (ERROR) <<
77+ " [ERROR] [OpenVINO] You have selcted wrong configuration value for the key 'device_type'.\n "
78+ " Select from 'CPU_FP32', 'CPU_FP16', 'GPU_FP32', 'GPU.0_FP32', 'GPU.1_FP32', 'GPU_FP16', "
79+ " 'GPU.0_FP16', 'GPU.1_FP16', 'NPU_FP16', 'NPU_U8' or from"
80+ " HETERO/MULTI/AUTO options available. \n " ;
81+ }
82+
83+ num_of_threads = params.num_of_threads ;
84+ if (num_of_threads <= 0 ) {
85+ num_of_threads = 1 ;
86+ LOGS_DEFAULT (WARNING) << " [OpenVINO-EP] The value for the key 'num_threads' should be in the positive range.\n "
87+ << " Executing with num_threads=1" ;
88+ }
89+
90+
91+
6792 return std::make_shared<OpenVINOProviderFactory>(params.device_type , params.enable_vpu_fast_compile ,
68- params.device_id , params. num_of_threads ,
93+ params.device_id , num_of_threads,
6994 params.cache_dir ,
7095 params.context , params.enable_opencl_throttling ,
7196 params.enable_dynamic_shapes );
0 commit comments