Skip to content

Commit 86e6056

Browse files
committed
copy windows_tensorrt.yml from onnxruntime repo
1 parent e745237 commit 86e6056

File tree

1 file changed

+258
-0
lines changed

1 file changed

+258
-0
lines changed
Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
name: Windows GPU TensorRT CI Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- rel-*
8+
pull_request:
9+
branches:
10+
- main
11+
- rel-*
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
16+
cancel-in-progress: true
17+
18+
#TODO: enable --build_nodejs
19+
jobs:
20+
build:
21+
name: Windows GPU TensorRT CI Pipeline
22+
runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-vs2022-mms"]
23+
steps:
24+
- uses: actions/checkout@v5
25+
with:
26+
fetch-depth: 0
27+
submodules: 'none'
28+
29+
- uses: actions/setup-python@v6
30+
with:
31+
python-version: '3.12'
32+
architecture: x64
33+
34+
- name: Locate vcvarsall and Setup Env
35+
uses: ./.github/actions/locate-vcvarsall-and-setup-env
36+
with:
37+
architecture: x64
38+
39+
- name: Install python modules
40+
run: python -m pip install -r .\tools\ci_build\github\windows\python\requirements.txt
41+
working-directory: ${{ github.workspace }}
42+
shell: cmd
43+
44+
- name: Download CUDA SDK v12.2
45+
working-directory: ${{ runner.temp }}
46+
run: |
47+
azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v12.2" .
48+
dir
49+
shell: pwsh
50+
51+
- name: Download TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8
52+
run: 'azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/local/TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8" ${{ runner.temp }}'
53+
shell: pwsh
54+
55+
- name: Add CUDA to PATH
56+
shell: powershell
57+
run: |
58+
Write-Host "Adding CUDA to PATH"
59+
Write-Host "CUDA Path: $env:RUNNER_TEMP\v12.2\bin"
60+
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\v12.2\bin"
61+
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\v12.2\extras\CUPTI\lib64"
62+
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8\lib"
63+
64+
- uses: actions/setup-node@v5
65+
with:
66+
node-version: '20.x'
67+
68+
- uses: actions/setup-java@v5
69+
with:
70+
distribution: 'temurin'
71+
java-version: '17'
72+
architecture: x64
73+
74+
- uses: actions/cache@v4
75+
id: onnx-node-tests-cache
76+
with:
77+
path: ${{ github.workspace }}/js/test/
78+
key: onnxnodetests-${{ hashFiles('js/scripts/prepare-onnx-node-tests.ts') }}
79+
80+
- name: API Documentation Check and generate
81+
run: |
82+
set ORT_DOXY_SRC=${{ github.workspace }}
83+
set ORT_DOXY_OUT=${{ runner.temp }}\build\RelWithDebInfo\RelWithDebInfo
84+
mkdir %ORT_DOXY_SRC%
85+
mkdir %ORT_DOXY_OUT%
86+
"C:\Program Files\doxygen\bin\doxygen.exe" ${{ github.workspace }}\tools\ci_build\github\Doxyfile_csharp.cfg
87+
working-directory: ${{ github.workspace }}
88+
shell: cmd
89+
90+
- uses: actions/setup-dotnet@v5
91+
env:
92+
PROCESSOR_ARCHITECTURE: x64
93+
with:
94+
dotnet-version: '8.x'
95+
96+
- name: Use Nuget 6.x
97+
uses: nuget/setup-nuget@v2
98+
with:
99+
nuget-version: '6.x'
100+
101+
- name: NuGet restore
102+
run: nuget restore ${{ github.workspace }}\packages.config -ConfigFile ${{ github.workspace }}\NuGet.config -PackagesDirectory ${{ runner.temp }}\build\RelWithDebInfo
103+
shell: cmd
104+
105+
- name: Set OnnxRuntimeBuildDirectory
106+
shell: pwsh
107+
run: |
108+
$buildDir = Join-Path ${{ runner.temp }} "build"
109+
echo "OnnxRuntimeBuildDirectory=$buildDir" >> $env:GITHUB_ENV
110+
111+
- name: Build and Clean Binaries
112+
working-directory: ${{ runner.temp }}
113+
run: |
114+
npm install -g typescript
115+
if ($lastExitCode -ne 0) {
116+
exit $lastExitCode
117+
}
118+
# Execute the build process
119+
python ${{ github.workspace }}\tools\ci_build\build.py --config RelWithDebInfo --parallel --use_binskim_compliant_compile_flags --build_dir build --skip_submodule_sync --build_shared_lib --build --update --cmake_generator "Visual Studio 17 2022" --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="${{ runner.temp }}\TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8" --cuda_home="${{ runner.temp }}\v12.2" --use_vcpkg --use_vcpkg_ms_internal_asset_cache --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=86
120+
if ($lastExitCode -ne 0) {
121+
exit $lastExitCode
122+
}
123+
124+
# Clean up the output directory before uploading artifacts
125+
$outputDir = "${{ runner.temp }}\build\RelWithDebInfo"
126+
Write-Host "Cleaning up files from $outputDir..."
127+
128+
Remove-Item -Path "$outputDir\onnxruntime" -Recurse -Force -ErrorAction SilentlyContinue
129+
Remove-Item -Path "$outputDir\pybind11" -Recurse -Force -ErrorAction SilentlyContinue
130+
Remove-Item -Path "$outputDir\models" -Recurse -Force -ErrorAction SilentlyContinue
131+
Remove-Item -Path "$outputDir\vcpkg_installed" -Recurse -Force -ErrorAction SilentlyContinue
132+
Remove-Item -Path "$outputDir\_deps" -Recurse -Force -ErrorAction SilentlyContinue
133+
Remove-Item -Path "$outputDir\CMakeCache.txt" -Force -ErrorAction SilentlyContinue
134+
Remove-Item -Path "$outputDir\CMakeFiles" -Recurse -Force -ErrorAction SilentlyContinue
135+
# Remove intermediate object files as in the original script
136+
Remove-Item -Path $outputDir -Include "*.obj" -Recurse
137+
shell: pwsh
138+
139+
- name: Upload build artifacts
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: build-artifacts
143+
path: ${{ runner.temp }}\build
144+
env:
145+
OrtPackageId: Microsoft.ML.OnnxRuntime.Gpu
146+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
147+
setVcvars: true
148+
ALLOW_RELEASED_ONNX_OPSET_ONLY: '0'
149+
DocUpdateNeeded: false
150+
ONNXRUNTIME_TEST_GPU_DEVICE_ID: '0'
151+
AZCOPY_AUTO_LOGIN_TYPE: MSI
152+
AZCOPY_MSI_CLIENT_ID: 63b63039-6328-442f-954b-5a64d124e5b4
153+
154+
test:
155+
name: Windows GPU TensorRT CI Pipeline Test Job
156+
needs: build
157+
timeout-minutes: 300
158+
runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Win2022-GPU-A10"]
159+
steps:
160+
- uses: actions/checkout@v5
161+
with:
162+
fetch-depth: 0
163+
submodules: 'none'
164+
165+
- name: Download build artifacts
166+
uses: actions/download-artifact@v5
167+
with:
168+
name: build-artifacts
169+
path: ${{ runner.temp }}\build
170+
171+
- uses: actions/setup-python@v6
172+
with:
173+
python-version: '3.12'
174+
architecture: x64
175+
176+
- uses: actions/setup-node@v5
177+
with:
178+
node-version: '20.x'
179+
180+
- uses: actions/setup-java@v5
181+
with:
182+
distribution: 'temurin'
183+
java-version: '17'
184+
architecture: x64
185+
186+
- name: Locate vcvarsall and Setup Env
187+
uses: ./.github/actions/locate-vcvarsall-and-setup-env
188+
with:
189+
architecture: x64
190+
191+
- name: Install python modules
192+
run: python -m pip install -r .\tools\ci_build\github\windows\python\requirements.txt
193+
working-directory: ${{ github.workspace }}
194+
shell: cmd
195+
196+
- name: Download CUDA SDK v12.2
197+
working-directory: ${{ runner.temp }}
198+
run: |
199+
azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v12.2" .
200+
dir
201+
shell: pwsh
202+
203+
- name: Download TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8
204+
run: 'azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/local/TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8" ${{ runner.temp }}'
205+
shell: pwsh
206+
207+
- name: Add CUDA to PATH
208+
shell: powershell
209+
run: |
210+
Write-Host "Adding CUDA to PATH"
211+
Write-Host "CUDA Path: $env:RUNNER_TEMP\v12.2\bin"
212+
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\v12.2\bin"
213+
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\v12.2\extras\CUPTI\lib64"
214+
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8\lib"
215+
216+
- name: Set OnnxRuntimeBuildDirectory
217+
shell: pwsh
218+
run: |
219+
$buildDir = Join-Path ${{ runner.temp }} "build"
220+
echo "OnnxRuntimeBuildDirectory=$buildDir" >> $env:GITHUB_ENV
221+
222+
- name: Install ONNX Runtime Wheel
223+
uses: ./.github/actions/install-onnxruntime-wheel
224+
with:
225+
whl-directory: ${{ runner.temp }}\build\RelWithDebInfo\RelWithDebInfo\dist
226+
227+
- name: Run Tests
228+
working-directory: ${{ runner.temp }}
229+
run: |
230+
npm install -g typescript
231+
if ($lastExitCode -ne 0) {
232+
exit $lastExitCode
233+
}
234+
235+
python.exe ${{ github.workspace }}\tools\python\update_ctest_path.py "${{ runner.temp }}\build\RelWithDebInfo\CTestTestfile.cmake" "${{ runner.temp }}\build\RelWithDebInfo"
236+
if ($lastExitCode -ne 0) {
237+
exit $lastExitCode
238+
}
239+
240+
python ${{ github.workspace }}\tools\ci_build\build.py --config RelWithDebInfo --parallel --use_binskim_compliant_compile_flags --build_dir build --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 17 2022" --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="${{ runner.temp }}\TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8" --cuda_home="${{ runner.temp }}\v12.2" --use_vcpkg --use_vcpkg_ms_internal_asset_cache --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=86
241+
if ($lastExitCode -ne 0) {
242+
exit $lastExitCode
243+
}
244+
shell: pwsh
245+
246+
- name: Validate C# native delegates
247+
run: python tools\ValidateNativeDelegateAttributes.py
248+
working-directory: ${{ github.workspace }}\csharp
249+
shell: cmd
250+
env:
251+
OrtPackageId: Microsoft.ML.OnnxRuntime.Gpu
252+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
253+
setVcvars: true
254+
ALLOW_RELEASED_ONNX_OPSET_ONLY: '0'
255+
DocUpdateNeeded: false
256+
ONNXRUNTIME_TEST_GPU_DEVICE_ID: '0'
257+
AZCOPY_AUTO_LOGIN_TYPE: MSI
258+
AZCOPY_MSI_CLIENT_ID: 63b63039-6328-442f-954b-5a64d124e5b4

0 commit comments

Comments
 (0)