@@ -7,32 +7,84 @@ name: "CI: Test wheels"
77on :
88 workflow_call :
99 inputs :
10- host-platform :
10+ build-type :
1111 type : string
1212 required : true
13- python-version :
13+ host-platform :
1414 type : string
1515 required : true
1616 build-ctk-ver :
1717 type : string
1818 required : true
19- cuda-version :
20- type : string
21- required : true
2219 local-ctk :
2320 type : string
2421 required : true
25- runner :
22+ matrix_filter :
2623 type : string
27- required : true
24+ default : " . "
2825
2926jobs :
27+ compute-matrix :
28+ runs-on : ubuntu-latest
29+ env :
30+ BUILD_TYPE : ${{ inputs.build-type }}
31+ ARCH : ${{ (inputs.host-platform == 'linux-64' && 'amd64') ||
32+ (inputs.host-platform == 'linux-aarch64' && 'arm64') }}
33+ outputs :
34+ MATRIX : ${{ steps.compute-matrix.outputs.MATRIX }}
35+ steps :
36+ - name : Validate Test Type
37+ run : |
38+ if [[ "$BUILD_TYPE" != "pull-request" ]] && [[ "$BUILD_TYPE" != "nightly" ]] && [[ "$BUILD_TYPE" != "branch" ]]; then
39+ echo "Invalid build type! Must be one of 'nightly', 'pull-request', or 'branch'."
40+ exit 1
41+ fi
42+ - name : Compute Python Test Matrix
43+ id : compute-matrix
44+ run : |
45+ set -eo pipefail
46+ # Please keep the matrices sorted in ascending order by the following:
47+ #
48+ # [PY_VER, CUDA_VER, LINUX_VER, GPU, DRIVER]
49+ #
50+ gpu="l4"
51+ if [[ "${ARCH}" == "arm64" ]]; then
52+ gpu="a100"
53+ fi
54+ export MATRICES="
55+ pull-request:
56+ - { ARCH: ${ARCH}, PY_VER: '3.9', CUDA_VER: '11.8.0', LINUX_VER: 'rockylinux8', GPU: ${gpu}, DRIVER: 'earliest' }
57+ - { ARCH: ${ARCH}, PY_VER: '3.9', CUDA_VER: '12.0.1', LINUX_VER: 'ubuntu24.04', GPU: ${gpu}, DRIVER: 'latest' }
58+ - { ARCH: ${ARCH}, PY_VER: '3.13', CUDA_VER: '12.8.0', LINUX_VER: 'ubuntu22.04', GPU: ${gpu}, DRIVER: 'latest' }
59+ nightly:
60+ - { ARCH: ${ARCH}, PY_VER: '3.9', CUDA_VER: '11.8.0', LINUX_VER: 'rockylinux8', GPU: ${gpu}, DRIVER: 'earliest' }
61+ - { ARCH: ${ARCH}, PY_VER: '3.13', CUDA_VER: '12.8.0', LINUX_VER: 'ubuntu22.04', GPU: ${gpu}, DRIVER: 'latest' }
62+ "
63+
64+ # Use the nightly matrix for branch tests
65+ MATRIX_TYPE="${BUILD_TYPE}"
66+ if [[ "${MATRIX_TYPE}" == "branch" ]]; then
67+ MATRIX_TYPE="nightly"
68+ fi
69+ export MATRIX_TYPE
70+ TEST_MATRIX=$(yq -n 'env(MATRICES) | .[strenv(MATRIX_TYPE)]')
71+ export TEST_MATRIX
72+
73+ MATRIX="$(
74+ yq -n -o json 'env(TEST_MATRIX)' | \
75+ jq -c '${{ inputs.matrix_filter }} | if (. | length) > 0 then {include: .} else "Error: Empty matrix\n" | halt_error(1) end'
76+ )"
77+
78+ echo "MATRIX=${MATRIX}" | tee --append "${GITHUB_OUTPUT}"
79+
3080 test :
81+ needs : compute-matrix
82+ strategy :
83+ fail-fast : false
84+ matrix : ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
85+ runs-on : " linux-${{ matrix.ARCH }}-gpu-${{ matrix.GPU }}-${{ matrix.DRIVER }}-1"
3186 # The build stage could fail but we want the CI to keep moving.
3287 if : ${{ github.repository_owner == 'nvidia' && !cancelled() }}
33- runs-on : ${{ (inputs.runner == 'default' && inputs.host-platform == 'linux-64' && 'linux-amd64-gpu-v100-latest-1') ||
34- (inputs.runner == 'default' && inputs.host-platform == 'linux-aarch64' && 'linux-arm64-gpu-a100-latest-1') ||
35- (inputs.runner == 'H100' && 'linux-amd64-gpu-h100-latest-1') }}
3688 # Our self-hosted runners require a container
3789 # TODO: use a different (nvidia?) container
3890 container :
62114
63115 - name : Set environment variables
64116 run : |
65- PYTHON_VERSION_FORMATTED=$(echo '${{ inputs.python-version }}' | tr -d '.')
117+ PYTHON_VERSION_FORMATTED=$(echo '${{ matrix.PY_VER }}' | tr -d '.')
66118 if [[ "${{ inputs.host-platform }}" == linux* ]]; then
67119 REPO_DIR=$(pwd)
68120 elif [[ "${{ inputs.host-platform }}" == win* ]]; then
@@ -71,14 +123,14 @@ jobs:
71123 fi
72124
73125 BUILD_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ inputs.build-ctk-ver }})"
74- TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})"
126+ TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ matrix.CUDA_VER }})"
75127 if [[ $BUILD_CUDA_MAJOR != $TEST_CUDA_MAJOR ]]; then
76128 SKIP_CUDA_BINDINGS_TEST=1
77129 SKIP_CUDA_CORE_CYTHON_TEST=0
78130 else
79131 SKIP_CUDA_BINDINGS_TEST=0
80132 BUILD_CUDA_MINOR="$(cut -d '.' -f 2 <<< ${{ inputs.build-ctk-ver }})"
81- TEST_CUDA_MINOR="$(cut -d '.' -f 2 <<< ${{ inputs.cuda-version }})"
133+ TEST_CUDA_MINOR="$(cut -d '.' -f 2 <<< ${{ matrix.CUDA_VER }})"
82134 if [[ $BUILD_CUDA_MINOR != $TEST_CUDA_MINOR ]]; then
83135 SKIP_CUDA_CORE_CYTHON_TEST=1
84136 else
@@ -179,10 +231,10 @@ jobs:
179231 pwd
180232 ls -lahR $CUDA_CORE_ARTIFACTS_DIR
181233
182- - name : Set up Python ${{ inputs.python-version }}
234+ - name : Set up Python ${{ matrix.PY_VER }}
183235 uses : actions/setup-python@v5
184236 with :
185- python-version : ${{ inputs.python-version }}
237+ python-version : ${{ matrix.PY_VER }}
186238 env :
187239 # we use self-hosted runners on which setup-python behaves weirdly...
188240 AGENT_TOOLSDIRECTORY : " /opt/hostedtoolcache"
@@ -193,7 +245,7 @@ jobs:
193245 continue-on-error : false
194246 with :
195247 host-platform : ${{ inputs.host-platform }}
196- cuda-version : ${{ inputs.cuda-version }}
248+ cuda-version : ${{ matrix.CUDA_VER }}
197249
198250 - name : Set up latest cuda_sanitizer_api
199251 if : ${{ env.SETUP_SANITIZER == '1' }}
@@ -261,7 +313,7 @@ jobs:
261313 fi
262314 popd
263315 fi
264- TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})"
316+ TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ matrix.CUDA_VER }})"
265317 pushd "${CUDA_CORE_ARTIFACTS_DIR}"
266318 pip install $(ls *.whl)["cu${TEST_CUDA_MAJOR}"]
267319 popd
0 commit comments