-
Notifications
You must be signed in to change notification settings - Fork 4.2k
129 lines (119 loc) · 6.82 KB
/
Copy pathlinux_tensorrt_ci.yml
File metadata and controls
129 lines (119 loc) · 6.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Linux TensorRT CI
on:
push:
branches: [main, 'rel-*']
pull_request:
branches: [main, 'rel-*']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: true
permissions:
contents: read
packages: write
attestations: write
id-token: write
jobs:
build-linux-TensorRT-x64-release:
name: Build Linux TensorRT x64 Release
# This job runs on a CPU node using the reusable build workflow
uses: ./.github/workflows/reusable_linux_build.yml
with:
pool_name: "onnxruntime-github-Ubuntu2204-AMD-CPU" # Build pool
build_config: Release
architecture: x64
dockerfile_path: tools/ci_build/github/linux/docker/Dockerfile.manylinux2_28_cuda
docker_build_args: '--build-arg BASEIMAGE=onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_almalinux8_gcc14:20251017.1 --build-arg TRT_VERSION=10.14.1.48-1.cuda12.9 --network=host'
docker_image_repo: onnxruntimetensorrt86gpubuild
extra_build_flags: '--use_binskim_compliant_compile_flags --build_wheel --cuda_version=12.8 --cuda_home=/usr/local/cuda-12.8 --cudnn_home=/usr/local/cuda-12.8 --use_tensorrt --tensorrt_home /usr --build_java --parallel --nvcc_threads 4 --flash_nvcc_threads 4 --cmake_extra_defines onnxruntime_QUICK_BUILD=ON --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=86 onnxruntime_BUILD_UNIT_TESTS=ON onnxruntime_ENABLE_CUDA_EP_INTERNAL_TESTS=ON'
python_path_prefix: 'PATH=/opt/python/cp310-cp310/bin:$PATH'
run_tests: false # <<< Do not run tests in this job
upload_build_output: true # <<< Upload the build/Release directory
execution_providers: 'cuda tensorrt'
job_identifier: build-linux-TensorRT-x64-release
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Pass token for reusable workflow needs (e.g., docker build action)
build-linux-TensorRT-CUDA-Minimal-x64-release:
name: Build Linux TensorRT CUDA Minimal x64 Release
# Build-only job for CUDA minimal build (no tests, no unit tests)
uses: ./.github/workflows/reusable_linux_build.yml
with:
pool_name: "onnxruntime-github-Ubuntu2204-AMD-CPU"
build_config: Release
architecture: x64
dockerfile_path: tools/ci_build/github/linux/docker/Dockerfile.manylinux2_28_cuda
docker_build_args: '--build-arg BASEIMAGE=onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_almalinux8_gcc14:20251017.1 --build-arg TRT_VERSION=10.14.1.48-1.cuda12.9 --network=host'
docker_image_repo: onnxruntimetensorrt86gpubuild
extra_build_flags: '--use_binskim_compliant_compile_flags --build_wheel --cuda_version=12.8 --cuda_home=/usr/local/cuda-12.8 --cudnn_home=/usr/local/cuda-12.8 --use_tensorrt --tensorrt_home /usr --build_java --enable_cuda_minimal_build --disable_generation_ops --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=86 onnxruntime_BUILD_UNIT_TESTS=OFF'
python_path_prefix: 'PATH=/opt/python/cp310-cp310/bin:$PATH'
run_tests: false
upload_build_output: false
execution_providers: 'cuda tensorrt'
job_identifier: build-linux-TensorRT-CUDA-Minimal-x64-release
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test-linux-TensorRT-x64-release:
name: Test Linux TensorRT x64 Release
needs: build-linux-TensorRT-x64-release
runs-on:
- self-hosted
- "1ES.Pool=onnxruntime-github-linux-a10"
- "1ES.ImageOverride=onnxruntime-ubuntu2204-CUDA-A10-Test"
- "JobId=test-linux-TensorRT-x64-release-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"
timeout-minutes: 210
permissions:
contents: read
packages: read
steps:
- name: Checkout code
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
# --- Build the Docker image needed for testing ---
- name: Build Docker Image for Testing
uses: microsoft/onnxruntime-github-actions/build-docker-image@8bad63a3c05d448311dfa8e5f531171c97471aa1 # v0.0.12
id: build_docker_image_step
with:
dockerfile: ${{ github.workspace }}/tools/ci_build/github/linux/docker/Dockerfile.manylinux2_28_cuda
image-name: ghcr.io/microsoft/onnxruntime/onnxruntimetensorrt86gpubuild
build-args: '--build-arg BASEIMAGE=onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_almalinux8_gcc14:20251017.1 --build-arg TRT_VERSION=10.14.1.48-1.cuda12.9 --network=host'
push: true
azure-container-registry-name: onnxruntimebuildcache
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Pass token to action
# --- Download Build Artifact to Runner Temp Directory ---
- name: Download Build Artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: build-output-x64-Release # Must match the upload name
path: ${{ runner.temp }}/Release # Download contents into temp dir structure
# --- Restore Permissions in the Temp Directory ---
- name: Restore Executable Permissions
if: success() # Only run if download succeeded
working-directory: ${{ runner.temp }}/Release
run: |
if [ -f perms.txt ]; then
echo "Restoring executable permissions in ${{ runner.temp }}/Release ..."
while IFS= read -r file; do
# Check relative path existence within the current directory
if [ -f "$file" ]; then
chmod +x "$file"
else
echo "Warning: File '$file' listed in perms.txt not found."
fi
done < perms.txt
echo "Permissions restored."
else
echo "Warning: perms.txt not found in artifact."
fi
# --- Run Tests using the downloaded build ---
# The run-build-script-in-docker action mounts ${{ runner.temp }} to /onnxruntime_src/build
# So build.py --build_dir build/Release inside the container correctly finds the artifacts.
- name: Test ONNX Runtime
id: test_step
uses: microsoft/onnxruntime-github-actions/run-build-script-in-docker@8bad63a3c05d448311dfa8e5f531171c97471aa1 # v0.0.12
with:
docker_image: ${{ steps.build_docker_image_step.outputs.full-image-name }}
build_config: Release
mode: 'test' # Set mode to test
execution_providers: 'cuda tensorrt'
extra_build_flags: '--use_binskim_compliant_compile_flags --build_wheel --cuda_version=12.8 --cuda_home=/usr/local/cuda-12.8 --cudnn_home=/usr/local/cuda-12.8 --use_tensorrt --tensorrt_home /usr --build_java --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=86 onnxruntime_BUILD_UNIT_TESTS=ON onnxruntime_ENABLE_CUDA_EP_INTERNAL_TESTS=ON'
python_path_prefix: 'PATH=/opt/python/cp310-cp310/bin:$PATH'