|
| 1 | +name: "Windows CUDA x64 Build" |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - rel-* |
| 8 | + pull_request: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +env: |
| 15 | + AZCOPY_AUTO_LOGIN_TYPE: MSI |
| 16 | + AZCOPY_MSI_CLIENT_ID: 63b63039-6328-442f-954b-5a64d124e5b4 |
| 17 | + cuda_dir: "${{ github.workspace }}\\cuda_sdk" |
| 18 | + cuda_version: "12.2" |
| 19 | + CUDA_PATH: ${{ github.workspace }}\\cuda_sdk\\v12.2 |
| 20 | + binaryDir: 'build/cuda/win-x64' |
| 21 | + ORT_NIGHTLY_REST_API: "https://feeds.dev.azure.com/aiinfra/PublicPackages/_apis/packaging/Feeds/ORT-Nightly/packages?packageNameQuery=Microsoft.ML.OnnxRuntime.Gpu.Windows&api-version=6.0-preview.1" |
| 22 | + ORT_PACKAGE_NAME: "Microsoft.ML.OnnxRuntime.Gpu.Windows" |
| 23 | + |
| 24 | +jobs: |
| 25 | + windows-cuda-x64-build: |
| 26 | + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-genai-Win2022-GPU-A10"] |
| 27 | + steps: |
| 28 | + - name: Checkout OnnxRuntime GenAI repo |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + submodules: true |
| 32 | + |
| 33 | + - uses: actions/setup-python@v5 |
| 34 | + with: |
| 35 | + python-version: '3.11.x' |
| 36 | + architecture: 'x64' |
| 37 | + |
| 38 | + - name: Setup VCPKG |
| 39 | + uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.6 |
| 40 | + with: |
| 41 | + vcpkg-version: '2025.03.19' |
| 42 | + vcpkg-hash: '17e96169cd3f266c4716fcdc1bb728e6a64f103941ece463a2834d50694eba4fb48f30135503fd466402afa139abc847ef630733c442595d1c34979f261b0114' |
| 43 | + cmake-version: '3.31.6' |
| 44 | + cmake-hash: '0f1584e8666cf4a65ec514bd02afe281caabf1d45d2c963f3151c41484f457386aa03273ab25776a670be02725354ce0b46f3a5121857416da37366342a833a0' |
| 45 | + add-cmake-to-path: 'true' |
| 46 | + disable-terrapin: 'false' |
| 47 | + |
| 48 | + - name: Download cuda |
| 49 | + run: | |
| 50 | + azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v${{ env.cuda_version }}" ${{ env.cuda_dir}} |
| 51 | +
|
| 52 | + - uses: actions/setup-dotnet@v4 |
| 53 | + with: |
| 54 | + dotnet-version: '8.0.x' |
| 55 | + |
| 56 | + - name: Install Rust Toolchain |
| 57 | + run: | |
| 58 | + $exePath = "$env:TEMP\rustup-init.exe" |
| 59 | + (New-Object Net.WebClient).DownloadFile('https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe', $exePath) |
| 60 | + & $exePath -y --default-toolchain=1.86.0 |
| 61 | + Add-Content $env:GITHUB_PATH "$env:USERPROFILE\.cargo\bin" |
| 62 | +
|
| 63 | + - name: Configure CMake |
| 64 | + run: | |
| 65 | + cmake --preset windows_x64_winml_relwithdebinfo -T cuda=${{ env.cuda_dir }}\\v${{ env.cuda_version }} -DWINML_SDK_VERSION=1.8.1078-preview-genai |
| 66 | +
|
| 67 | + - name: Build with CMake |
| 68 | + run: | |
| 69 | + cmake --build --preset windows_x64_winml_relwithdebinfo --parallel |
| 70 | + cmake --build --preset windows_x64_winml_relwithdebinfo --target PyPackageBuild |
| 71 | +
|
| 72 | + - name: Add CUDA to PATH |
| 73 | + run: | |
| 74 | + echo "${{ env.cuda_dir }}\\v${{ env.cuda_version }}\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 75 | +
|
| 76 | + - name: Install the Python Wheel and Test Dependencies |
| 77 | + run: | |
| 78 | + python -m pip install -r test\python\requirements.txt |
| 79 | + python -m pip install -r test\python\cuda\torch\requirements.txt |
| 80 | + python -m pip install -r test\python\cuda\ort\requirements.txt |
| 81 | + python -m pip install (Get-ChildItem ("$env:binaryDir\wheel\*.whl")) --no-deps |
| 82 | +
|
| 83 | + - name: Run the Python Tests |
| 84 | + run: | |
| 85 | + python test/python/test_onnxruntime_genai.py --cwd "test\python" --test_models "test\test_models" --e2e |
| 86 | +
|
| 87 | + - name: Verify Build Artifacts |
| 88 | + if: always() |
| 89 | + continue-on-error: true |
| 90 | + run: |2 |
| 91 | +
|
| 92 | + Get-ChildItem -Path $env:GITHUB_WORKSPACE\$env:binaryDir -Recurse |
| 93 | +
|
| 94 | + - name: Build the C# API and Run the C# Tests |
| 95 | + run: | |
| 96 | + $env:PATH = "${{ env.cuda_dir }}\\v${{ env.cuda_version }}\\bin;" + $env:PATH |
| 97 | + cd test\csharp |
| 98 | + dotnet test /p:Configuration=release /p:NativeBuildOutputDir="$env:GITHUB_WORKSPACE\$env:binaryDir\Release" /p:OrtLibDir="$env:GITHUB_WORKSPACE\ort\lib" |
| 99 | +
|
| 100 | + - name: Prepend CUDA to PATH and Run tests |
| 101 | + run: |- |
| 102 | + $env:PATH = "${{ env.cuda_dir }}\\v${{ env.cuda_version }}\\bin;" + $env:PATH |
| 103 | + echo "Current PATH variable is: $env:PATH" |
| 104 | + copy $env:GITHUB_WORKSPACE\ort\lib\* .\$env:binaryDir\Release |
| 105 | + & .\$env:binaryDir\Release\unit_tests.exe |
0 commit comments