From 0d3bbfdd0f0ddb38eea799a52fcd2dd66513e5b7 Mon Sep 17 00:00:00 2001 From: Ashwini Khade Date: Wed, 26 Aug 2020 12:33:48 -0700 Subject: [PATCH] enable nuget packaging in local builds (#4884) * enable building nuget packages * add nuget creation from build.py * add documentation * fix flake8 errors * fix nuget package version * enable csharp tests * update csharp tests * copy nuget packges to nuget-artifacts * add libmklml_gnu * plus review updates * fix references for release builds --- BUILD.md | 3 +- csharp/OnnxRuntime.CSharp.proj | 24 ++- ...soft.ML.OnnxRuntime.InferenceSample.csproj | 35 +++- .../Microsoft.ML.OnnxRuntime.csproj | 34 +++- ...rosoft.ML.OnnxRuntime.EndToEndTests.csproj | 26 ++- .../Microsoft.ML.OnnxRuntime.Tests.csproj | 22 ++- .../Microsoft.ML.OnnxRuntime.PerfTool.csproj | 27 ++- tools/ci_build/build.py | 121 +++++++++++- .../nuget/generate_nuspec_for_native_nuget.py | 173 +++++++++++++----- 9 files changed, 393 insertions(+), 72 deletions(-) diff --git a/BUILD.md b/BUILD.md index 7122e3e6ae..cb17fd548a 100644 --- a/BUILD.md +++ b/BUILD.md @@ -124,7 +124,8 @@ GCC 4.x and below are not supported. |API|Command|Additional details| |-----------|-----------|-----------| |**Python**|--build_wheel|| -|**C# and C packages**|--build_csharp|| +|**C# and C packages**|--build_nuget|Builds C# bindings and creates nuget package. Currently supported on Windows and Linux only. Implies `--build_shared_lib`
+Requires [dotnet](https://dotnet.microsoft.com/download) for building csharp bindings and [nuget.exe](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools#nugetexe-cli) for creating nuget package.| |**WindowsML**|--use_winml
--use_dml
--build_shared_lib|WindowsML depends on DirectML and the OnnxRuntime shared library| |**Java**|--build_java|Creates an onnxruntime4j.jar in the build directory, implies `--build_shared_lib`
Compiling the Java API requires [gradle](https://gradle.org) v6.1+ to be installed in addition to the usual requirements.| |**Node.js**|--build_nodejs|Build Node.js binding. Implies `--build_shared_lib`| diff --git a/csharp/OnnxRuntime.CSharp.proj b/csharp/OnnxRuntime.CSharp.proj index 9f1a472098..f65c9d1445 100644 --- a/csharp/OnnxRuntime.CSharp.proj +++ b/csharp/OnnxRuntime.CSharp.proj @@ -17,14 +17,27 @@ CMake creates a target to this project x64 false false + None .. + ..\tools\nuget\generate_nuspec_for_native_nuget.py + + + + + ..\build\Linux + $(OnnxRuntimeBuildDirectory)\packages + $(OnnxRuntimeBuildDirectory)\$(Configuration) + + + + ..\build\Windows $(OnnxRuntimeBuildDirectory)\packages $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) - + @@ -110,9 +123,9 @@ CMake creates a target to this project - + - + @@ -120,6 +133,11 @@ CMake creates a target to this project + + diff --git a/csharp/sample/Microsoft.ML.OnnxRuntime.InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.csproj b/csharp/sample/Microsoft.ML.OnnxRuntime.InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.csproj index 688c1d719a..c160dc4c40 100644 --- a/csharp/sample/Microsoft.ML.OnnxRuntime.InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.csproj +++ b/csharp/sample/Microsoft.ML.OnnxRuntime.InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.csproj @@ -5,17 +5,32 @@ netcoreapp2.1 AnyCPU;x86 ..\.. - $(OnnxRuntimeCsharpRoot)\..\build\Windows - $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) Debug;Release;RelWithDebInfo + false + + + + + $(OnnxRuntimeCsharpRoot)\..\build\Linux + $(OnnxRuntimeBuildDirectory)\$(Configuration) + + + + + $(OnnxRuntimeCsharpRoot)\..\build\Windows + $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) - + Always false - + + Always + false + + Always false @@ -23,10 +38,22 @@ Always false + + Always + false + Always false + + Always + false + + + Always + false + Always false diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj index 2d1c3b2345..cf650200d0 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj +++ b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj @@ -12,8 +12,6 @@ ..\..\.. $(OnnxRuntimeRoot)\csharp - $(OnnxRuntimeCsharpRoot)\..\build\Windows - $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) x64 @@ -45,6 +43,18 @@ Debug;Release;RelWithDebInfo + + + $(OnnxRuntimeCsharpRoot)\..\build\Linux + $(OnnxRuntimeBuildDirectory)\$(Configuration) + + + + + $(OnnxRuntimeCsharpRoot)\..\build\Windows + $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) + + @@ -75,13 +85,22 @@ CopyToOutputDirectory="Never" Visible="false" /> + - + + + + - - + \ No newline at end of file diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj index bc9098e8a8..b9222c2dd6 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj +++ b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj @@ -5,12 +5,22 @@ $(MSBuildThisFileDirectory)..\.. AnyCPU bin\$(Configuration)\ - $(OnnxRuntimeCsharpRoot)\..\build\Windows - $(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake\$(Configuration) - $(OnnxRuntimeCsharpRoot)\..\cmake\external\onnx\onnx - $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) Microsoft.ML.OnnxRuntime + false + + + + $(OnnxRuntimeCsharpRoot)\..\build\Linux + $(OnnxRuntimeBuildDirectory)\$(Configuration) + + + + + $(OnnxRuntimeCsharpRoot)\..\build\Windows + $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) + + @@ -22,10 +32,16 @@ + Always false + + + Always + false + Always false @@ -37,7 +53,7 @@ Always false - + Always false diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/Microsoft.ML.OnnxRuntime.Tests.csproj b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/Microsoft.ML.OnnxRuntime.Tests.csproj index 673e5600fb..abdaae0209 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/Microsoft.ML.OnnxRuntime.Tests.csproj +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/Microsoft.ML.OnnxRuntime.Tests.csproj @@ -6,10 +6,8 @@ ..\.. AnyCPU;x86 bin\$(Configuration)\ - $(OnnxRuntimeCsharpRoot)\..\build\Windows - $(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake\$(Configuration) + false $(OnnxRuntimeCsharpRoot)\..\onnxruntime\core\protobuf - $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) 7.2 @@ -21,6 +19,22 @@ + + + $(OnnxRuntimeCsharpRoot)\..\build\Linux + $(OnnxRuntimeBuildDirectory)\$(Configuration) + $(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake + $(ProtocDirectory)\protoc + + + + + $(OnnxRuntimeCsharpRoot)\..\build\Windows + $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) + $(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake\$(Configuration) + $(ProtocDirectory)\protoc.exe + + True @@ -59,7 +73,7 @@ - + diff --git a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj index 00e98cd960..80c2a42728 100644 --- a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj +++ b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj @@ -5,18 +5,33 @@ AnyCPU;x86 netcoreapp2.1 ..\.. - $(OnnxRuntimeCsharpRoot)\..\build\Windows - $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) false Debug;Release;RelWithDebInfo + false + + + + + $(OnnxRuntimeCsharpRoot)\..\build\Linux + $(OnnxRuntimeBuildDirectory)\$(Configuration) + + + + + $(OnnxRuntimeCsharpRoot)\..\build\Windows + $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) - + Always false - + + Always + false + + Always false @@ -24,6 +39,10 @@ Always false + + Always + false + Always false diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index d18e0eab7f..a17da8d269 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -149,7 +149,13 @@ def parse_arguments(): # C-Sharp bindings parser.add_argument( "--build_csharp", action='store_true', - help="Build C#.Net DLL and NuGet package") + help="Build C#.Net DLL and NuGet package. This should be only used in CI pipelines. " + "For building C# bindings and packaging them into nuget package use --build_nuget arg.") + + parser.add_argument( + "--build_nuget", action='store_true', + help="Build C#.Net DLL and NuGet package on the local machine. " + "Currently only Windows and Linux platforms are supported.") # Java bindings parser.add_argument( @@ -375,6 +381,10 @@ def is_macOS(): return sys.platform.startswith("darwin") +def is_linux(): + return sys.platform.startswith("linux") + + def get_linux_distro(): try: with open('/etc/os-release', 'r') as f: @@ -1388,6 +1398,93 @@ def build_python_wheel( run_subprocess(args, cwd=cwd) +def derive_linux_build_property(): + if is_windows(): + return "/p:IsLinuxBuild=\"false\"" + else: + return "/p:IsLinuxBuild=\"true\"" + + +def build_nuget_package(configs, use_cuda, use_openvino, use_tensorrt, use_dnnl, use_mklml): + if not (is_windows() or is_linux()): + raise BuildError( + 'Currently csharp builds and nuget package creation is only supportted ' + 'on Windows and Linux platforms.') + + build_dir = os.path.join(os.getcwd(), 'csharp') + is_linux_build = derive_linux_build_property() + + # derive package name and execution provider based on the build args + execution_provider = "/p:ExecutionProvider=\"None\"" + package_name = "/p:OrtPackageId=\"Microsoft.ML.OnnxRuntime\"" + if use_openvino: + execution_provider = "/p:ExecutionProvider=\"openvino\"" + package_name = "/p:OrtPackageId=\"Microsoft.ML.OnnxRuntime.OpenVino\"" + elif use_tensorrt: + execution_provider = "/p:ExecutionProvider=\"tensorrt\"" + package_name = "/p:OrtPackageId=\"Microsoft.ML.OnnxRuntime.TensorRT\"" + elif use_dnnl: + execution_provider = "/p:ExecutionProvider=\"dnnl\"" + package_name = "/p:OrtPackageId=\"Microsoft.ML.OnnxRuntime.DNNL\"" + elif use_cuda: + package_name = "/p:OrtPackageId=\"Microsoft.ML.OnnxRuntime.Gpu\"" + elif use_mklml: + package_name = "/p:OrtPackageId=\"Microsoft.ML.OnnxRuntime.MKLML\"" + else: + pass + + # dotnet restore + cmd_args = ["dotnet", "restore", "OnnxRuntime.CSharp.sln", "--configfile", "Nuget.CSharp.config"] + run_subprocess(cmd_args, cwd=build_dir) + + # build csharp bindings and create nuget package for each config + for config in configs: + if is_linux(): + native_build_dir = os.path.join(os.getcwd(), 'build//Linux//', config) + cmd_args = ["make", "install", "DESTDIR=.//nuget-staging"] + run_subprocess(cmd_args, cwd=native_build_dir) + + configuration = "/p:Configuration=\"" + config + "\"" + + cmd_args = ["dotnet", "msbuild", "OnnxRuntime.CSharp.sln", configuration, package_name, is_linux_build] + run_subprocess(cmd_args, cwd=build_dir) + + cmd_args = [ + "dotnet", "msbuild", "OnnxRuntime.CSharp.proj", "/t:CreatePackage", + package_name, configuration, execution_provider, is_linux_build] + run_subprocess(cmd_args, cwd=build_dir) + + +def run_csharp_tests(use_cuda, use_openvino, use_tensorrt, use_dnnl): + # Currently only running tests on windows. + if not is_windows(): + return + build_dir = os.path.join(os.getcwd(), 'csharp') + is_linux_build = derive_linux_build_property() + + # define macros based on build args + macros = "" + if use_openvino: + macros += "USE_OPENVINO;" + if use_tensorrt: + macros += "USE_TENSORRT;" + if use_dnnl: + macros += "USE_DNNL;" + if use_cuda: + macros += "USE_CUDA;" + + define_constants = "" + if macros != "": + define_constants = "/p:DefineConstants=\"" + macros + "\"" + + # Skip pretrained models test. Only run unit tests as part of the build + # "/property:DefineConstants=\"USE_CUDA;USE_OPENVINO\"", + cmd_args = ["dotnet", "test", "test\\Microsoft.ML.OnnxRuntime.Tests\\Microsoft.ML.OnnxRuntime.Tests.csproj", + "--filter", "FullyQualifiedName!=Microsoft.ML.OnnxRuntime.Tests.InferenceTest.TestPreTrainedModels", + is_linux_build, define_constants, "--verbosity", "detailed"] + run_subprocess(cmd_args, cwd=build_dir) + + def build_protoc_for_host(cmake_path, source_dir, build_dir, args): if (args.arm or args.arm64) and (not is_windows() and not args.ios): raise BuildError( @@ -1531,9 +1628,13 @@ def main(): if args.build_wheel or args.gen_doc: args.enable_pybind = True - if args.build_csharp or args.build_java or args.build_nodejs: + if args.build_csharp or args.build_nuget or args.build_java or args.build_nodejs: args.build_shared_lib = True + if args.build_nuget and cross_compiling: + raise BuildError( + 'Currently nuget package creation is not supported while cross-compiling') + # Disabling unit tests for VAD-F as FPGA only supports # models with NCHW layout if args.use_openvino == "VAD-F_FP32": @@ -1695,6 +1796,22 @@ def main(): featurizers_build=args.use_featurizers, use_ninja=(args.cmake_generator == 'Ninja') ) + if args.build_nuget: + build_nuget_package( + configs, + args.use_cuda, + args.use_openvino, + args.use_tensorrt, + args.use_dnnl, + args.use_mklml + ) + + if args.test and args.build_nuget: + run_csharp_tests( + args.use_cuda, + args.use_openvino, + args.use_tensorrt, + args.use_dnnl) if args.gen_doc and (args.build or args.test): generate_documentation(source_dir, build_dir, configs) diff --git a/tools/nuget/generate_nuspec_for_native_nuget.py b/tools/nuget/generate_nuspec_for_native_nuget.py index 2e63146905..b9b667618f 100644 --- a/tools/nuget/generate_nuspec_for_native_nuget.py +++ b/tools/nuget/generate_nuspec_for_native_nuget.py @@ -22,9 +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.") + parser.add_argument("--execution_provider", required=False, default='None', type=str, + choices=['dnnl', 'openvino', 'tensorrt', 'None'], + help="The selected execution provider for this build.") return parser.parse_args() @@ -163,7 +163,6 @@ 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' @@ -171,7 +170,38 @@ 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 + + is_windows_build = is_windows() + + nuget_dependencies = {} + + if is_windows_build: + nuget_dependencies = {'mklml': 'mklml.dll', + 'openmp': 'libiomp5md.dll', + 'dnnl': 'dnnl.dll', + 'tvm': 'tvm.dll', + 'providers_shared_lib': 'onnxruntime_providers_shared.dll', + 'dnnl_ep_shared_lib': 'onnxruntime_providers_dnnl.dll', + 'tensorrt_ep_shared_lib': 'onnxruntime_providers_tensorrt.dll', + 'onnxruntime_perf_test': 'onnxruntime_perf_test.exe', + 'onnx_test_runner': 'onnx_test_runner.exe'} + + copy_command = "copy" + runtimes_target = '" target="runtimes\\win-' + else: + nuget_dependencies = {'mklml': 'libmklml_intel.so', + 'mklml_1': 'libmklml_gnu.so', + 'openmp': 'libiomp5.so', + 'dnnl': 'libdnnl.so.1', + 'tvm': 'libtvm.so.0.5.1', + 'providers_shared_lib': 'libonnxruntime_providers_shared.so', + 'dnnl_ep_shared_lib': 'libonnxruntime_providers_dnnl.so', + 'tensorrt_ep_shared_lib': 'libonnxruntime_providers_tensorrt.so', + 'onnxruntime_perf_test': 'onnxruntime_perf_test', + 'onnx_test_runner': 'onnx_test_runner'} + + copy_command = "cp" + runtimes_target = '" target="runtimes\\linux-' # Process headers files_list.append('') - if includes_openvino: + if args.execution_provider == 'openvino': files_list.append('') + if args.execution_provider == 'tensorrt': + files_list.append('') + + if args.execution_provider == 'dnnl': + 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('') - files_list.append('') - files_list.append('') + if is_windows_build: + files_list.append('') + files_list.append('') + if os.path.exists(os.path.join(args.native_build_path, 'onnxruntime.pdb')): + files_list.append('') + else: + files_list.append('') if includes_directml: files_list.append('') + # Process execution providers which are built as shared libs + if args.execution_provider == "tensorrt": + files_list.append('') + files_list.append('') + if args.execution_provider == "dnnl": + files_list.append('') + files_list.append('') + + # process all other library dependencies if is_cpu_package or is_cuda_gpu_package or is_dml_package or is_mklml_package: - # Process dnll.dll - if os.path.exists(os.path.join(args.native_build_path, 'dnnl.dll')): - files_list.append('') + # Process dnnl dependency + if os.path.exists(os.path.join(args.native_build_path, nuget_dependencies['dnnl'])): + files_list.append('') - # Process mklml.dll - if os.path.exists(os.path.join(args.native_build_path, 'mklml.dll')): - files_list.append('') + # Process mklml dependency + if os.path.exists(os.path.join(args.native_build_path, nuget_dependencies['mklml'])): + files_list.append('') - # Process libiomp5md.dll - if os.path.exists(os.path.join(args.native_build_path, 'libiomp5md.dll')): - files_list.append('') + if is_linux() and os.path.exists(os.path.join(args.native_build_path, nuget_dependencies['mklml_1'])): + files_list.append('') - # Process tvm.dll - if os.path.exists(os.path.join(args.native_build_path, 'tvm.dll')): - files_list.append('') + # Process libiomp5md dependency + if os.path.exists(os.path.join(args.native_build_path, nuget_dependencies['openmp'])): + files_list.append('') + + # Process tvm dependency + if os.path.exists(os.path.join(args.native_build_path, nuget_dependencies['tvm'])): + files_list.append('') # Some tools to be packaged in nightly build only, should not be released # These are copied to the runtimes folder for convenience of loading with the dlls if args.is_release_build.lower() != 'true' and args.target_architecture == 'x64' and \ - os.path.exists(os.path.join(args.native_build_path, 'onnxruntime_perf_test.exe')): - files_list.append('') + os.path.exists(os.path.join(args.native_build_path, nuget_dependencies['onnxruntime_perf_test'])): + files_list.append('') if args.is_release_build.lower() != 'true' and args.target_architecture == 'x64' and \ - os.path.exists(os.path.join(args.native_build_path, 'onnx_test_runner.exe')): - files_list.append('') + os.path.exists(os.path.join(args.native_build_path, nuget_dependencies['onnx_test_runner'])): + files_list.append('') # Process props and targets files if is_windowsai_package: @@ -322,7 +388,7 @@ def generate_files(list, args): source_props = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'props.xml') target_props = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', args.package_name + '.props') - os.system('copy ' + source_props + ' ' + target_props) + os.system(copy_command + ' ' + source_props + ' ' + target_props) files_list.append('') files_list.append('') @@ -330,7 +396,7 @@ def generate_files(list, args): source_targets = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'targets.xml') target_targets = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', args.package_name + '.targets') - os.system('copy ' + source_targets + ' ' + target_targets) + os.system(copy_command + ' ' + source_targets + ' ' + target_targets) files_list.append('') files_list.append('') @@ -361,12 +427,31 @@ def is_windows(): return sys.platform.startswith("win") -def main(): - if not is_windows(): - raise Exception('Native Nuget generation is currently supported only on Windows') +def is_linux(): + return sys.platform.startswith("linux") + +def validate_platform(): + if not(is_windows() or is_linux()): + raise Exception('Native Nuget generation is currently supported only on Windows and Linux') + + +def validate_execution_provider(execution_provider): + if is_linux(): + if not (execution_provider == 'None' or execution_provider == 'dnnl' + or execution_provider == 'tensorrt' or execution_provider == 'openvino'): + raise Exception('On Linux platform nuget generation is supported only ' + 'for cpu|cuda|dnnl|tensorrt|openvino execution providers.') + + +def main(): # Parse arguments args = parse_arguments() + + validate_platform() + + validate_execution_provider(args.execution_provider) + if (args.is_release_build.lower() != 'true' and args.is_release_build.lower() != 'false'): raise Exception('Only valid options for IsReleaseBuild are: true and false')