Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# OpenVino EP broken: OrtSessionOptionsAppendExecutionProvider_OpenVINO not exported in onnxruntime.dll #7951

Closed
brantPTS opened this issue Jun 4, 2021 · 2 comments · Fixed by #7980
Assignees
Labels
build build issues; typically submitted using template

Comments

@brantPTS
Copy link

brantPTS commented Jun 4, 2021

Describe the bug
SessionOptions.AppendExecutionProvider_OpenVINO() fails

Urgency
Urgent: blocked from using onnx runtime in our application

System information
Edition Windows 10 Pro
Version 20H2
Installed on ‎3/‎2/‎2021
OS build 19042.985

  • ONNX Runtime installed from : Source
  • ONNX Runtime version:
  • Python version: 3.8
  • Visual Studio version (if applicable): 2019
  • CUDA/cuDNN version:
  • GPU model and memory: nVidia GTX 1080ti

To Reproduce
Build OpenVino as per instructions on Windows:
.\build.bat --config RelWithDebInfo --use_openvino CPU_FP32 --cmake_generator "Visual Studio 16 2019" --build_shared_lib --build_nuget

Dll's build but automated test fails:


[Begin excerpt from build output]

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:08.69] Microsoft.ML.OnnxRuntime.Tests.InferenceTest.TestGpu [SKIP]
Skipped Microsoft.ML.OnnxRuntime.Tests.InferenceTest.TestGpu [1 ms]
Failed Microsoft.ML.OnnxRuntime.Tests.InferenceTest.TestSessionOptions [6 ms]
Error Message:
System.EntryPointNotFoundException : Unable to find an entry point named 'OrtSessionOptionsAppendExecutionProvider_OpenVINO' in DLL 'onnxruntime'.
Stack Trace:
at Microsoft.ML.OnnxRuntime.NativeMethods.OrtSessionOptionsAppendExecutionProvider_OpenVINO(IntPtr options, IntPtr device_id)
at Microsoft.ML.OnnxRuntime.SessionOptions.AppendExecutionProvider_OpenVINO(String deviceId) in D:\Local\OnnxVersions\20210603\onnxruntime\csharp\src\Microsoft.ML.OnnxRuntime\SessionOptions.cs:line 195
at Microsoft.ML.OnnxRuntime.Tests.InferenceTest.TestSessionOptions() in D:\Local\OnnxVersions\20210603\onnxruntime\csharp\test\Microsoft.ML.OnnxRuntime.Tests\InferenceTest.cs:line 116
Failed Microsoft.ML.OnnxRuntime.Tests.InferenceTest.VerifyNativeMethodsExist [2 ms]
Error Message:
Entrypoint OrtSessionOptionsAppendExecutionProvider_OpenVINO not found in module onnxruntime.dll
Expected: False
Actual: True
Stack Trace:
at Microsoft.ML.OnnxRuntime.Tests.InferenceTest.VerifyNativeMethodsExist() in D:\Local\OnnxVersions\20210603\onnxruntime\csharp\test\Microsoft.ML.OnnxRuntime.Tests\InferenceTest.cs:line 2438

Failed! - Failed: 2, Passed: 206, Skipped: 1, Total: 209, Duration: 11 s - Microsoft.ML.OnnxRuntime.Tests.dll (netcoreapp2.1)


Another way to reproduce the same error is to create a c# .net framework console application with the following lines:

SessionOptions ops = new SessionOptions(); ops.AppendExecutionProvider_OpenVINO(openVinoDeviceId);
This will trigger an EntryPointNotFoundException:
"Unable to find an entry point named 'OrtSessionOptionsAppendExecutionProvider_OpenVINO' in DLL 'onnxruntime'."

Inspecting the built onnxruntime.dll with Dependencies.exe reveals the entry point "OrtSessionOptionsAppendExecutionProvider_OpenVINO" is absent:

image

@snnn
Copy link
Member

snnn commented Jun 4, 2021

So, I guess you compiled it from source.

Could you please open cmake/CMakeLists.txt and change

if (onnxruntime_USE_OPENVINO)
    list(APPEND ORT_PROVIDER_FLAGS -DUSE_OPENVINO=1)
    list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_OPENVINO=1)
endif()

to

if (onnxruntime_USE_OPENVINO)
    list(APPEND ORT_PROVIDER_FLAGS -DUSE_OPENVINO=1)
    list(APPEND ONNXRUNTIME_PROVIDER_NAMES openvino)                               #add this line
    list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_OPENVINO=1)
endif()

Then rebuild it. From the build log you should see something like:

         Generating symbol file for ['cpu', 'openvino']

Let me if the patch will fix the issue.

@snnn snnn self-assigned this Jun 4, 2021
@snnn snnn added build build issues; typically submitted using template type:bug labels Jun 4, 2021
@brantPTS
Copy link
Author

brantPTS commented Jun 7, 2021

@snnn , I really appreciate your your prompt response - this fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants