onnxruntime/tools/ci_build/github/azure-pipelines/nuget/templates/test_linux.yml
Yi Zhang 3f03c12986
Split Onnxruntime Nuget GPU package (#18819)
### Description
1. Update donwload-artifacts to flex-downloadartifacts to make it eaiser
to debug.
2. Move the native files into Gpu.Windows and Gpu-linux packages.
Onnxruntime-Gpu has dependency on them.
3. update the package validation as well
4. Add 2 stages to run E2E test for GPU.Windows and GPU.Linux
   for example:
   

![image](https://github.com/microsoft/onnxruntime/assets/16190118/35c6730b-8080-4f52-a17c-b9c61f41b6bb)



### Motivation and Context
Single Onnxruntime.Gpu Package size has already excceded the Nuget size
limit.
We split the package into some smaller packages to make them can be
published.

For compatibility, the user can install or upgrade Onnxruntime.Gpu,
which will install Gpu.Windows and Gpu.Linux automatically.
And the user can only install Gpu.Windows and Gpu.Linux directly. 

### Test Link
1. In ORT_NIGHTLY

2. Install the preview version in nuget-int. (nuget source:
https://apiint.nugettest.org/v3/index.json)

---------

Co-authored-by: Scott McKay <skottmckay@gmail.com>
2023-12-22 16:57:16 +08:00

115 lines
4.3 KiB
YAML

parameters:
AgentPool: 'onnxruntime-Ubuntu2004-AMD-CPU'
ArtifactSuffix: ''
NugetPackageName : ''
StageSuffix: 'CPU'
MoreSuffix: ''
NativePackagePrefix: 'onnxruntime'
SpecificArtifact: false
CustomOpArtifactName: 'onnxruntime-linux-x64'
BuildId: '0'
CudaVersion: '11.8'
stages:
- stage: NuGet_Test_Linux_${{ parameters.StageSuffix }}${{ parameters.MoreSuffix }}
dependsOn:
- NuGet_Packaging_${{ parameters.StageSuffix }}
condition: succeeded()
jobs:
- job:
workspace:
clean: all
timeoutInMinutes: 120
pool: ${{ parameters.AgentPool }}
variables:
- name: OnnxRuntimeBuildDirectory
value: '$(Build.BinariesDirectory)'
steps:
- template: ../../templates/flex-downloadPipelineArtifact.yml
parameters:
StepName: 'Download Signed NuGet'
ArtifactName: drop-signed-nuget-${{ parameters.ArtifactSuffix }}
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
SpecificArtifact: ${{ parameters.SpecificArtifact }}
BuildId: ${{ parameters.BuildId }}
- template: ../../templates/flex-downloadPipelineArtifact.yml
parameters:
StepName: 'Download Linux CustomOp TestData'
ArtifactName: ${{ parameters.CustomOpArtifactName }}
TargetPath: '$(Build.BinariesDirectory)/testdata'
SpecificArtifact: ${{ parameters.specificArtifact }}
BuildId: ${{ parameters.BuildId }}
- template: get-nuget-package-version-as-variable.yml
parameters:
packageFolder: '$(Build.BinariesDirectory)/nuget-artifact'
- task: CmdLine@2
displayName: 'Create symlink for test models'
inputs:
script: |
ln -sf /data/models $(Build.BinariesDirectory)
- ${{if contains(parameters.StageSuffix , 'GPU') }}:
- template: ../../templates/get-docker-image-steps.yml
parameters:
Dockerfile: tools/ci_build/github/linux/docker/Dockerfile.package_ubuntu_2004_gpu
Context: tools/ci_build/github/linux/docker/
${{ if eq(parameters.CudaVersion, '12.2') }}:
DockerBuildArgs: "
--build-arg BASEIMAGE=nvidia/cuda:12.2.2-cudnn8-devel-ubuntu20.04
--build-arg TRT_VERSION=8.6.1.6-1+cuda12.0
--build-arg BUILD_UID=$( id -u )
"
${{ else }}:
DockerBuildArgs: "
--build-arg BUILD_UID=$( id -u )
"
Repository: onnxruntimepackagestest
- bash: |
docker run --rm \
--gpus all \
--volume $(Build.SourcesDirectory):/onnxruntime_src \
--volume $(Build.BinariesDirectory):/build \
--volume /data/models:/build/models:ro \
-e BUILD_SOURCESDIRECTORY='/onnxruntime_src' \
-e OnnxRuntimeBuildDirectory='/build' \
-e DisableContribOps='$(DisableContribOps)' \
-e DisableMlOps='$(DisableMlOps)' \
-e IsReleaseBuild='$(IsReleaseBuild)' \
-e PACKAGENAME='${{ parameters.NugetPackageName }}' \
onnxruntimepackagestest \
/bin/bash -c "
set -ex; \
pushd /build; \
bash /onnxruntime_src/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.sh /build/nuget-artifact $(NuGetPackageVersionNumber); \
popd
"
displayName: 'Run Package Test'
- ${{ else }}:
- task: CmdLine@2
displayName: 'Create symlink for test models'
inputs:
script: |
ln -sf /data/models $(Build.BinariesDirectory)
- task: Bash@3
displayName: 'Run Package Test'
inputs:
targetType: filePath
filePath: '$(Build.SourcesDirectory)/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.sh'
arguments: '$(Build.BinariesDirectory)/nuget-artifact $(NuGetPackageVersionNumber)'
workingDirectory: $(Build.BinariesDirectory)
env:
OnnxRuntimeBuildDirectory: $(Build.BinariesDirectory)
DisableContribOps: $(DisableContribOps)
DisableMlOps: $(DisableMlOps)
IsReleaseBuild: $(IsReleaseBuild)
PACKAGENAME: ${{ parameters.NugetPackageName }}
- template: ../../templates/component-governance-component-detection-steps.yml
parameters:
condition: 'always'
- template: ../../templates/clean-agent-build-directory-step.yml