From ab61cc98931b2af71de1c4f0d89b2ed5a336976f Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 16 Dec 2024 18:52:10 +0000 Subject: [PATCH] skip testing cuda.bindings if runtime CTK major version is older --- .github/workflows/gh-build-and-test.yml | 48 +++++++++++++++++-------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/.github/workflows/gh-build-and-test.yml b/.github/workflows/gh-build-and-test.yml index 8cc20bf3..2f3f4fbe 100644 --- a/.github/workflows/gh-build-and-test.yml +++ b/.github/workflows/gh-build-and-test.yml @@ -192,7 +192,8 @@ jobs: cuda-version: "12.6.2" runner: H100 name: Test (${{ matrix.host-platform }}, Python ${{ matrix.python-version }}, CUDA ${{ matrix.cuda-version }}, Runner ${{ matrix.runner }}) - if: ${{ (github.repository_owner == 'nvidia') }} + # The build stage could fail but we want the CI to keep moving. + if: ${{ (github.repository_owner == 'nvidia') && always() }} permissions: id-token: write # This is required for configure-aws-credentials contents: read # This is required for actions/checkout @@ -229,31 +230,40 @@ jobs: REPO_DIR=$(cygpath -w $PWD) fi + BUILD_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ needs.build.outputs.BUILD_CTK_VER }})" + TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})" + if [[ $BUILD_CUDA_MAJOR -gt $TEST_CUDA_MAJOR ]]; then + SKIP_CUDA_BINDINGS_TEST=1 + else + SKIP_CUDA_BINDINGS_TEST=0 + fi + # make outputs from the previous job as env vars echo "CUDA_CORE_ARTIFACT_NAME=cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ matrix.host-platform }}-${{ github.sha }}" >> $GITHUB_ENV echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV echo "CUDA_BINDINGS_ARTIFACT_NAME=cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ needs.build.outputs.BUILD_CTK_VER }}-${{ matrix.host-platform }}-${{ github.sha }}" >> $GITHUB_ENV echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV + echo "SKIP_CUDA_BINDINGS_TEST=${SKIP_CUDA_BINDINGS_TEST}" >> $GITHUB_ENV - - name: Download bindings build artifacts + - name: Download cuda.bindings build artifacts uses: actions/download-artifact@v4 with: name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }} path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} - - name: Display structure of downloaded bindings artifacts + - name: Display structure of downloaded cuda.bindings artifacts shell: bash --noprofile --norc -xeuo pipefail {0} run: | pwd ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR - - name: Download core build artifacts + - name: Download cuda.core build artifacts uses: actions/download-artifact@v4 with: name: ${{ env.CUDA_CORE_ARTIFACT_NAME }} path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} - - name: Display structure of downloaded core build artifacts + - name: Display structure of downloaded cuda.core build artifacts shell: bash --noprofile --norc -xeuo pipefail {0} run: | pwd @@ -271,24 +281,34 @@ jobs: host-platform: ${{ matrix.host-platform }} cuda-version: ${{ matrix.cuda-version }} - - name: Run test / analysis + - name: Run cuda.bindings tests + if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '0' }} shell: bash --noprofile --norc -xeuo pipefail {0} run: | ls $CUDA_PATH - REPO_DIR=$(pwd) - - cd "${CUDA_BINDINGS_ARTIFACTS_DIR}" - pip install *.whl - - cd "${CUDA_CORE_ARTIFACTS_DIR}" + pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}" pip install *.whl + popd - cd "${REPO_DIR}/cuda_bindings" + pushd "${REPO_DIR}/cuda_bindings" pip install -r requirements.txt pytest -rxXs tests/ # TODO: enable cython tests #pytest tests/cython + popd + + - name: Run cuda.core tests + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + if [[ $SKIP_CUDA_BINDINGS_TEST == 1 ]]; then + pip install cuda-python=="$(cut -d '.' -f 1,2 <<< ${{ inputs.cuda-version }}).*" + fi + + pushd "${CUDA_CORE_ARTIFACTS_DIR}" + pip install *.whl + popd - cd "${REPO_DIR}/cuda_core" + pushd "${REPO_DIR}/cuda_core" pytest -rxXs tests/ + popd