From 0bb56a18cf183343fe2aa62dbcf3130fc3308c76 Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Tue, 7 Sep 2021 09:50:09 -0700 Subject: [PATCH] Add TRT header file to ORT GPU nuget package (#8962) --- .../c-api-noopenmp-packaging-pipelines.yml | 6 +++++ .../github/windows/bundle_dlls_gpu_nuget.bat | 27 ------------------- .../bundle_nuget_with_native_headers.bat | 13 +++++++++ 3 files changed, 19 insertions(+), 27 deletions(-) delete mode 100644 tools/ci_build/github/windows/bundle_dlls_gpu_nuget.bat create mode 100644 tools/ci_build/github/windows/bundle_nuget_with_native_headers.bat diff --git a/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml index 670f401ad2..bb495cb21e 100644 --- a/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml @@ -478,6 +478,12 @@ jobs: arguments: '--configuration RelWithDebInfo -t:CreatePackage -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}' workingDirectory: '$(Build.SourcesDirectory)\csharp' + - task: BatchScript@1 + displayName: 'Add TensorRT header file to the native nuGet package' + inputs: + filename: $(Build.SourcesDirectory)\tools\ci_build\github\windows\bundle_nuget_with_native_headers.bat + workingFolder: $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo + - task: CopyFiles@2 displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)' inputs: diff --git a/tools/ci_build/github/windows/bundle_dlls_gpu_nuget.bat b/tools/ci_build/github/windows/bundle_dlls_gpu_nuget.bat deleted file mode 100644 index 8be49bdf98..0000000000 --- a/tools/ci_build/github/windows/bundle_dlls_gpu_nuget.bat +++ /dev/null @@ -1,27 +0,0 @@ -REM Copyright (c) Microsoft Corporation. All rights reserved. -REM Licensed under the MIT License. - -REM for available runtime identifiers, see https://github.com/dotnet/corefx/blob/release/3.1/pkg/Microsoft.NETCore.Platforms/runtime.json -set PATH=%CD%;%PATH% -SETLOCAL EnableDelayedExpansion -FOR /R %%i IN (*.nupkg) do ( - set filename=%%~ni - IF NOT "!filename:~25,7!"=="Managed" ( - mkdir runtimes\linux-x64\native - move onnxruntime-linux-x64-gpu\lib\libonnxruntime_providers_* runtimes\linux-x64\native - move onnxruntime-linux-x64-tensorrt\lib\libonnxruntime.so.1* runtimes\linux-x64\native\libonnxruntime.so - move onnxruntime-linux-x64-tensorrt\lib\libonnxruntime_providers_shared.so runtimes\linux-x64\native\libonnxruntime_providers_shared.so - move onnxruntime-linux-x64-tensorrt\lib\libonnxruntime_providers_tensorrt.so runtimes\linux-x64\native\libonnxruntime_providers_tensorrt.so - mkdir runtimes\win-x64\native - move onnxruntime-win-x64-tensorrt\lib\onnxruntime_providers_tensorrt.dll runtimes\win-x64\native\onnxruntime_providers_tensorrt.dll - move onnxruntime-win-x64-tensorrt\lib\onnxruntime_providers_shared.dll runtimes\win-x64\native\onnxruntime_providers_shared.dll - move onnxruntime-win-x64-tensorrt\lib\onnxruntime.dll runtimes\win-x64\native\onnxruntime.dll - move onnxruntime-win-x64-tensorrt\lib\onnxruntime.lib runtimes\win-x64\native\onnxruntime.lib - move onnxruntime-win-x64-tensorrt\lib\onnxruntime.pdb runtimes\win-x64\native\onnxruntime.pdb - 7z a %%~ni.nupkg runtimes - - mkdir build\native\include - move onnxruntime-linux-x64-tensorrt\include\tensorrt_provider_factory.h build\native\include\tensorrt_provider_factory.h - 7z a %%~ni.nupkg build - ) -) diff --git a/tools/ci_build/github/windows/bundle_nuget_with_native_headers.bat b/tools/ci_build/github/windows/bundle_nuget_with_native_headers.bat new file mode 100644 index 0000000000..01d2633ae2 --- /dev/null +++ b/tools/ci_build/github/windows/bundle_nuget_with_native_headers.bat @@ -0,0 +1,13 @@ +REM Copyright (c) Microsoft Corporation. All rights reserved. +REM Licensed under the MIT License. + +set PATH=%CD%;%PATH% +SETLOCAL EnableDelayedExpansion +FOR /R %%i IN (*.nupkg) do ( + set filename=%%~ni + IF NOT "!filename:~25,7!"=="Managed" ( + mkdir build\native\include + copy %BUILD_SOURCESDIRECTORY%\include\onnxruntime\core\providers\tensorrt\tensorrt_provider_factory.h build\native\include\tensorrt_provider_factory.h + 7z a %%~ni.nupkg build + ) +)