Skip to content

Commit

Permalink
Fix Nuget Cuda pipeline package pipeline (#20741)
Browse files Browse the repository at this point in the history
### Description
<!-- Describe your changes. -->

This PR adding protoc.exe to make the Nuget Cuda Pipleine, which also
allowing it to get build Java for various CUDA version

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
  • Loading branch information
jchen351 authored May 24, 2024
1 parent bab5037 commit fe24006
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ stages:
PreReleaseVersionSuffixNumber: ${{ parameters.PreReleaseVersionSuffixNumber }}

# this is needed for certain artifacts to be published
- stage: Linux_C_API_Packaging_CPU_x64
- stage: Linux_C_API_Packaging_CPU
dependsOn: [ ]
jobs:
- template: templates/c-api-linux-cpu.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ parameters:
type: string

stages:
- stage: Java_GPU_Packaging
- stage: Jar_Packaging_GPU
dependsOn:
- Linux_C_API_Packaging_Combined_CUDA
- Windows_Packaging_CUDA
- Windows_Packaging_TensorRT
- Linux_C_API_Packaging_GPU
# Because Java Jar is published only after Windows Packaging GPU Testing stage we need to depend on the Testing stages
# TODO: change Windows_Packaging_*_Testing to Windows_Packaging_* once we finish PRODUCT BACKLOG ITEM 34666
- Windows_Packaging_CUDA_Testing
- Windows_Packaging_TensorRT_Testing
- Download_Java_Tools
jobs:
- job: Jar_Packaging_GPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ stages:
CudaVersion: ${{ parameters.CudaVersion }}
win_trt_home: ${{ parameters.win_trt_home }}
win_cuda_home: ${{ parameters.win_cuda_home }}
buildJava: ${{ parameters.buildJava }}

- template: nuget-cuda-packaging-stage.yml
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ stages:
- Setup
- Windows_Packaging_CUDA
- Windows_Packaging_TensorRT
- Linux_C_API_Packaging_Combined_CUDA
- Linux_C_API_Packaging_GPU
# This is need for Download Linux CustomOp TestData
- Linux_C_API_Packaging_CPU
condition: succeeded()
jobs:
- job:
- job: NuGet_Packaging_GPU
workspace:
clean: all
pool: 'Onnxruntime-Win-CPU-2022'
Expand Down Expand Up @@ -56,12 +58,6 @@ stages:
ArtifactName: 'onnxruntime-linux-x64-tensorrt'
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'

- template: ../templates/flex-downloadPipelineArtifact.yml
parameters:
StepName: 'Download Pipeline Artifact - NuGet'
ArtifactName: 'drop-extra'
TargetPath: '$(Build.BinariesDirectory)/extra-artifact'

# Reconstruct the build dir
- task: PowerShell@2
displayName: 'PS: Extract nuget files gpu'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ parameters:
type: string
- name: buildJava
type: boolean
default: false
- name: buildNodejs
type: boolean
default: false

stages:
- stage: Linux_C_API_Packaging_Combined_CUDA
- stage: Linux_C_API_Packaging_GPU
dependsOn: []
jobs:
- job: Linux_C_API_Packaging_CUDA
Expand Down Expand Up @@ -51,14 +49,16 @@ stages:
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Build CUDA C API Package'

- template: ../templates/java-api-artifacts-package-and-publish-steps-posix.yml
parameters:
arch: 'linux-x64'
buildConfig: 'Release'
artifactName: 'onnxruntime-java-linux-x64-cuda'
version: '$(OnnxRuntimeVersion)'
libraryName: 'libonnxruntime.so'
nativeLibraryName: 'libonnxruntime4j_jni.so'
- ${{ 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-cuda'
version: '$(OnnxRuntimeVersion)'
libraryName: 'libonnxruntime.so'
nativeLibraryName: 'libonnxruntime4j_jni.so'

- template: ../templates/c-api-artifacts-package-and-publish-steps-posix.yml
parameters:
buildConfig: 'Release'
Expand Down Expand Up @@ -147,10 +147,11 @@ stages:
condition: 'succeeded'
- template: ../templates/clean-agent-build-directory-step.yml
# Linux CUDA Combined Testing and Publishing
- stage: Linux_Packaging_combined_CUDA
dependsOn:
- Linux_C_API_Packaging_GPU
jobs:
- job: Linux_Packaging_combined_CUDA
dependsOn:
- Linux_C_API_Packaging_CUDA
- Linux_C_API_Packaging_TensorRT
condition: succeeded()
workspace:
clean: all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ parameters:
displayName: Specific Artifact's BuildId
type: string
default: '0'

- name: buildJava
type: boolean

stages:
# Windows CUDA without TensorRT Packaging
Expand All @@ -49,7 +52,7 @@ stages:
CudaVersion: ${{ parameters.CudaVersion }}
buildparameter: --use_cuda --cuda_home=${{ parameters.win_cuda_home }} --enable_onnx_tests --enable_wcos --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=60;61;70;75;80"
runTests: ${{ parameters.RunOnnxRuntimeTests }}
buildJava: true
buildJava: ${{ parameters.buildJava }}
java_artifact_id: onnxruntime_gpu
UseIncreasedTimeoutForTests: ${{ parameters.UseIncreasedTimeoutForTests }}
SpecificArtifact: ${{ parameters.SpecificArtifact }}
Expand All @@ -67,7 +70,7 @@ stages:
packageName: x64-tensorrt
buildparameter: --use_tensorrt --tensorrt_home=${{ parameters.win_trt_home }} --cuda_home=${{ parameters.win_cuda_home }} --enable_onnx_tests --enable_wcos --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=60;61;70;75;80"
runTests: ${{ parameters.RunOnnxRuntimeTests }}
buildJava: true
buildJava: ${{ parameters.buildJava }}
java_artifact_id: onnxruntime_gpu
UseIncreasedTimeoutForTests: ${{ parameters.UseIncreasedTimeoutForTests }}
SpecificArtifact: ${{ parameters.SpecificArtifact }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ stages:
- Windows_CI_GPU_DML_Dev
- Windows_CI_GPU_DML_Dev_arm64
- Linux_C_API_Packaging_CPU
- Linux_C_API_Packaging_Combined_CUDA
- Linux_C_API_Packaging_GPU
- MacOS_C_API_Package_Publish
condition: succeeded()
jobs:
Expand Down
6 changes: 4 additions & 2 deletions tools/ci_build/github/azure-pipelines/templates/win-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,11 @@ stages:
- template: component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
- ${{ if contains(parameters.ort_build_pool_name, 'GPU') }}:
- ${{ if contains(parameters.ort_build_pool_name, 'GPU') }}:
- stage: Windows_Packaging_${{ parameters.stage_name_suffix }}_Testing
dependsOn: Windows_Packaging_${{ parameters.stage_name_suffix }}
jobs:
- job: Windows_Packaging_${{ parameters.stage_name_suffix }}_Testing
dependsOn: Windows_Packaging_${{ parameters.stage_name_suffix }}
workspace:
clean: all
pool: ${{ parameters.ort_build_pool_name }}
Expand Down
8 changes: 7 additions & 1 deletion tools/ci_build/github/windows/extract_nuget_files_gpu.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ Foreach-Object {
New-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\_deps\protobuf-build\RelWithDebInfo -ItemType directory

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\_deps\protobuf-build\RelWithDebInfo

$protocInstallDir = "$Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\_deps\protobuf-build"
dotnet new console
dotnet add package Google.Protobuf.Tools --version 3.21.12 --package-directory $protocInstallDir
$protocDir = Get-ChildItem -Path $protocInstallDir -Recurse -Filter "protoc.exe" | Select-Object -ExpandProperty DirectoryName -First 1
Write-Output $protocDir
Copy-Item -Path $protocDir -Destination $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\_deps\protobuf-build\RelWithDebInfo

$ort_dirs = Get-ChildItem -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-* -Directory
foreach ($ort_dir in $ort_dirs)
Expand Down

0 comments on commit fe24006

Please sign in to comment.