diff --git a/csharp/OnnxRuntime.CSharp.proj b/csharp/OnnxRuntime.CSharp.proj index f3b9a73b3f..9f1a472098 100644 --- a/csharp/OnnxRuntime.CSharp.proj +++ b/csharp/OnnxRuntime.CSharp.proj @@ -16,6 +16,7 @@ CMake creates a target to this project nuget x64 false + false .. @@ -111,7 +112,7 @@ CMake creates a target to this project Properties="NoBuild=true;Platform=AnyCPU;PackageVersion=$(PackageVersion);OrtPackageId=$(OrtPackageId)"/> - + diff --git a/docs/execution_providers/OpenVINO-ExecutionProvider.md b/docs/execution_providers/OpenVINO-ExecutionProvider.md index d59ccea679..c51c5f992b 100644 --- a/docs/execution_providers/OpenVINO-ExecutionProvider.md +++ b/docs/execution_providers/OpenVINO-ExecutionProvider.md @@ -136,4 +136,39 @@ Below topologies from ONNX open model zoo are fully supported on OpenVINO Execut | --- | --- | --- | --- | --- | | tiny_yolov2 | Yes | Yes | Yes | Yes* | -*FPGA only runs in HETERO mode wherein the layers that are not supported on FPGA fall back to OpenVINO CPU. \ No newline at end of file +*FPGA only runs in HETERO mode wherein the layers that are not supported on FPGA fall back to OpenVINO CPU. + +## CSharp API + +To use csharp api for openvino execution provider create a custom nuget package. Two nuget packages will be created +Microsoft.ML.OnnxRuntime.Managed and Microsoft.ML.OnnxRuntime.Openvino. + +1. Windows + +Build a custom nuget package for windows. +``` +.\build.bat --config Debug --build --use_openvino $Device --build_csharp +msbuild csharp\OnnxRuntime.CSharp.proj /p:OrtPackageId=Microsoft.ML.OnnxRuntime.Openvino /p:Configuration=Debug /t:CreatePackage +``` +The msbuild log will show the paths of the nuget packages created. + +2. Linux + +We currently do not have a process to build directly in Linux. But we can +copy shared library /build/Linux//libonnxruntime.so +to onnxruntime source repository in windows and execute the same commands +above to get custom nuget package for linux. Two nuget packages will be +created Microsoft.ML.OnnxRuntime.Managed and Microsoft.ML.OnnxRuntime.Openvino. + +On Linux Machine +``` +./build.sh --config Debug --build_shared_lib --use_openvino $Device +``` + +On Windows Machine +``` +cp libonnxruntime.so onnxruntime/ +.\build.bat --config Debug --build --use_openvino $Device --build_csharp +msbuild csharp\OnnxRuntime.CSharp.proj /p:OrtPackageId=Microsoft.ML.OnnxRuntime.Openvino /p:Configuration=Debug /t:CreatePackage +``` +The msbuild log will show the path of the nuget packages created. diff --git a/onnxruntime/core/providers/openvino/openvino_provider_factory.cc b/onnxruntime/core/providers/openvino/openvino_provider_factory.cc index 843646d126..457bf59063 100644 --- a/onnxruntime/core/providers/openvino/openvino_provider_factory.cc +++ b/onnxruntime/core/providers/openvino/openvino_provider_factory.cc @@ -20,7 +20,7 @@ struct OpenVINOProviderFactory : IExecutionProviderFactory { std::unique_ptr CreateProvider() override; private: - const char* device_; + std::string device_; }; std::unique_ptr OpenVINOProviderFactory::CreateProvider() { diff --git a/tools/nuget/generate_nuspec_for_native_nuget.py b/tools/nuget/generate_nuspec_for_native_nuget.py index 053e765f37..2e63146905 100644 --- a/tools/nuget/generate_nuspec_for_native_nuget.py +++ b/tools/nuget/generate_nuspec_for_native_nuget.py @@ -22,6 +22,9 @@ def parse_arguments(): parser.add_argument("--commit_id", required=True, help="The last commit id included in this package.") parser.add_argument("--is_release_build", required=False, default=None, type=str, help="Flag indicating if the build is a release build. Accepted values: true/false.") + parser.add_argument("--is_linux_build", required=False, default='false', type=str, + help="Flag indicating if we are building a Nuget for Linux. This will look for " + + "`libonnxruntime.so`. Accepted values: true/false.") return parser.parse_args() @@ -160,6 +163,7 @@ def generate_files(list, args): is_cpu_package = args.package_name == 'Microsoft.ML.OnnxRuntime' is_mklml_package = args.package_name == 'Microsoft.ML.OnnxRuntime.MKLML' is_cuda_gpu_package = args.package_name == 'Microsoft.ML.OnnxRuntime.Gpu' + is_openvino_package = args.package_name == 'Microsoft.ML.OnnxRuntime.Openvino' is_dml_package = args.package_name == 'Microsoft.ML.OnnxRuntime.DirectML' is_windowsai_package = args.package_name == 'Microsoft.AI.MachineLearning' @@ -167,6 +171,7 @@ def generate_files(list, args): includes_winml = is_windowsai_package includes_directml = (is_dml_package or is_windowsai_package) and (args.target_architecture == 'x64' or args.target_architecture == 'x86') + includes_openvino = is_openvino_package # Process headers files_list.append('') + if includes_openvino: + files_list.append('') + if includes_directml: files_list.append('') # Process runtimes + # Process linux + if args.is_linux_build.lower() == 'true': + files_list.append('') + # Process onnxruntime import lib, dll, and pdb files_list.append('')