Skip to content

Commit 29c20cb

Browse files
authored
Split windows_tensorrt.yml to two parts (microsoft#25528)
It reduces the pipeline time for about 30 minutes. The tests still take about 1 hour, which should be reduced.
1 parent 6f4bb51 commit 29c20cb

File tree

1 file changed

+187
-30
lines changed

1 file changed

+187
-30
lines changed

.github/workflows/windows_tensorrt.yml

Lines changed: 187 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ concurrency:
1515
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
1616
cancel-in-progress: true
1717

18+
#TODO: enable --build_nodejs
1819
jobs:
19-
Windows_GPU_TensorRT_CI_Pipeline:
20+
build:
2021
name: Windows GPU TensorRT CI Pipeline
21-
runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Win2022-GPU-A10"]
22+
runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-vs2022-mms"]
2223
steps:
2324
- uses: actions/checkout@v4
2425
with:
25-
fetch-depth: 0 # Fetch all history for all tags and branches
26+
fetch-depth: 0
2627
submodules: 'none'
2728

2829
- uses: actions/setup-python@v5
@@ -36,29 +37,20 @@ jobs:
3637
architecture: x64
3738

3839
- name: Install python modules
39-
run: python -m pip install -r ${{ github.workspace }}\tools\ci_build\github\windows\python\requirements.txt
40+
run: python -m pip install -r .\tools\ci_build\github\windows\python\requirements.txt
41+
working-directory: ${{ github.workspace }}
4042
shell: cmd
4143

42-
- name: Download Primary CUDA SDK v12.2
43-
run: 'azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v12.2" ${{ runner.temp }}'
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
4449
shell: pwsh
45-
env:
46-
AZCOPY_AUTO_LOGIN_TYPE: MSI
47-
AZCOPY_MSI_CLIENT_ID: 63b63039-6328-442f-954b-5a64d124e5b4
4850

4951
- name: Download TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8
5052
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 }}'
5153
shell: pwsh
52-
env:
53-
AZCOPY_AUTO_LOGIN_TYPE: MSI
54-
AZCOPY_MSI_CLIENT_ID: 63b63039-6328-442f-954b-5a64d124e5b4
55-
56-
- name: Export GitHub Actions cache environment variables
57-
uses: actions/github-script@v7
58-
with:
59-
script: |
60-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
61-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
6254

6355
- name: Add CUDA to PATH
6456
shell: powershell
@@ -69,33 +61,198 @@ jobs:
6961
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\v12.2\extras\CUPTI\lib64"
7062
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\TensorRT-10.9.0.34.Windows10.x86_64.cuda-12.8\lib"
7163
72-
- name: Generate sln
73-
working-directory: ${{ runner.temp }}
64+
- uses: actions/setup-node@v4
65+
with:
66+
node-version: '20.x'
67+
68+
- uses: actions/setup-java@v4
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
7481
run: |
75-
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 --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
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 }}
7688
shell: cmd
7789

78-
- name: Build
90+
- uses: actions/setup-dotnet@v4
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
79112
working-directory: ${{ runner.temp }}
80113
run: |
81-
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 --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
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@v4
161+
with:
162+
fetch-depth: 0
163+
submodules: 'none'
164+
165+
- name: Download build artifacts
166+
uses: actions/download-artifact@v4
167+
with:
168+
name: build-artifacts
169+
path: ${{ runner.temp }}\build
170+
171+
- uses: actions/setup-python@v5
172+
with:
173+
python-version: '3.12'
174+
architecture: x64
175+
176+
- uses: actions/setup-node@v4
177+
with:
178+
node-version: '20.x'
179+
180+
- uses: actions/setup-java@v4
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 }}
82194
shell: cmd
83195

84-
- name: Add build dir to PATH
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
85208
shell: powershell
86209
run: |
87210
Write-Host "Adding CUDA to PATH"
88-
Add-Content -Path $env:GITHUB_PATH -Value "$env:RUNNER_TEMP\build\RelWithDebInfo\RelWithDebInfo"
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
89221
90222
- name: Install ONNX Runtime Wheel
91223
uses: ./.github/actions/install-onnxruntime-wheel
92224
with:
93225
whl-directory: ${{ runner.temp }}\build\RelWithDebInfo\RelWithDebInfo\dist
94226

95-
- name: Run tests
227+
- name: Run Tests
96228
working-directory: ${{ runner.temp }}
97229
run: |
98-
mklink /D /J ${{ github.workspace }}\RelWithDebInfo\models ${{ github.workspace }}\models
99-
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
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
100249
shell: cmd
101-
timeout-minutes: 180
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)