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 8828a458db..b745497b19 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 @@ -60,7 +60,7 @@ jobs: parameters: arch: 'linux-x64' buildConfig: 'Release' - artifactName: 'onnxruntime-java-linux-gpu-x64' + artifactName: 'onnxruntime-java-linux-x64-cuda' version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' @@ -68,8 +68,8 @@ jobs: - template: templates/c-api-artifacts-package-and-publish-steps-posix.yml parameters: buildConfig: 'Release' - artifactName: 'onnxruntime-linux-x64-gpu-$(OnnxRuntimeVersion)' - artifactNameNoVersionString: 'onnxruntime-linux-x64-gpu' + artifactName: 'onnxruntime-linux-x64-cuda-$(OnnxRuntimeVersion)' + artifactNameNoVersionString: 'onnxruntime-linux-x64-cuda' libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) @@ -79,6 +79,11 @@ jobs: - template: templates/clean-agent-build-directory-step.yml - template: linux-gpu-tensorrt-packaging-pipeline.yml + parameters: + artifactName: 'onnxruntime-linux-x64-tensorrt-$(OnnxRuntimeVersion)' + artifactNameNoVersionString: 'onnxruntime-linux-x64-tensorrt' + buildJava: true + buildJavaOption: '--build_java' - template: templates/win-ci.yml parameters: @@ -89,7 +94,7 @@ jobs: EnvSetupScript: setup_env_gpu.bat buildArch: x64 msbuildPlatform: x64 - packageName: gpu-x64 + packageName: x64-cuda buildparameter: --use_cuda --cuda_version=11.1 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1" --cudnn_home="C:\local\cudnn-11.4-windows-x64-v8.2.2.26\cuda" --enable_onnx_tests --enable_wcos --build_java --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=37;52;60;61;70;75;80" runTests: ${{ parameters.RunOnnxRuntimeTests }} buildJava: true @@ -104,7 +109,7 @@ jobs: EnvSetupScript: setup_env_gpu.bat buildArch: x64 msbuildPlatform: x64 - packageName: tensorrt-x64 + packageName: x64-tensorrt buildparameter: --use_tensorrt --tensorrt_home="C:\local\TensorRT-8.0.1.6.Windows10.x86_64.cuda-11.3.cudnn8.2" --cuda_version=11.1 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1" --cudnn_home="C:\local\cudnn-11.4-windows-x64-v8.2.2.26\cuda" --enable_onnx_tests --enable_wcos --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=37;52;60;61;70;75;80" runTests: ${{ parameters.RunOnnxRuntimeTests }} buildJava: false @@ -130,16 +135,23 @@ jobs: displayName: 'Download Pipeline Artifact - Win x64' inputs: buildType: 'current' - artifactName: 'drop-onnxruntime-java-win-gpu-x64' + artifactName: 'drop-onnxruntime-java-win-x64-cuda' targetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64' - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - Linux x64' inputs: buildType: 'current' - artifactName: 'drop-onnxruntime-java-linux-gpu-x64' + artifactName: 'drop-onnxruntime-java-linux-x64-cuda' targetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64' + - task: DownloadPipelineArtifact@2 + displayName: 'Download Pipeline Artifact - Linux x64' + inputs: + buildType: 'current' + artifactName: 'drop-onnxruntime-java-linux-x64-tensorrt' + targetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64-tensorrt' + - task: PowerShell@2 displayName: 'PowerShell Script' inputs: @@ -149,8 +161,6 @@ jobs: showWarnings: true workingDirectory: '$(Build.BinariesDirectory)\java-artifact' - - - task: CopyFiles@2 displayName: 'Copy Java Files to Artifact Staging Directory' inputs: @@ -252,7 +262,103 @@ jobs: displayName: 'Clean Agent Directories' condition: always() +- job: Linux_Packaging_combined_GPU + workspace: + clean: all + pool: 'Onnxruntime-Linux-GPU' + dependsOn: + - Linux_C_API_Packaging_GPU_x64 + - Linux_C_API_Packaging_GPU_TensorRT_x64 + condition: succeeded() + steps: + - checkout: self + submodules: false + - template: templates/set-version-number-variables-step.yml + - task: DownloadPipelineArtifact@2 + displayName: 'Download Pipeline Artifact - Combined GPU' + inputs: + artifactName: 'onnxruntime-linux-x64-cuda' + targetPath: '$(Build.BinariesDirectory)/tgz-artifacts' + - task: DownloadPipelineArtifact@2 + displayName: 'Download Pipeline Artifact - Combined GPU' + inputs: + artifactName: 'onnxruntime-linux-x64-tensorrt' + targetPath: '$(Build.BinariesDirectory)/tgz-artifacts' + + - task: ShellScript@2 + displayName: 'Shell Script' + inputs: + scriptPath: 'tools/ci_build/github/linux/extract_and_bundle_gpu_package.sh' + args: '-a $(Build.BinariesDirectory)/tgz-artifacts' + workingDirectory: '$(Build.BinariesDirectory)/tgz-artifacts' + + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: '$(Build.BinariesDirectory)/tgz-artifacts/onnxruntime-linux-x64-gpu' + includeRootFolder: true + archiveType: 'tar' # Options: zip, 7z, tar, wim + tarCompression: 'gz' + archiveFile: '$(Build.ArtifactStagingDirectory)/onnxruntime-linux-x64-gpu-$(OnnxRuntimeVersion).tgz' + replaceExistingArchive: true + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)/onnxruntime-linux-x64-gpu-$(OnnxRuntimeVersion).tgz' + artifactName: 'onnxruntime-linux-x64-gpu' + +- job: Windows_Packaging_combined_GPU + workspace: + clean: all + pool: 'Win-CPU-2021' + dependsOn: + - Windows_Packaging_gpu + - Windows_Packaging_tensorrt + condition: succeeded() + steps: + - checkout: self + submodules: false + - task: DownloadPipelineArtifact@2 + displayName: 'Download Pipeline Artifact - Combined GPU' + inputs: + artifactName: 'onnxruntime-win-x64-cuda' + targetPath: '$(Build.BinariesDirectory)/zip-artifacts' + + - task: DownloadPipelineArtifact@2 + displayName: 'Download Pipeline Artifact - Combined GPU' + inputs: + artifactName: 'onnxruntime-win-x64-tensorrt' + targetPath: '$(Build.BinariesDirectory)/zip-artifacts' + + - task: PowerShell@2 + displayName: 'PowerShell Script' + inputs: + targetType: filePath + filePath: $(Build.SourcesDirectory)\tools\ci_build\github\windows\extract_zip_files_gpu.ps1 + + - script: | + dir + workingDirectory: '$(Build.BinariesDirectory)/zip-artifacts' + displayName: 'List artifacts' + + - task: BatchScript@1 + displayName: 'Bundle CUDA/TRT EP binaries' + inputs: + filename: $(Build.SourcesDirectory)\tools\ci_build\github\windows\bundle_dlls_gpu.bat + workingFolder: $(Build.BinariesDirectory)\zip-artifacts + + - task: CopyFiles@2 + displayName: 'Copy zip file to: $(Build.ArtifactStagingDirectory)' + inputs: + SourceFolder: '$(Build.BinariesDirectory)\zip-artifacts' + Contents: 'onnxruntime-win-x64-gpu-*.zip' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + + - task: PublishPipelineArtifact@0 + displayName: 'Publish Pipeline Combined GPU Package Artifact' + inputs: + artifactName: 'onnxruntime-win-x64-gpu' + targetPath: '$(Build.ArtifactStagingDirectory)' - job: NuGet_Packaging_GPU workspace: @@ -272,25 +378,25 @@ jobs: - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - NuGet' inputs: - artifactName: 'onnxruntime-win-gpu-x64' + artifactName: 'onnxruntime-win-x64-cuda' targetPath: '$(Build.BinariesDirectory)/nuget-artifact' - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - NuGet' inputs: - artifactName: 'onnxruntime-win-tensorrt-x64' + artifactName: 'onnxruntime-win-x64-tensorrt' targetPath: '$(Build.BinariesDirectory)/nuget-artifact' - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - NuGet' inputs: - artifactName: 'onnxruntime-linux-x64-gpu' + artifactName: 'onnxruntime-linux-x64-cuda' targetPath: '$(Build.BinariesDirectory)/nuget-artifact' - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - NuGet' inputs: - artifactName: 'onnxruntime-linux-x64-gpu-tensorrt' + artifactName: 'onnxruntime-linux-x64-tensorrt' targetPath: '$(Build.BinariesDirectory)/nuget-artifact' - task: DownloadPipelineArtifact@2 @@ -357,7 +463,7 @@ jobs: - task: BatchScript@1 displayName: 'Bundle Native NuGet and other binaries' inputs: - filename: $(Build.SourcesDirectory)\tools\ci_build\github\windows\bundle_dlls_gpu.bat + filename: $(Build.SourcesDirectory)\tools\ci_build\github\windows\bundle_dlls_gpu_nuget.bat workingFolder: $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts - task: CopyFiles@2 diff --git a/tools/ci_build/github/azure-pipelines/linux-gpu-tensorrt-packaging-pipeline.yml b/tools/ci_build/github/azure-pipelines/linux-gpu-tensorrt-packaging-pipeline.yml index 72685fb12d..e3c58d3f35 100644 --- a/tools/ci_build/github/azure-pipelines/linux-gpu-tensorrt-packaging-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/linux-gpu-tensorrt-packaging-pipeline.yml @@ -1,3 +1,20 @@ +parameters: +- name: artifactName + type: string + default: 'onnxruntime-linux-x64-gpu-tensorrt-$(OnnxRuntimeVersion)' + +- name: artifactNameNoVersionString + type: string + default: 'onnxruntime-linux-x64-gpu-tensorrt' + +- name: buildJava + type: boolean + default: false + +- name: buildJavaOption + type: string + default: '' + jobs: - job: Linux_C_API_Packaging_GPU_TensorRT_x64 @@ -22,14 +39,24 @@ jobs: docker run --gpus all -e CC=/opt/rh/devtoolset-10/root/usr/bin/cc -e CXX=/opt/rh/devtoolset-10/root/usr/bin/c++ -e CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection -O3 -Wl,--strip-all" -e CXXFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection -O3 -Wl,--strip-all" -e NVIDIA_VISIBLE_DEVICES=all --rm --volume /data/onnx:/data/onnx:ro --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build \ --volume /data/models:/build/models:ro --volume $HOME/.onnx:/home/onnxruntimedev/.onnx -e NIGHTLY_BUILD onnxruntimecuda114xtrt80build \ /opt/python/cp37-cp37m/bin/python3 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release \ - --skip_submodule_sync --parallel --build_shared_lib --use_tensorrt --cuda_version=$(CUDA_VERSION) --cuda_home=/usr/local/cuda-$(CUDA_VERSION) --cudnn_home=/usr --tensorrt_home=/usr --cmake_extra_defines CMAKE_CUDA_HOST_COMPILER=/opt/rh/devtoolset-10/root/usr/bin/cc 'CMAKE_CUDA_ARCHITECTURES=37;50;52;60;61;70;75;80' + --skip_submodule_sync --parallel --build_shared_lib ${{ parameters.buildJavaOption }} --use_tensorrt --cuda_version=$(CUDA_VERSION) --cuda_home=/usr/local/cuda-$(CUDA_VERSION) --cudnn_home=/usr --tensorrt_home=/usr --cmake_extra_defines CMAKE_CUDA_HOST_COMPILER=/opt/rh/devtoolset-10/root/usr/bin/cc 'CMAKE_CUDA_ARCHITECTURES=37;50;52;60;61;70;75;80' workingDirectory: $(Build.SourcesDirectory) + - ${{ if eq(parameters.buildJava, true) }}: + - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml + parameters: + arch: 'linux-x64' + buildConfig: 'Release' + artifactName: 'onnxruntime-java-linux-x64-tensorrt' + version: '$(OnnxRuntimeVersion)' + libraryName: 'libonnxruntime.so' + nativeLibraryName: 'libonnxruntime4j_jni.so' + - template: templates/c-api-artifacts-package-and-publish-steps-posix.yml parameters: buildConfig: 'Release' - artifactName: 'onnxruntime-linux-x64-gpu-tensorrt-$(OnnxRuntimeVersion)' - artifactNameNoVersionString: 'onnxruntime-linux-x64-gpu-tensorrt' + artifactName: ${{ parameters.artifactName }} + artifactNameNoVersionString: ${{ parameters.artifactNameNoVersionString }} libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) diff --git a/tools/ci_build/github/azure-pipelines/templates/c-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/c-api-artifacts-package-and-publish-steps-windows.yml index a8e92eb7f7..7fafee72eb 100644 --- a/tools/ci_build/github/azure-pipelines/templates/c-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/c-api-artifacts-package-and-publish-steps-windows.yml @@ -48,6 +48,11 @@ steps: copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime_providers_cuda.pdb $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime_providers_cuda.lib $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + # copy trt ep libraries only when trt ep is enabled + copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime_providers_tensorrt.dll $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime_providers_tensorrt.pdb $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime_providers_tensorrt.lib $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime.pdb $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime.lib $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib copy $(Build.SourcesDirectory)\include\onnxruntime\core\session\onnxruntime_*.h $(Build.BinariesDirectory)\${{parameters.artifactName}}\include @@ -64,20 +69,6 @@ steps: workingDirectory: '$(Build.BinariesDirectory)\${{parameters.buildConfig}}' - - task: CmdLine@2 - displayName: 'Copy TensorRT EP build artifacts for zipping' - condition: and(succeeded(), eq('${{ parameters.trtEnabled}}', true)) - inputs: - script: | - mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}} - mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib - mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\include - - copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime_providers_tensorrt.dll $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib - copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime.dll $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib - copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime.pdb $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib - copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime.lib $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib - - template: win-esrp-dll.yml parameters: FolderPath: '$(Build.BinariesDirectory)\${{parameters.artifactName}}' diff --git a/tools/ci_build/github/linux/extract_and_bundle_gpu_package.sh b/tools/ci_build/github/linux/extract_and_bundle_gpu_package.sh new file mode 100755 index 0000000000..e4597f549f --- /dev/null +++ b/tools/ci_build/github/linux/extract_and_bundle_gpu_package.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e -o -x + +while getopts a: parameter_Option +do case "${parameter_Option}" +in +a) ARTIFACT_DIR=${OPTARG};; +esac +done + +EXIT_CODE=1 + +uname -a + +cd $ARTIFACT_DIR + +mkdir -p $ARTIFACT_DIR/onnxruntime-linux-x64-tensorrt +tar zxvf $ARTIFACT_DIR/onnxruntime-linux-x64-tensorrt-*.tgz -C onnxruntime-linux-x64-tensorrt +rm $ARTIFACT_DIR/onnxruntime-linux-x64-tensorrt-*.tgz + +mkdir -p $ARTIFACT_DIR/onnxruntime-linux-x64-gpu +TAR_NAME=`ls $ARTIFACT_DIR/onnxruntime-linux-x64-cuda-*.tgz` +tar zxvf $ARTIFACT_DIR/onnxruntime-linux-x64-cuda-*.tgz -C onnxruntime-linux-x64-gpu +rm $ARTIFACT_DIR/onnxruntime-linux-x64-cuda-*.tgz + +cp onnxruntime-linux-x64-tensorrt/*/lib/libonnxruntime.so* onnxruntime-linux-x64-gpu/*/lib +cp onnxruntime-linux-x64-tensorrt/*/lib/libonnxruntime_providers_tensorrt.so onnxruntime-linux-x64-gpu/*/lib +cp onnxruntime-linux-x64-tensorrt/*/lib/libonnxruntime_providers_shared.so onnxruntime-linux-x64-gpu/*/lib diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index a3278dbf6f..be530ca5e0 100755 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -50,6 +50,11 @@ then cp $BINARY_DIR/$BUILD_CONFIG/libonnxruntime_providers_shared.so $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime_providers_shared.so cp $BINARY_DIR/$BUILD_CONFIG/libonnxruntime_providers_cuda.so $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime_providers_cuda.so fi + # Add tensorrt provider if it exists + if [[ -f "$BINARY_DIR/$BUILD_CONFIG/libonnxruntime_providers_tensorrt.so" ]]; then + cp $BINARY_DIR/$BUILD_CONFIG/libonnxruntime_providers_shared.so $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime_providers_shared.so + cp $BINARY_DIR/$BUILD_CONFIG/libonnxruntime_providers_tensorrt.so $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime_providers_tensorrt.so + fi fi find $BINARY_DIR/$ARTIFACT_NAME -ls diff --git a/tools/ci_build/github/windows/bundle_dlls_gpu.bat b/tools/ci_build/github/windows/bundle_dlls_gpu.bat index 72fd0a09b3..0ae92ca512 100644 --- a/tools/ci_build/github/windows/bundle_dlls_gpu.bat +++ b/tools/ci_build/github/windows/bundle_dlls_gpu.bat @@ -1,22 +1,21 @@ 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 ( +SETLOCAL EnableDelayedExpansion +FOR /R %%i IN (*.zip) 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-gpu-tensorrt\lib\libonnxruntime.so.1* runtimes\linux-x64\native\libonnxruntime.so - move onnxruntime-linux-x64-gpu-tensorrt\lib\libonnxruntime_providers_shared.so runtimes\linux-x64\native\libonnxruntime_providers_shared.so - move onnxruntime-linux-x64-gpu-tensorrt\lib\libonnxruntime_providers_tensorrt.so runtimes\linux-x64\native\libonnxruntime_providers_tensorrt.so - mkdir runtimes\win-x64\native - move onnxruntime-win-tensorrt-x64\lib\onnxruntime_providers_tensorrt.dll runtimes\win-x64\native\onnxruntime_providers_tensorrt.dll - move onnxruntime-win-tensorrt-x64\lib\onnxruntime.dll runtimes\win-x64\native\onnxruntime.dll - move onnxruntime-win-tensorrt-x64\lib\onnxruntime.lib runtimes\win-x64\native\onnxruntime.lib - move onnxruntime-win-tensorrt-x64\lib\onnxruntime.pdb runtimes\win-x64\native\onnxruntime.pdb - 7z a %%~ni.nupkg runtimes + IF "!filename:~20,3!"=="gpu" ( + mkdir !filename!\lib + move onnxruntime-win-x64-tensorrt\lib\onnxruntime_providers_tensorrt.dll !filename!\lib\onnxruntime_providers_tensorrt.dll + move onnxruntime-win-x64-tensorrt\lib\onnxruntime_providers_tensorrt.lib !filename!\lib\onnxruntime_providers_tensorrt.lib + move onnxruntime-win-x64-tensorrt\lib\onnxruntime_providers_tensorrt.pdb !filename!\lib\onnxruntime_providers_tensorrt.pdb + move onnxruntime-win-x64-tensorrt\lib\onnxruntime_providers_shared.dll !filename!\lib\onnxruntime_providers_shared.dll + move onnxruntime-win-x64-tensorrt\lib\onnxruntime_providers_shared.lib !filename!\lib\onnxruntime_providers_shared.lib + move onnxruntime-win-x64-tensorrt\lib\onnxruntime_providers_shared.pdb !filename!\lib\onnxruntime_providers_shared.pdb + move onnxruntime-win-x64-tensorrt\lib\onnxruntime.dll !filename!\lib\onnxruntime.dll + move onnxruntime-win-x64-tensorrt\lib\onnxruntime.lib !filename!\lib\onnxruntime.lib + move onnxruntime-win-x64-tensorrt\lib\onnxruntime.pdb !filename!\lib\onnxruntime.pdb + 7z a %%~ni.zip !filename!\lib ) -) \ No newline at end of file +) diff --git a/tools/ci_build/github/windows/bundle_dlls_gpu_nuget.bat b/tools/ci_build/github/windows/bundle_dlls_gpu_nuget.bat new file mode 100644 index 0000000000..ca7c2f3214 --- /dev/null +++ b/tools/ci_build/github/windows/bundle_dlls_gpu_nuget.bat @@ -0,0 +1,23 @@ +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 + ) +) diff --git a/tools/ci_build/github/windows/extract_nuget_files_gpu.ps1 b/tools/ci_build/github/windows/extract_nuget_files_gpu.ps1 index edb5dad24b..6d1389d077 100644 --- a/tools/ci_build/github/windows/extract_nuget_files_gpu.ps1 +++ b/tools/ci_build/github/windows/extract_nuget_files_gpu.ps1 @@ -27,10 +27,10 @@ Foreach-Object { New-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\external\protobuf\cmake\RelWithDebInfo -ItemType directory -Copy-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-gpu-x64-*\lib\* -Destination $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo +Copy-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x64-cuda-*\lib\* -Destination $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo Copy-Item -Path $Env:BUILD_BINARIESDIRECTORY\extra-artifact\protoc.exe $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\external\protobuf\cmake\RelWithDebInfo -Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts | Where-Object { $_.Name -match 'onnxruntime-linux-x64-gpu-\d{1,}\.\d{1,}\.\d{1,}$' } | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-gpu -Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-gpu-tensorrt-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-gpu-tensorrt -Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-tensorrt-x64-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-tensorrt-x64 +Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts | Where-Object { $_.Name -match 'onnxruntime-linux-x64-cuda-\d{1,}\.\d{1,}\.\d{1,}$' } | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-gpu +Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-tensorrt-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-tensorrt +Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x64-tensorrt-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x64-tensorrt diff --git a/tools/ci_build/github/windows/extract_zip_files_gpu.ps1 b/tools/ci_build/github/windows/extract_zip_files_gpu.ps1 new file mode 100644 index 0000000000..a99ecbc7c2 --- /dev/null +++ b/tools/ci_build/github/windows/extract_zip_files_gpu.ps1 @@ -0,0 +1,20 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\zip-artifacts -Filter *.zip | +Foreach-Object { + $cmd = "7z.exe x $($_.FullName) -y -o$Env:BUILD_BINARIESDIRECTORY\zip-artifacts" + Write-Output $cmd + Invoke-Expression -Command $cmd +} + +Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\zip-artifacts -Filter *onnxruntime-win-x64-cuda*.zip | +Foreach-Object { + $($_.FullName) -match '.*onnxruntime-win-x64-cuda-(.*).zip' + $version=$matches[1] + Rename-Item -Path $($_.FullName) -NewName onnxruntime-win-x64-gpu-$version.zip +} + +Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\zip-artifacts | Where-Object { $_.Name -match 'onnxruntime-win-x64-cuda-\d{1,}\.\d{1,}\.\d{1,}$' } | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\zip-artifacts\onnxruntime-win-x64-gpu + +Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\zip-artifacts | Where-Object { $_.Name -match 'onnxruntime-win-x64-tensorrt-\d{1,}\.\d{1,}\.\d{1,}$' } | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\zip-artifacts\onnxruntime-win-x64-tensorrt diff --git a/tools/ci_build/github/windows/jar_gpu_packaging.ps1 b/tools/ci_build/github/windows/jar_gpu_packaging.ps1 index 0b8644d625..1c94f4678f 100644 --- a/tools/ci_build/github/windows/jar_gpu_packaging.ps1 +++ b/tools/ci_build/github/windows/jar_gpu_packaging.ps1 @@ -4,7 +4,8 @@ $ErrorActionPreference = "Stop" Write-Output "Start" dir -pushd onnxruntime-java-linux-x64 +Copy-Item -Path $Env:BUILD_BINARIESDIRECTORY\java-artifact\onnxruntime-java-linux-x64\ai\onnxruntime\native\linux-x64\libonnxruntime_providers_cuda.so -Destination $Env:BUILD_BINARIESDIRECTORY\java-artifact\onnxruntime-java-linux-x64-tensorrt\ai\onnxruntime\native\linux-x64 +pushd onnxruntime-java-linux-x64-tensorrt Write-Output "Run 7z" 7z a $Env:BUILD_BINARIESDIRECTORY\java-artifact\onnxruntime-java-win-x64\testing.jar libcustom_op_library.so Remove-Item -Path libcustom_op_library.so @@ -15,4 +16,4 @@ ren onnxruntime-$Env:ONNXRUNTIMEVERSION.jar onnxruntime_gpu-$Env:ONNXRUNTIMEVERS ren onnxruntime-$Env:ONNXRUNTIMEVERSION-javadoc.jar onnxruntime_gpu-$Env:ONNXRUNTIMEVERSION-javadoc.jar ren onnxruntime-$Env:ONNXRUNTIMEVERSION-sources.jar onnxruntime_gpu-$Env:ONNXRUNTIMEVERSION-sources.jar ren onnxruntime-$Env:ONNXRUNTIMEVERSION.pom onnxruntime_gpu-$Env:ONNXRUNTIMEVERSION.pom -popd \ No newline at end of file +popd