mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Make ROCm packaging stages to a single workflow (#21235)
### Description Make current ROCm packaging stages to a single workflow. Reduce the possibility of all nightly packages can't be generated by one failed stage ### Motivation and Context Our plan is to reduce the complexity of the current zip-nuget pipeline to improve the stability and performance of nightly packages generation. ROCm packaging stages has no dependencies with other packaging jobs and it's the most time-consuming route. After this change, the most used CPU/CUDA/Mobile packaging workflow duration can be reduced roughly from 3h20m to 2h30m.
This commit is contained in:
parent
f39ee14b46
commit
30b6e82e7d
4 changed files with 375 additions and 290 deletions
|
|
@ -94,28 +94,6 @@ stages:
|
|||
PreReleaseVersionSuffixString: ${{ parameters.PreReleaseVersionSuffixString }}
|
||||
PreReleaseVersionSuffixNumber: ${{ parameters.PreReleaseVersionSuffixNumber }}
|
||||
|
||||
- stage: Debug
|
||||
dependsOn: Setup
|
||||
jobs:
|
||||
- job: D1
|
||||
pool:
|
||||
name: 'onnxruntime-Ubuntu2204-AMD-CPU'
|
||||
variables:
|
||||
MyVar: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
|
||||
BuildDate: $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
|
||||
BuildTime: $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
|
||||
steps:
|
||||
- checkout: none
|
||||
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
||||
displayName: 'Clean Agent Directories'
|
||||
condition: always()
|
||||
- bash: echo $(MyVar)
|
||||
- bash: echo $(BuildTime)
|
||||
- bash: echo $(BuildDate)
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
|
||||
- template: stages/download-java-tools-stage.yml
|
||||
|
||||
- template: templates/c-api-cpu.yml
|
||||
|
|
@ -167,269 +145,6 @@ stages:
|
|||
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
||||
BuildId: ${{ parameters.BuildId }}
|
||||
|
||||
# ROCm
|
||||
- stage: Linux_C_API_Packaging_ROCm_x64
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- job: Linux_C_API_Packaging_ROCm_x64
|
||||
workspace:
|
||||
clean: all
|
||||
timeoutInMinutes: 240
|
||||
pool: onnxruntime-Ubuntu2204-AMD-CPU
|
||||
variables:
|
||||
RocmVersion: '5.6'
|
||||
RocmVersionPatchSuffix: ''
|
||||
steps:
|
||||
- checkout: self # due to checkout multiple repos, the root directory is $(Build.SourcesDirectory)/onnxruntime
|
||||
submodules: recursive
|
||||
- checkout: manylinux # due to checkout multiple repos, the root directory is $(Build.SourcesDirectory)/manylinux, for get-docker-image-steps.yml
|
||||
submodules: false
|
||||
|
||||
# get-docker-image-steps.yml will move the $(Build.SourcesDirectory)/manylinux into $(Build.SourcesDirectory)/onnxruntime,
|
||||
# then rename $(Build.SourcesDirectory)/onnxruntime as $(Build.SourcesDirectory)
|
||||
- template: templates/get-docker-image-steps.yml
|
||||
parameters:
|
||||
Dockerfile: tools/ci_build/github/linux/docker/Dockerfile.manylinux2_28_rocm
|
||||
Context: tools/ci_build/github/linux/docker
|
||||
DockerBuildArgs: >-
|
||||
--build-arg INSTALL_DEPS_EXTRA_ARGS=-tmur
|
||||
--build-arg BUILD_UID=$(id -u)
|
||||
--network=host --build-arg POLICY=manylinux_2_28 --build-arg PLATFORM=x86_64
|
||||
--build-arg ROCM_VERSION=$(RocmVersion)$(RocmVersionPatchSuffix)
|
||||
--build-arg DEVTOOLSET_ROOTPATH=/opt/rh/gcc-toolset-12/root
|
||||
--build-arg PREPEND_PATH=/opt/rh/gcc-toolset-12/root/usr/bin:
|
||||
--build-arg LD_LIBRARY_PATH_ARG=/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:/opt/rh/gcc-toolset-12/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-12/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib
|
||||
Repository: onnxruntimetrainingrocmbuild-rocm$(RocmVersion)
|
||||
CheckOutManyLinux: true
|
||||
|
||||
- template: templates/set-version-number-variables-step.yml
|
||||
|
||||
- task: Bash@3
|
||||
displayName: 'Build'
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: tools/ci_build/github/linux/build_rocm_c_api_package.sh
|
||||
arguments: >-
|
||||
-S $(Build.SourcesDirectory)
|
||||
-B $(Build.BinariesDirectory)
|
||||
-V $(RocmVersion)
|
||||
-I onnxruntimetrainingrocmbuild-rocm$(RocmVersion)
|
||||
-P python3.10
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
mkdir $(Build.ArtifactStagingDirectory)/testdata
|
||||
cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata
|
||||
ls -al $(Build.ArtifactStagingDirectory)
|
||||
displayName: 'Create Artifacts for CustomOp' # libcustom_op_library.so from cpu build is built with fp8, ROCm does not support it.
|
||||
|
||||
- template: templates/c-api-artifacts-package-and-publish-steps-posix.yml
|
||||
parameters:
|
||||
buildConfig: 'Release'
|
||||
artifactName: 'onnxruntime-linux-x64-rocm-$(OnnxRuntimeVersion)'
|
||||
artifactNameNoVersionString: 'onnxruntime-linux-x64-rocm'
|
||||
libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)'
|
||||
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters:
|
||||
condition: 'succeeded'
|
||||
- template: templates/clean-agent-build-directory-step.yml
|
||||
|
||||
|
||||
- stage: NuGet_Packaging_ROCm
|
||||
dependsOn:
|
||||
- Setup
|
||||
- Linux_C_API_Packaging_ROCm_x64
|
||||
condition: succeeded()
|
||||
jobs:
|
||||
- job: NuGet_Packaging_ROCm
|
||||
workspace:
|
||||
clean: all
|
||||
# we need to use a 2022 pool to create the nuget package with MAUI targets.
|
||||
# VS2019 has no support for net6/MAUI and we need to use msbuild (from the VS install) to do the packing
|
||||
pool: 'Onnxruntime-Win-CPU-2022'
|
||||
variables:
|
||||
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
|
||||
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
|
||||
BuildDate : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
|
||||
BuildTime : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
submodules: true
|
||||
fetchDepth: 1
|
||||
|
||||
- template: templates/flex-downloadPipelineArtifact.yml
|
||||
parameters:
|
||||
StepName: 'Download Pipeline Artifact - NuGet'
|
||||
ArtifactName: 'onnxruntime-linux-x64-rocm'
|
||||
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
||||
SpecificArtifact: ${{ parameters.specificArtifact }}
|
||||
BuildId: ${{ parameters.BuildId }}
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Reconstruct Build Directory'
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
Get-ChildItem $(Build.BinariesDirectory)\nuget-artifact -Filter *.tgz | % {
|
||||
# *.tar will be created after *.tgz is extracted
|
||||
$cmd = "7z.exe x $($_.FullName) -y -o$(Build.BinariesDirectory)\nuget-artifact"
|
||||
Write-Output $cmd
|
||||
Invoke-Expression -Command $cmd
|
||||
}
|
||||
|
||||
Get-ChildItem $(Build.BinariesDirectory)\nuget-artifact -Filter *.tar | % {
|
||||
$cmd = "7z.exe x $($_.FullName) -y -o$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts"
|
||||
Write-Output $cmd
|
||||
Invoke-Expression -Command $cmd
|
||||
}
|
||||
|
||||
$ort_dirs = Get-ChildItem -Path $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-* -Directory
|
||||
foreach ($ort_dir in $ort_dirs)
|
||||
{
|
||||
$dirname = Split-Path -Path $ort_dir -Leaf
|
||||
$dirname = $dirname.SubString(0, $dirname.LastIndexOf('-'))
|
||||
Write-Output "Renaming $ort_dir to $dirname"
|
||||
Rename-Item -Path $ort_dir -NewName $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\$dirname
|
||||
}
|
||||
|
||||
Copy-Item -Path $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-rocm\lib\* -Destination $(Build.BinariesDirectory)\RelWithDebInfo
|
||||
|
||||
- script: |
|
||||
tree /F
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Inspect Build Binaries Directory'
|
||||
|
||||
- script: |
|
||||
mklink /D /J models C:\local\models
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Create models link'
|
||||
|
||||
- task: NuGetToolInstaller@0
|
||||
displayName: Use Nuget 6.10.x
|
||||
inputs:
|
||||
versionSpec: 6.10.x
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: 'Restore NuGet Packages and create project.assets.json'
|
||||
inputs:
|
||||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
||||
platform: 'Any CPU'
|
||||
configuration: RelWithDebInfo
|
||||
msbuildArguments: '-t:restore -p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm"'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: 'Build C# bindings'
|
||||
inputs:
|
||||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
||||
platform: 'Any CPU'
|
||||
configuration: RelWithDebInfo
|
||||
msbuildArguments: >
|
||||
-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)"
|
||||
-p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm"
|
||||
-p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}
|
||||
-p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)
|
||||
-p:IsLinuxBuild=true
|
||||
-p:IsWindowsBuild=false
|
||||
-p:IsMacOSBuild=false
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- template: templates/win-esrp-dll.yml
|
||||
parameters:
|
||||
FolderPath: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo'
|
||||
DisplayName: 'ESRP - Sign C# dlls'
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
displayName: 'Use Python'
|
||||
inputs:
|
||||
versionSpec: 3.8
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: 'Build Nuget Packages'
|
||||
inputs:
|
||||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
|
||||
configuration: RelWithDebInfo
|
||||
platform: 'Any CPU'
|
||||
msbuildArguments: >
|
||||
-t:CreatePackage
|
||||
-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)"
|
||||
-p:OrtPackageId=Microsoft.ML.OnnxRuntime.ROCm
|
||||
-p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}
|
||||
-p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)
|
||||
-p:CurrentTime=$(BuildTime)
|
||||
-p:CurrentDate=$(BuildDate)
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
|
||||
inputs:
|
||||
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
||||
Contents: '*.snupkg'
|
||||
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
|
||||
inputs:
|
||||
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
||||
Contents: '*.nupkg'
|
||||
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
|
||||
inputs:
|
||||
SourceFolder: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo'
|
||||
Contents: '*.nupkg'
|
||||
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- template: templates/esrp_nuget.yml
|
||||
parameters:
|
||||
DisplayName: 'ESRP - sign NuGet package'
|
||||
FolderPath: '$(Build.ArtifactStagingDirectory)'
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
|
||||
- template: templates/validate-package.yml
|
||||
parameters:
|
||||
PackageType: 'nuget'
|
||||
PackagePath: '$(Build.ArtifactStagingDirectory)'
|
||||
PackageName: 'Microsoft.ML.OnnxRuntime.*nupkg'
|
||||
PlatformsSupported: 'linux-x64'
|
||||
VerifyNugetSigning: false
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Pipeline NuGet Artifact'
|
||||
inputs:
|
||||
artifactName: 'drop-signed-nuget-ROCm'
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: 'Clean C#'
|
||||
inputs:
|
||||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
||||
platform: 'Any CPU'
|
||||
configuration: RelWithDebInfo
|
||||
msbuildArguments: '-t:Clean -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.ROCm'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
|
||||
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
||||
displayName: 'Clean Agent Directories'
|
||||
condition: always()
|
||||
|
||||
- template: nuget/templates/test_linux.yml
|
||||
parameters:
|
||||
AgentPool: AMD-GPU
|
||||
ArtifactSuffix: 'ROCm'
|
||||
StageSuffix: 'ROCm'
|
||||
NugetPackageName: 'Microsoft.ML.OnnxRuntime.ROCm'
|
||||
SpecificArtifact: ${{ parameters.specificArtifact }}
|
||||
CustomOpArtifactName: 'onnxruntime-linux-x64-rocm'
|
||||
BuildId: ${{ parameters.BuildId }}
|
||||
|
||||
- template: nuget/templates/dml-vs-2022.yml
|
||||
parameters:
|
||||
|
|
|
|||
|
|
@ -29,11 +29,6 @@ stages:
|
|||
artifact: 'drop-signed-nuget-GPU'
|
||||
- script: move "$(Pipeline.Workspace)\build\drop-signed-nuget-GPU\*" $(Build.BinariesDirectory)\nuget-artifact\final-package
|
||||
|
||||
- download: build
|
||||
displayName: 'Download Pipeline Artifact - Signed NuGet ROCm Package'
|
||||
artifact: 'drop-signed-nuget-ROCm'
|
||||
- script: move "$(Pipeline.Workspace)\build\drop-signed-nuget-ROCm\*" $(Build.BinariesDirectory)\nuget-artifact\final-package
|
||||
|
||||
- download: build
|
||||
displayName: 'Download Pipeline Artifact - Signed NuGet Qnn Package'
|
||||
artifact: 'drop-signed-nuget-qnn'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,353 @@
|
|||
parameters:
|
||||
- name: RunOnnxRuntimeTests
|
||||
displayName: Run Tests?
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
- name: UseIncreasedTimeoutForTests
|
||||
displayName: Increase timeout for tests? Set it to false if you are doing an Onnx Runtime release.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
- name: DoCompliance
|
||||
displayName: Run Compliance Tasks?
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
- name: DoEsrp
|
||||
displayName: Run code sign tasks? Must be true if you are doing an ONNX Runtime release
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
- name: IsReleaseBuild
|
||||
displayName: Is a release build? Set it to true if you are doing an ONNX Runtime release.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
- name: PreReleaseVersionSuffixString
|
||||
displayName: Suffix added to pre-release package version. Only used if IsReleaseBuild is true. Denotes the type of pre-release package.
|
||||
type: string
|
||||
values:
|
||||
- alpha
|
||||
- beta
|
||||
- rc
|
||||
- none
|
||||
default: none
|
||||
|
||||
- name: PreReleaseVersionSuffixNumber
|
||||
displayName: Number added to pre-release package version. Only used if IsReleaseBuild is true. Denotes the sequence of a pre-release package.
|
||||
type: number
|
||||
default: 0
|
||||
|
||||
# these 2 parameters are used for debugging.
|
||||
- name: SpecificArtifact
|
||||
displayName: Use Specific Artifact (Debugging only)
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
- name: BuildId
|
||||
displayName: Pipeline BuildId, you could find it in the URL
|
||||
type: string
|
||||
default: '0'
|
||||
|
||||
- name: NugetPackageSuffix
|
||||
displayName: Suffix to append to nuget package
|
||||
type: string
|
||||
default: 'NONE'
|
||||
|
||||
resources:
|
||||
repositories:
|
||||
- repository: onnxruntime-inference-examples # The name used to reference this repository in the checkout step
|
||||
type: github
|
||||
endpoint: ort-examples
|
||||
name: microsoft/onnxruntime-inference-examples
|
||||
- repository: manylinux
|
||||
type: Github
|
||||
endpoint: Microsoft
|
||||
name: pypa/manylinux
|
||||
ref: 5eda9aded5462201e6310105728d33016e637ea7
|
||||
|
||||
variables:
|
||||
- name: ReleaseVersionSuffix
|
||||
value: ''
|
||||
|
||||
stages:
|
||||
- template: stages/set_packaging_variables_stage.yml
|
||||
parameters:
|
||||
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
|
||||
PreReleaseVersionSuffixString: ${{ parameters.PreReleaseVersionSuffixString }}
|
||||
PreReleaseVersionSuffixNumber: ${{ parameters.PreReleaseVersionSuffixNumber }}
|
||||
|
||||
# ROCm
|
||||
- stage: Linux_C_API_Packaging_ROCm_x64
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- job: Linux_C_API_Packaging_ROCm_x64
|
||||
workspace:
|
||||
clean: all
|
||||
timeoutInMinutes: 240
|
||||
pool: onnxruntime-Ubuntu2204-AMD-CPU
|
||||
variables:
|
||||
RocmVersion: '5.6'
|
||||
RocmVersionPatchSuffix: ''
|
||||
steps:
|
||||
- checkout: self # due to checkout multiple repos, the root directory is $(Build.SourcesDirectory)/onnxruntime
|
||||
submodules: recursive
|
||||
- checkout: manylinux # due to checkout multiple repos, the root directory is $(Build.SourcesDirectory)/manylinux, for get-docker-image-steps.yml
|
||||
submodules: false
|
||||
|
||||
# get-docker-image-steps.yml will move the $(Build.SourcesDirectory)/manylinux into $(Build.SourcesDirectory)/onnxruntime,
|
||||
# then rename $(Build.SourcesDirectory)/onnxruntime as $(Build.SourcesDirectory)
|
||||
- template: templates/get-docker-image-steps.yml
|
||||
parameters:
|
||||
Dockerfile: tools/ci_build/github/linux/docker/Dockerfile.manylinux2_28_rocm
|
||||
Context: tools/ci_build/github/linux/docker
|
||||
DockerBuildArgs: >-
|
||||
--build-arg INSTALL_DEPS_EXTRA_ARGS=-tmur
|
||||
--build-arg BUILD_UID=$(id -u)
|
||||
--network=host --build-arg POLICY=manylinux_2_28 --build-arg PLATFORM=x86_64
|
||||
--build-arg ROCM_VERSION=$(RocmVersion)$(RocmVersionPatchSuffix)
|
||||
--build-arg DEVTOOLSET_ROOTPATH=/opt/rh/gcc-toolset-12/root
|
||||
--build-arg PREPEND_PATH=/opt/rh/gcc-toolset-12/root/usr/bin:
|
||||
--build-arg LD_LIBRARY_PATH_ARG=/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:/opt/rh/gcc-toolset-12/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-12/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib
|
||||
Repository: onnxruntimetrainingrocmbuild-rocm$(RocmVersion)
|
||||
CheckOutManyLinux: true
|
||||
|
||||
- template: templates/set-version-number-variables-step.yml
|
||||
|
||||
- task: Bash@3
|
||||
displayName: 'Build'
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: tools/ci_build/github/linux/build_rocm_c_api_package.sh
|
||||
arguments: >-
|
||||
-S $(Build.SourcesDirectory)
|
||||
-B $(Build.BinariesDirectory)
|
||||
-V $(RocmVersion)
|
||||
-I onnxruntimetrainingrocmbuild-rocm$(RocmVersion)
|
||||
-P python3.10
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
mkdir $(Build.ArtifactStagingDirectory)/testdata
|
||||
cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata
|
||||
ls -al $(Build.ArtifactStagingDirectory)
|
||||
displayName: 'Create Artifacts for CustomOp' # libcustom_op_library.so from cpu build is built with fp8, ROCm does not support it.
|
||||
|
||||
- template: templates/c-api-artifacts-package-and-publish-steps-posix.yml
|
||||
parameters:
|
||||
buildConfig: 'Release'
|
||||
artifactName: 'onnxruntime-linux-x64-rocm-$(OnnxRuntimeVersion)'
|
||||
artifactNameNoVersionString: 'onnxruntime-linux-x64-rocm'
|
||||
libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)'
|
||||
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters:
|
||||
condition: 'succeeded'
|
||||
- template: templates/clean-agent-build-directory-step.yml
|
||||
|
||||
- stage: NuGet_Packaging_ROCm
|
||||
dependsOn:
|
||||
- Setup
|
||||
- Linux_C_API_Packaging_ROCm_x64
|
||||
condition: succeeded()
|
||||
jobs:
|
||||
- job: NuGet_Packaging_ROCm
|
||||
workspace:
|
||||
clean: all
|
||||
# we need to use a 2022 pool to create the nuget package with MAUI targets.
|
||||
# VS2019 has no support for net6/MAUI and we need to use msbuild (from the VS install) to do the packing
|
||||
pool: 'Onnxruntime-Win-CPU-2022'
|
||||
variables:
|
||||
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
|
||||
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
|
||||
BuildDate : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
|
||||
BuildTime : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
submodules: true
|
||||
fetchDepth: 1
|
||||
|
||||
- template: templates/flex-downloadPipelineArtifact.yml
|
||||
parameters:
|
||||
StepName: 'Download Pipeline Artifact - NuGet'
|
||||
ArtifactName: 'onnxruntime-linux-x64-rocm'
|
||||
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
||||
SpecificArtifact: ${{ parameters.specificArtifact }}
|
||||
BuildId: ${{ parameters.BuildId }}
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Reconstruct Build Directory'
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
Get-ChildItem $(Build.BinariesDirectory)\nuget-artifact -Filter *.tgz | % {
|
||||
# *.tar will be created after *.tgz is extracted
|
||||
$cmd = "7z.exe x $($_.FullName) -y -o$(Build.BinariesDirectory)\nuget-artifact"
|
||||
Write-Output $cmd
|
||||
Invoke-Expression -Command $cmd
|
||||
}
|
||||
|
||||
Get-ChildItem $(Build.BinariesDirectory)\nuget-artifact -Filter *.tar | % {
|
||||
$cmd = "7z.exe x $($_.FullName) -y -o$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts"
|
||||
Write-Output $cmd
|
||||
Invoke-Expression -Command $cmd
|
||||
}
|
||||
|
||||
$ort_dirs = Get-ChildItem -Path $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-* -Directory
|
||||
foreach ($ort_dir in $ort_dirs)
|
||||
{
|
||||
$dirname = Split-Path -Path $ort_dir -Leaf
|
||||
$dirname = $dirname.SubString(0, $dirname.LastIndexOf('-'))
|
||||
Write-Output "Renaming $ort_dir to $dirname"
|
||||
Rename-Item -Path $ort_dir -NewName $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\$dirname
|
||||
}
|
||||
|
||||
Copy-Item -Path $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-rocm\lib\* -Destination $(Build.BinariesDirectory)\RelWithDebInfo
|
||||
|
||||
- script: |
|
||||
tree /F
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Inspect Build Binaries Directory'
|
||||
|
||||
- script: |
|
||||
mklink /D /J models C:\local\models
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Create models link'
|
||||
|
||||
- task: NuGetToolInstaller@0
|
||||
displayName: Use Nuget 6.10.x
|
||||
inputs:
|
||||
versionSpec: 6.10.x
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: 'Restore NuGet Packages and create project.assets.json'
|
||||
inputs:
|
||||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
||||
platform: 'Any CPU'
|
||||
configuration: RelWithDebInfo
|
||||
msbuildArguments: '-t:restore -p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm"'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: 'Build C# bindings'
|
||||
inputs:
|
||||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
||||
platform: 'Any CPU'
|
||||
configuration: RelWithDebInfo
|
||||
msbuildArguments: >
|
||||
-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)"
|
||||
-p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm"
|
||||
-p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}
|
||||
-p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)
|
||||
-p:IsLinuxBuild=true
|
||||
-p:IsWindowsBuild=false
|
||||
-p:IsMacOSBuild=false
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- template: templates/win-esrp-dll.yml
|
||||
parameters:
|
||||
FolderPath: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo'
|
||||
DisplayName: 'ESRP - Sign C# dlls'
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
displayName: 'Use Python'
|
||||
inputs:
|
||||
versionSpec: 3.8
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: 'Build Nuget Packages'
|
||||
inputs:
|
||||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
|
||||
configuration: RelWithDebInfo
|
||||
platform: 'Any CPU'
|
||||
msbuildArguments: >
|
||||
-t:CreatePackage
|
||||
-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)"
|
||||
-p:OrtPackageId=Microsoft.ML.OnnxRuntime.ROCm
|
||||
-p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}
|
||||
-p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)
|
||||
-p:CurrentTime=$(BuildTime)
|
||||
-p:CurrentDate=$(BuildDate)
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
|
||||
inputs:
|
||||
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
||||
Contents: '*.snupkg'
|
||||
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
|
||||
inputs:
|
||||
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
||||
Contents: '*.nupkg'
|
||||
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
|
||||
inputs:
|
||||
SourceFolder: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo'
|
||||
Contents: '*.nupkg'
|
||||
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- template: templates/esrp_nuget.yml
|
||||
parameters:
|
||||
DisplayName: 'ESRP - sign NuGet package'
|
||||
FolderPath: '$(Build.ArtifactStagingDirectory)'
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
|
||||
- template: templates/validate-package.yml
|
||||
parameters:
|
||||
PackageType: 'nuget'
|
||||
PackagePath: '$(Build.ArtifactStagingDirectory)'
|
||||
PackageName: 'Microsoft.ML.OnnxRuntime.*nupkg'
|
||||
PlatformsSupported: 'linux-x64'
|
||||
VerifyNugetSigning: false
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Pipeline NuGet Artifact'
|
||||
inputs:
|
||||
artifactName: 'drop-signed-nuget-ROCm'
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: 'Clean C#'
|
||||
inputs:
|
||||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
||||
platform: 'Any CPU'
|
||||
configuration: RelWithDebInfo
|
||||
msbuildArguments: '-t:Clean -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.ROCm'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
|
||||
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
||||
displayName: 'Clean Agent Directories'
|
||||
condition: always()
|
||||
|
||||
- template: nuget/templates/test_linux.yml
|
||||
parameters:
|
||||
AgentPool: AMD-GPU
|
||||
ArtifactSuffix: 'ROCm'
|
||||
StageSuffix: 'ROCm'
|
||||
NugetPackageName: 'Microsoft.ML.OnnxRuntime.ROCm'
|
||||
SpecificArtifact: ${{ parameters.specificArtifact }}
|
||||
CustomOpArtifactName: 'onnxruntime-linux-x64-rocm'
|
||||
BuildId: ${{ parameters.BuildId }}
|
||||
|
||||
- template: templates/publish-nuget-steps.yml
|
||||
parameters:
|
||||
download_artifacts_steps:
|
||||
- template: templates/flex-downloadPipelineArtifact.yml
|
||||
parameters:
|
||||
StepName: 'Download Pipeline Artifact - Signed NuGet ROCm Package'
|
||||
ArtifactName: 'drop-signed-nuget-ROCm'
|
||||
targetPath: '$(Build.BinariesDirectory)/nuget-artifact/final-package'
|
||||
SpecificArtifact: ${{ parameters.specificArtifact }}
|
||||
BuildId: ${{ parameters.BuildId }}
|
||||
|
|
@ -44,3 +44,25 @@ stages:
|
|||
- template: ../templates/component-governance-component-detection-steps.yml
|
||||
parameters:
|
||||
condition: 'succeeded'
|
||||
|
||||
- stage: Debug
|
||||
dependsOn: Setup
|
||||
jobs:
|
||||
- job: D1
|
||||
pool:
|
||||
name: 'onnxruntime-Ubuntu2204-AMD-CPU'
|
||||
variables:
|
||||
MyVar: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
|
||||
BuildDate: $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
|
||||
BuildTime: $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
|
||||
steps:
|
||||
- checkout: none
|
||||
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
||||
displayName: 'Clean Agent Directories'
|
||||
condition: always()
|
||||
- bash: echo $(MyVar)
|
||||
- bash: echo $(BuildTime)
|
||||
- bash: echo $(BuildDate)
|
||||
- template: ../templates/component-governance-component-detection-steps.yml
|
||||
parameters:
|
||||
condition: 'succeeded'
|
||||
|
|
|
|||
Loading…
Reference in a new issue