Openvino ep nuget (#9909)

* Changes

*Fixed merge conflicts

Signed-off-by: MaajidKhan <n.maajidkhan@gmail.com>

* C# Nuget fix for windows

-> OpenVINO Libs included in Nuget package
-> Updated nuget.exe path for openvino ep build in Windows
-> Include mvcmd file along with openvino dlls

* Fixing PEP Style comments

* Comment Removed

Co-authored-by: MaajidKhan <n.maajidkhan@gmail.com>
Co-authored-by: saharfraza <sfatima.3001@gmail.com>
This commit is contained in:
sfatimar 2021-12-07 21:18:31 +05:30 committed by GitHub
parent a23cd5b697
commit 5e4d58a50a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 3 deletions

View file

@ -1822,8 +1822,12 @@ def build_nuget_package(source_dir, build_dir, configs, use_cuda, use_openvino,
run_subprocess(cmd_args, cwd=csharp_build_dir)
if is_windows():
# this path is setup by cmake/nuget_helpers.cmake for MSVC on Windows
nuget_exe = os.path.normpath(os.path.join(native_dir, config, "nuget_exe", "src", "nuget.exe"))
if use_openvino:
# user needs to make sure nuget is installed and added to the path variable
nuget_exe = "nuget.exe"
else:
# this path is setup by cmake/nuget_helpers.cmake for MSVC on Windows
nuget_exe = os.path.normpath(os.path.join(native_dir, config, "nuget_exe", "src", "nuget.exe"))
else:
# user needs to make sure nuget is installed and can be found
nuget_exe = "nuget"

View file

@ -33,7 +33,8 @@ def get_package_name(os, cpu_arch, ep):
# Currently we take onnxruntime_providers_cuda from CUDA build
# And onnxruntime, onnxruntime_providers_shared and onnxruntime_providers_tensorrt from tensorrt build
# And onnxruntime, onnxruntime_providers_shared and
# onnxruntime_providers_tensorrt from tensorrt build
def is_this_file_needed(ep, filename):
return (ep != 'cuda' or 'cuda' in filename) and (ep != 'tensorrt' or 'cuda' not in filename)
@ -453,6 +454,7 @@ def generate_files(list, args):
runtimes_target + args.target_architecture + '\\native" />')
if args.execution_provider == "openvino":
openvino_path = get_env_var('INTEL_OPENVINO_DIR')
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path,
nuget_dependencies['providers_shared_lib']) +
runtimes_target + args.target_architecture + '\\native" />')
@ -460,6 +462,29 @@ def generate_files(list, args):
nuget_dependencies['openvino_ep_shared_lib']) +
runtimes_target + args.target_architecture + '\\native" />')
if is_windows():
dll_list_path = os.path.join(openvino_path, 'deployment_tools\\inference_engine\\bin\\intel64\\Release\\')
for dll_element in os.listdir(dll_list_path):
if dll_element.endswith('dll'):
files_list.append('<file src=' + '"' + os.path.join(dll_list_path, dll_element) + runtimes_target +
args.target_architecture + '\\native" />')
ngraph_list_path = os.path.join(openvino_path, 'deployment_tools\\ngraph\\lib\\')
for ngraph_element in os.listdir(ngraph_list_path):
if ngraph_element.endswith('dll'):
files_list.append('<file src=' + '"' + os.path.join(ngraph_list_path, ngraph_element) +
runtimes_target + args.target_architecture + '\\native" />')
# plugins.xml
files_list.append('<file src=' + '"' + os.path.join(dll_list_path, 'plugins.xml') +
runtimes_target + args.target_architecture + '\\native" />')
# usb-ma2x8x.mvcmd
files_list.append('<file src=' + '"' + os.path.join(dll_list_path, 'usb-ma2x8x.mvcmd') +
runtimes_target + args.target_architecture + '\\native" />')
tbb_list_path = os.path.join(openvino_path, 'deployment_tools\\inference_engine\\external\\tbb\\bin\\')
for tbb_element in os.listdir(tbb_list_path):
if tbb_element.endswith('dll'):
files_list.append('<file src=' + '"' + os.path.join(tbb_list_path, tbb_element) +
runtimes_target + args.target_architecture + '\\native" />')
if args.execution_provider == "cuda" or is_cuda_gpu_package and not is_ado_packaging_build:
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path,
nuget_dependencies['providers_shared_lib']) +