From 83023b62479fb86366de2f41051d612542939783 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Fri, 21 Aug 2026 16:03:24 -0400 Subject: [PATCH] Revert CTK installation workarounds --- .github/actions/fetch_ctk/action.yml | 224 +++++-------------- .github/workflows/build-docs.yml | 4 - .github/workflows/build-wheel.yml | 90 ++------ .github/workflows/ci.yml | 94 +------- .github/workflows/test-sdist-linux.yml | 5 - .github/workflows/test-sdist-windows.yml | 5 - ci/tools/fetch_ctk_redistrib.py | 266 +---------------------- ci/versions.yml | 3 +- conftest.py | 10 +- cuda_core/tests/conftest.py | 10 +- 10 files changed, 95 insertions(+), 616 deletions(-) diff --git a/.github/actions/fetch_ctk/action.yml b/.github/actions/fetch_ctk/action.yml index 5ffed69f99a..38896d0b262 100644 --- a/.github/actions/fetch_ctk/action.yml +++ b/.github/actions/fetch_ctk/action.yml @@ -11,10 +11,6 @@ inputs: required: true cuda-version: required: true - cuda-channel: - description: "CUDA package channel: stable redistributables or prerelease packages" - required: false - default: "stable" cuda-components: description: "A list of the CTK components to install as a comma-separated list. e.g. 'cuda_nvcc,cuda_nvrtc,cuda_cudart'" required: false @@ -34,52 +30,19 @@ runs: # Use the runtime workspace mount so this also works inside container jobs. CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py" CTK_CACHE_COMPONENTS=${{ inputs.cuda-components }} - CTK_PREVIEW_PACKAGES= - CTK_PREVIEW_INSTALLER_URL= - CTK_PREVIEW_INSTALLER_SHA256= - if [[ "${{ inputs.cuda-channel }}" == "stable" ]]; then - CTK_JSON_URL="https://developer.download.nvidia.com/compute/cuda/redist/redistrib_${{ inputs.cuda-version }}.json" - CTK_CACHE_COMPONENTS="$(python "$CTK_REDIST_TOOL" filter-components \ - --host-platform "${{ inputs.host-platform }}" \ - --cuda-version "${{ inputs.cuda-version }}" \ - --components "$CTK_CACHE_COMPONENTS" \ - --metadata-url "$CTK_JSON_URL")" - elif [[ "${{ inputs.cuda-channel }}" == "prerelease" ]]; then - if [[ "${{ inputs.host-platform }}" == linux* ]]; then - CTK_PREVIEW_PACKAGES="$(python "$CTK_REDIST_TOOL" preview-packages \ - --host-platform "${{ inputs.host-platform }}" \ - --cuda-version "${{ inputs.cuda-version }}" \ - --components "$CTK_CACHE_COMPONENTS")" - CTK_CACHE_COMPONENTS="$CTK_PREVIEW_PACKAGES" - elif [[ "${{ inputs.host-platform }}" == win* ]]; then - IFS=$'\t' read -r CTK_PREVIEW_INSTALLER_URL CTK_PREVIEW_INSTALLER_SHA256 <<< \ - "$(python "$CTK_REDIST_TOOL" preview-installer \ - --host-platform "${{ inputs.host-platform }}" \ - --cuda-version "${{ inputs.cuda-version }}")" - CTK_CACHE_COMPONENTS="${CTK_PREVIEW_INSTALLER_URL}:${CTK_PREVIEW_INSTALLER_SHA256}:${CTK_CACHE_COMPONENTS}" - else - echo "CUDA prerelease packages are not supported for host-platform ${{ inputs.host-platform }}" >&2 - exit 1 - fi - else - echo "Unsupported CUDA package channel: ${{ inputs.cuda-channel }}" >&2 - exit 1 - fi + CTK_JSON_URL="https://developer.download.nvidia.com/compute/cuda/redist/redistrib_${{ inputs.cuda-version }}.json" + CTK_CACHE_COMPONENTS="$(python "$CTK_REDIST_TOOL" filter-components \ + --host-platform "${{ inputs.host-platform }}" \ + --cuda-version "${{ inputs.cuda-version }}" \ + --components "$CTK_CACHE_COMPONENTS" \ + --metadata-url "$CTK_JSON_URL")" HASH=$(echo -n "${CTK_CACHE_COMPONENTS}" | sha256sum | awk '{print $1}') - CHANNEL_CACHE_SEGMENT= - if [[ "${{ inputs.cuda-channel }}" != "stable" ]]; then - CHANNEL_CACHE_SEGMENT="-${{ inputs.cuda-channel }}" - fi - echo "CTK_CACHE_KEY=mini-ctk${CHANNEL_CACHE_SEGMENT}-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH" >> $GITHUB_ENV + echo "CTK_CACHE_KEY=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH" >> $GITHUB_ENV echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH.tar.gz" >> $GITHUB_ENV echo "CTK_CACHE_COMPONENTS=${CTK_CACHE_COMPONENTS}" >> $GITHUB_ENV - echo "CTK_PREVIEW_PACKAGES=${CTK_PREVIEW_PACKAGES}" >> $GITHUB_ENV - echo "CTK_PREVIEW_INSTALLER_URL=${CTK_PREVIEW_INSTALLER_URL}" >> $GITHUB_ENV - echo "CTK_PREVIEW_INSTALLER_SHA256=${CTK_PREVIEW_INSTALLER_SHA256}" >> $GITHUB_ENV - name: Install dependencies - if: ${{ startsWith(inputs.host-platform, 'linux') }} uses: ./.github/actions/install_unix_deps continue-on-error: false with: @@ -102,135 +65,51 @@ runs: # Everything under this folder is packed and stored in the GitHub Cache space, # and unpacked after retrieving from the cache. CACHE_TMP_DIR="./cache_tmp_dir" - WORK_TMP_DIR="./cache_work_dir" - rm -rf $CACHE_TMP_DIR $WORK_TMP_DIR + rm -rf $CACHE_TMP_DIR mkdir $CACHE_TMP_DIR - CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py" - - if [[ "${{ inputs.cuda-channel }}" == "prerelease" ]]; then - if [[ "${{ inputs.host-platform }}" == linux* ]]; then - source /etc/os-release - DISTRO_CODENAME="${VERSION_CODENAME:-}" - case "$DISTRO_CODENAME" in - bookworm|jammy|noble|resolute|trixie) ;; - *) - echo "Unsupported distribution for CUDA prerelease packages: ${DISTRO_CODENAME:-unknown}" >&2 - exit 1 - ;; - esac - - KEYRING_DEB="$CACHE_TMP_DIR/nvidia-preview-keyring.deb" - curl -fLSs "https://packages.nvidia.com/${DISTRO_CODENAME}/nvidia-preview-keyring.deb" -o "$KEYRING_DEB" - sudo dpkg -i "$KEYRING_DEB" - sudo apt-get update - - DEB_DIR="$CACHE_TMP_DIR/debs" - DEB_ROOT="$CACHE_TMP_DIR/deb-root" - mkdir -p "$DEB_DIR/partial" "$DEB_ROOT" - DEB_DIR="$(realpath "$DEB_DIR")" - IFS=, read -ra PREVIEW_PACKAGES <<< "$CTK_PREVIEW_PACKAGES" - sudo apt-get install --yes --download-only --no-install-recommends \ - -o "Dir::Cache::archives=$DEB_DIR" \ - "${PREVIEW_PACKAGES[@]}" - for package in "$DEB_DIR"/*.deb; do - dpkg-deb -x "$package" "$DEB_ROOT" - done - - CUDA_SHORT_VERSION="${{ inputs.cuda-version }}" - CUDA_SHORT_VERSION="${CUDA_SHORT_VERSION%.*}" - CUDA_PACKAGE_ROOT="$DEB_ROOT/usr/local/cuda-${CUDA_SHORT_VERSION}" - if [[ ! -d "$CUDA_PACKAGE_ROOT/include" ]]; then - echo "CUDA prerelease packages did not provide $CUDA_PACKAGE_ROOT/include" >&2 - exit 1 - fi - cp -a "$CUDA_PACKAGE_ROOT/." "$CACHE_TMP_DIR/" - rm -rf "$DEB_DIR" "$DEB_ROOT" "$KEYRING_DEB" - elif [[ "${{ inputs.host-platform }}" == win* ]]; then - WORK_TMP_DIR="./cache_work_dir" - INSTALLER_PATH="$WORK_TMP_DIR/$(basename "$CTK_PREVIEW_INSTALLER_URL")" - EXTRACT_ROOT="$WORK_TMP_DIR/installer-root" - mkdir -p "$WORK_TMP_DIR" - curl -fLSs "$CTK_PREVIEW_INSTALLER_URL" -o "$INSTALLER_PATH" - echo "$CTK_PREVIEW_INSTALLER_SHA256 $INSTALLER_PATH" | sha256sum --check --strict - - - SEVEN_ZIP="$(command -v 7z || true)" - if [[ -z "$SEVEN_ZIP" && -x "/c/Program Files/7-Zip/7z.exe" ]]; then - SEVEN_ZIP="/c/Program Files/7-Zip/7z.exe" - fi - if [[ -z "$SEVEN_ZIP" || ! -x "$SEVEN_ZIP" ]]; then - echo "7-Zip is required to extract the CUDA prerelease installer" >&2 - exit 1 - fi - IFS=, read -ra PREVIEW_WINDOWS_ARCHIVES <<< \ - "$(python "$CTK_REDIST_TOOL" preview-windows-archives \ - --host-platform "${{ inputs.host-platform }}" \ - --cuda-version "${{ inputs.cuda-version }}" \ - --components "${{ inputs.cuda-components }}")" - - PREVIEW_WINDOWS_ARCHIVE_PATTERNS=() - for archive_dir in "${PREVIEW_WINDOWS_ARCHIVES[@]}"; do - PREVIEW_WINDOWS_ARCHIVE_PATTERNS+=("${archive_dir}/*") - done - - mkdir -p "$EXTRACT_ROOT" - "$SEVEN_ZIP" x -y "$INSTALLER_PATH" "${PREVIEW_WINDOWS_ARCHIVE_PATTERNS[@]}" "-o$EXTRACT_ROOT" - - python "$CTK_REDIST_TOOL" merge-windows-preview \ - --host-platform "${{ inputs.host-platform }}" \ - --cuda-version "${{ inputs.cuda-version }}" \ - --components "${{ inputs.cuda-components }}" \ - --extract-root "$EXTRACT_ROOT" \ - --destination "$CACHE_TMP_DIR" - - rm -rf "$WORK_TMP_DIR" - else - echo "CUDA prerelease extraction is not supported for host-platform ${{ inputs.host-platform }}" >&2 - exit 1 - fi - else - # The binary archives (redist) are guaranteed to be updated as part of the release posting. - # Use the runtime workspace mount so this also works inside container jobs. - CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/" - CTK_JSON_URL="$CTK_BASE_URL/redistrib_${{ inputs.cuda-version }}.json" - CTK_JSON_FILE="$CACHE_TMP_DIR/redistrib.json" - curl -fLSs "$CTK_JSON_URL" -o "$CTK_JSON_FILE" - if [[ "${{ inputs.host-platform }}" == linux* ]]; then - function extract() { - tar -xvf $1 -C $CACHE_TMP_DIR --strip-components=1 - } - elif [[ "${{ inputs.host-platform }}" == win* ]]; then - function extract() { - _TEMP_DIR_=$(mktemp -d) - unzip $1 -d $_TEMP_DIR_ - cp -r $_TEMP_DIR_/*/* $CACHE_TMP_DIR - rm -rf $_TEMP_DIR_ - # see commit NVIDIA/cuda-python@69410f1d9228e775845ef6c8b4a9c7f37ffc68a5 - chmod 644 $CACHE_TMP_DIR/LICENSE - } - fi - function populate_cuda_path() { - # take the component name as a argument - function download() { - curl -fLSs $1 -o $2 - } - CTK_COMPONENT=$1 - CTK_COMPONENT_REL_PATH="$(python "$CTK_REDIST_TOOL" component-relative-path \ - --host-platform "${{ inputs.host-platform }}" \ - --component "$CTK_COMPONENT" \ - --metadata-path "$CTK_JSON_FILE")" - CTK_COMPONENT_URL="${CTK_BASE_URL}/${CTK_COMPONENT_REL_PATH}" - CTK_COMPONENT_COMPONENT_FILENAME="$(basename $CTK_COMPONENT_REL_PATH)" - download $CTK_COMPONENT_URL $CTK_COMPONENT_COMPONENT_FILENAME - extract $CTK_COMPONENT_COMPONENT_FILENAME - rm $CTK_COMPONENT_COMPONENT_FILENAME + # The binary archives (redist) are guaranteed to be updated as part of the release posting. + # Use the runtime workspace mount so this also works inside container jobs. + CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py" + CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/" + CTK_JSON_URL="$CTK_BASE_URL/redistrib_${{ inputs.cuda-version }}.json" + CTK_JSON_FILE="$CACHE_TMP_DIR/redistrib.json" + curl -LSs "$CTK_JSON_URL" -o "$CTK_JSON_FILE" + if [[ "${{ inputs.host-platform }}" == linux* ]]; then + function extract() { + tar -xvf $1 -C $CACHE_TMP_DIR --strip-components=1 + } + elif [[ "${{ inputs.host-platform }}" == "win-64" ]]; then + function extract() { + _TEMP_DIR_=$(mktemp -d) + unzip $1 -d $_TEMP_DIR_ + cp -r $_TEMP_DIR_/*/* $CACHE_TMP_DIR + rm -rf $_TEMP_DIR_ + # see commit NVIDIA/cuda-python@69410f1d9228e775845ef6c8b4a9c7f37ffc68a5 + chmod 644 $CACHE_TMP_DIR/LICENSE } - - # Get headers and shared libraries in place - for item in $(echo $CTK_CACHE_COMPONENTS | tr ',' ' '); do - populate_cuda_path "$item" - done fi + function populate_cuda_path() { + # take the component name as a argument + function download() { + curl -LSs $1 -o $2 + } + CTK_COMPONENT=$1 + CTK_COMPONENT_REL_PATH="$(python "$CTK_REDIST_TOOL" component-relative-path \ + --host-platform "${{ inputs.host-platform }}" \ + --component "$CTK_COMPONENT" \ + --metadata-path "$CTK_JSON_FILE")" + CTK_COMPONENT_URL="${CTK_BASE_URL}/${CTK_COMPONENT_REL_PATH}" + CTK_COMPONENT_COMPONENT_FILENAME="$(basename $CTK_COMPONENT_REL_PATH)" + download $CTK_COMPONENT_URL $CTK_COMPONENT_COMPONENT_FILENAME + extract $CTK_COMPONENT_COMPONENT_FILENAME + rm $CTK_COMPONENT_COMPONENT_FILENAME + } + + # Get headers and shared libraries in place + for item in $(echo $CTK_CACHE_COMPONENTS | tr ',' ' '); do + populate_cuda_path "$item" + done # TODO: check Windows if [[ "${{ inputs.host-platform }}" == linux* && -d "${CACHE_TMP_DIR}/lib" ]]; then mv $CACHE_TMP_DIR/lib $CACHE_TMP_DIR/lib64 @@ -277,12 +156,7 @@ runs: cp -r $CACHE_TMP_DIR/* $CUDA_PATH rm -rf $CACHE_TMP_DIR $CTK_CACHE_FILENAME ls -l $CUDA_PATH - # redistrib.json is present for stable-channel installs; include/ is - # present for prerelease installs (enforced at cache-creation time). - # Components that don't ship headers (e.g. cuda_sanitizer_api) have - # neither, so checking only for include/ incorrectly rejects them. - if [[ ! -e "$CUDA_PATH/redistrib.json" && ! -d "$CUDA_PATH/include" ]]; then - echo "CTK restore appears incomplete: neither redistrib.json nor include/ found in $CUDA_PATH" >&2 + if [ ! -d "$CUDA_PATH/include" ]; then exit 1 fi diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 32a92214648..7bb70809556 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -64,10 +64,8 @@ jobs: run: | if [[ -f ci/versions.yml ]]; then BUILD_CTK_VER=$(yq '.cuda.build.version' ci/versions.yml) - BUILD_CTK_CHANNEL=$(yq '.cuda.build.channel // "stable"' ci/versions.yml) elif [[ -f ci/versions.json ]]; then BUILD_CTK_VER=$(jq -r '.cuda.build.version' ci/versions.json) - BUILD_CTK_CHANNEL=$(jq -r '.cuda.build.channel // "stable"' ci/versions.json) else echo "error: cannot find ci/versions.yml or ci/versions.json" >&2 exit 1 @@ -77,7 +75,6 @@ jobs: exit 1 fi echo "BUILD_CTK_VER=${BUILD_CTK_VER}" >> "$GITHUB_ENV" - echo "BUILD_CTK_CHANNEL=${BUILD_CTK_CHANNEL}" >> "$GITHUB_ENV" # TODO: This workflow runs on GH-hosted runner and cannot use the proxy cache @@ -103,7 +100,6 @@ jobs: with: host-platform: linux-64 cuda-version: ${{ env.BUILD_CTK_VER }} - cuda-channel: ${{ env.BUILD_CTK_CHANNEL }} - name: Set environment variables run: | diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml index a1fad62c3de..d8a34baaf13 100644 --- a/.github/workflows/build-wheel.yml +++ b/.github/workflows/build-wheel.yml @@ -11,22 +11,9 @@ on: cuda-version: required: true type: string - cuda-channel: - required: false - type: string - default: stable prev-cuda-version: required: true type: string - python-versions: - required: false - type: string - default: '["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15", "3.15t"]' - single-cuda-major: - description: "Build wheels for only the current CUDA major; skip the prior-major build and wheel merge" - required: false - type: boolean - default: false defaults: run: @@ -40,12 +27,19 @@ jobs: strategy: fail-fast: false matrix: - python-version: ${{ fromJSON(inputs.python-versions) }} + python-version: + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" + - "3.14t" + - "3.15" + - "3.15t" name: py${{ matrix.python-version }} runs-on: ${{ (inputs.host-platform == 'linux-64' && 'linux-amd64-cpu8') || (inputs.host-platform == 'linux-aarch64' && 'linux-arm64-cpu8') || - (inputs.host-platform == 'win-64' && 'windows-2022') || - (inputs.host-platform == 'win-arm64' && 'windows-11-arm') }} + (inputs.host-platform == 'win-64' && 'windows-2022') }} steps: - name: Checkout ${{ github.event.repository.name }} uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -77,7 +71,7 @@ jobs: uses: nv-gha-runners/setup-proxy-cache@main continue-on-error: true # Skip cache on GitHub-hosted Windows runners. - if: ${{ !startsWith(inputs.host-platform, 'win') }} + if: ${{ inputs.host-platform != 'win-64' }} with: enable-apt: true @@ -88,31 +82,22 @@ jobs: # WAR: setup-python is not relocatable, and cibuildwheel hard-wires to 3.12... # see https://github.com/actions/setup-python/issues/871 python-version: "3.12" - architecture: ${{ ((inputs.host-platform == 'linux-aarch64' || inputs.host-platform == 'win-arm64') && 'arm64') || 'x64' }} - name: Set up MSVC if: ${{ startsWith(inputs.host-platform, 'win') }} uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1.13.1 - with: - arch: ${{ (inputs.host-platform == 'win-arm64' && 'arm64') || 'x64' }} - - - name: Verify Windows ARM64 runner - if: ${{ inputs.host-platform == 'win-arm64' }} - run: | - python -c "import platform; machine = platform.machine().lower(); print(machine); assert machine in {'arm64', 'aarch64'}" - name: Set up yq # GitHub made an unprofessional decision to not provide it in their Windows VMs, # see https://github.com/actions/runner-images/issues/7443. - if: ${{ startsWith(inputs.host-platform, 'win') && !inputs.single-cuda-major }} + if: ${{ startsWith(inputs.host-platform, 'win') }} env: YQ_VERSION: v4.52.5 - YQ_ARCH: ${{ (inputs.host-platform == 'win-arm64' && 'arm64') || 'amd64' }} - YQ_SHA256: ${{ (inputs.host-platform == 'win-arm64' && '236867affa7f18701d4c763cf16b6df962cf4f7e89a8570a5954cf94a38f41c7') || '47594981f3848a4b4447494adeca9555f908f7cf0a89c4da3fd0243a4631da1c' }} + YQ_SHA256: 47594981f3848a4b4447494adeca9555f908f7cf0a89c4da3fd0243a4631da1c YQ_DIR: yq shell: pwsh -command ". '{0}'" run: | - $yqUrl = "https://github.com/mikefarah/yq/releases/download/${env:YQ_VERSION}/yq_windows_${env:YQ_ARCH}.exe" + $yqUrl = "https://github.com/mikefarah/yq/releases/download/${env:YQ_VERSION}/yq_windows_amd64.exe" mkdir -Force -ErrorAction SilentlyContinue "${env:YQ_DIR}" | Out-Null Invoke-WebRequest -UseBasicParsing -OutFile "${env:YQ_DIR}/yq.exe" -Uri "$yqUrl" $hash = (Get-FileHash -Algorithm SHA256 "${env:YQ_DIR}/yq.exe").Hash.ToLower() @@ -179,7 +164,6 @@ jobs: with: host-platform: ${{ inputs.host-platform }} cuda-version: ${{ inputs.cuda-version }} - cuda-channel: ${{ inputs.cuda-channel }} - name: Build cuda.bindings wheel uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 @@ -188,7 +172,6 @@ jobs: output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} env: CIBW_BUILD: ${{ env.CIBW_BUILD }} - CIBW_ARCHS_WINDOWS: ${{ (inputs.host-platform == 'win-arm64' && 'ARM64') || 'AMD64' }} # TODO: remove cpython-prerelease once 3.15 is officially supported # Allow CPython pre-release builds (currently 3.15 / 3.15t). This is a # no-op for stable Python versions because CIBW_BUILD still filters @@ -222,7 +205,7 @@ jobs: echo "ok!" - name: Report sccache stats (cuda.bindings) - if: ${{ !startsWith(inputs.host-platform, 'win') }} + if: ${{ inputs.host-platform != 'win-64' }} uses: ./.github/actions/sccache-summary with: json-file: sccache_bindings.json @@ -257,7 +240,6 @@ jobs: output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} env: CIBW_BUILD: ${{ env.CIBW_BUILD }} - CIBW_ARCHS_WINDOWS: ${{ (inputs.host-platform == 'win-arm64' && 'ARM64') || 'AMD64' }} # TODO: remove cpython-prerelease once 3.15 is officially supported # Allow CPython pre-release builds (currently 3.15 / 3.15t). This is a # no-op for stable Python versions because CIBW_BUILD still filters @@ -295,7 +277,7 @@ jobs: echo "ok!" - name: Report sccache stats (cuda.core) - if: ${{ !startsWith(inputs.host-platform, 'win') }} + if: ${{ inputs.host-platform != 'win-64' }} uses: ./.github/actions/sccache-summary with: json-file: sccache_core.json @@ -324,15 +306,6 @@ jobs: ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }} - - name: Finalize single-major cuda.core wheel - if: ${{ inputs.single-cuda-major }} - run: | - for wheel in "${{ env.CUDA_CORE_ARTIFACTS_DIR }}"/cu"${BUILD_CUDA_MAJOR}"/*.cu"${BUILD_CUDA_MAJOR}".whl; do - base_name=$(basename "${wheel}" ".cu${BUILD_CUDA_MAJOR}.whl") - mv "${wheel}" "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/${base_name}.whl" - done - ls -lahR "${{ env.CUDA_CORE_ARTIFACTS_DIR }}" - # We only need/want a single pure python wheel, pick linux-64 index 0. - name: Build and check cuda-python wheel if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} @@ -362,7 +335,6 @@ jobs: if-no-files-found: error - name: Set up Python - if: ${{ !inputs.single-cuda-major }} id: setup-python2 uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: @@ -371,15 +343,13 @@ jobs: # When 3.15 is officially supported we can also remove the `allow-prereleases` override. python-version: ${{ startsWith(matrix.python-version, '3.15') && '3.15.0-beta.2' || matrix.python-version }} freethreaded: ${{ endsWith(matrix.python-version, 't') }} - architecture: ${{ ((inputs.host-platform == 'linux-aarch64' || inputs.host-platform == 'win-arm64') && 'arm64') || 'x64' }} allow-prereleases: ${{ startsWith(matrix.python-version, '3.15') }} - name: verify free-threaded build - if: ${{ !inputs.single-cuda-major && endsWith(matrix.python-version, 't') }} + if: endsWith(matrix.python-version, 't') run: python -c 'import sys; assert not sys._is_gil_enabled()' - name: Set up Python include paths - if: ${{ !inputs.single-cuda-major }} run: | if [[ "${{ inputs.host-platform }}" == linux* ]]; then echo "CPLUS_INCLUDE_PATH=${Python3_ROOT_DIR}/include/python${{ matrix.python-version }}" >> $GITHUB_ENV @@ -390,12 +360,11 @@ jobs: echo "PY_EXT_SUFFIX=$(python -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")" >> $GITHUB_ENV - name: Install cuda.pathfinder (required for next step) - if: ${{ !inputs.single-cuda-major }} run: | pip install cuda_pathfinder/*.whl - name: Hide GNU link.exe so Meson finds MSVC link.exe - if: ${{ !inputs.single-cuda-major && startsWith(inputs.host-platform, 'win') }} + if: ${{ startsWith(inputs.host-platform, 'win') }} run: | if [ -f "/c/Program Files/Git/usr/bin/link.exe" ]; then mv "/c/Program Files/Git/usr/bin/link.exe" "/c/Program Files/Git/usr/bin/link.exe.bak" @@ -404,7 +373,7 @@ jobs: # TODO: remove the numpy pre-build steps once 3.15 is officially supported # (numpy will publish pre-built 3.15 wheels at that point) - name: Download and patch numpy sdist (pre-release Python) - if: ${{ !inputs.single-cuda-major && startsWith(matrix.python-version, '3.15') }} + if: ${{ startsWith(matrix.python-version, '3.15') }} run: | pip download --no-binary numpy --no-deps "numpy>=1.21.1" -d numpy-sdist/ cd numpy-sdist && tar xf numpy-*.tar.gz && rm numpy-*.tar.gz @@ -431,13 +400,12 @@ jobs: echo "NUMPY_SRC_DIR=$(pwd)/$(ls -d numpy-*/)" >> $GITHUB_ENV - name: Build numpy wheel (pre-release Python) - if: ${{ !inputs.single-cuda-major && startsWith(matrix.python-version, '3.15') }} + if: ${{ startsWith(matrix.python-version, '3.15') }} uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 env: CIBW_BUILD: ${{ env.CIBW_BUILD }} CIBW_SKIP: "*-musllinux* *-win32" CIBW_ARCHS_LINUX: "native" - CIBW_ARCHS_WINDOWS: ${{ (inputs.host-platform == 'win-arm64' && 'ARM64') || 'AMD64' }} CIBW_BUILD_VERBOSITY: 1 CIBW_CONFIG_SETTINGS: "setup-args=-Dallow-noblas=true" CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv setup-args=-Dallow-noblas=true" @@ -449,7 +417,7 @@ jobs: output-dir: numpy-wheel/ - name: Upload numpy wheel - if: ${{ !inputs.single-cuda-major && startsWith(matrix.python-version, '3.15') }} + if: ${{ startsWith(matrix.python-version, '3.15') }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }} @@ -457,11 +425,10 @@ jobs: if-no-files-found: error - name: Install numpy wheel - if: ${{ !inputs.single-cuda-major && startsWith(matrix.python-version, '3.15') }} + if: ${{ startsWith(matrix.python-version, '3.15') }} run: pip install numpy-wheel/*.whl - name: Build cuda.bindings Cython tests - if: ${{ !inputs.single-cuda-major }} run: | pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl --group ./cuda_bindings/pyproject.toml:test pushd ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }} @@ -469,7 +436,6 @@ jobs: popd - name: Upload cuda.bindings Cython tests - if: ${{ !inputs.single-cuda-major }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}-tests @@ -477,7 +443,6 @@ jobs: if-no-files-found: error - name: Build cuda.core Cython tests - if: ${{ !inputs.single-cuda-major }} run: | pip install ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/"cu${BUILD_CUDA_MAJOR}"/*.whl --group ./cuda_core/pyproject.toml:test pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }} @@ -485,7 +450,6 @@ jobs: popd - name: Upload cuda.core Cython tests - if: ${{ !inputs.single-cuda-major }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-tests @@ -494,7 +458,6 @@ jobs: # Note: This overwrites CUDA_PATH etc - name: Set up mini CTK - if: ${{ !inputs.single-cuda-major }} uses: ./.github/actions/fetch_ctk continue-on-error: false with: @@ -503,13 +466,11 @@ jobs: cuda-path: "./cuda_toolkit_prev" - name: Build cuda.core test binaries - if: ${{ !inputs.single-cuda-major }} run: | nvcc --version python "${{ env.CUDA_CORE_TEST_BINARIES_DIR }}/build_test_binaries.py" - name: Upload cuda.core test binaries - if: ${{ !inputs.single-cuda-major }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-test-binaries @@ -520,7 +481,6 @@ jobs: if-no-files-found: error - name: Download cuda.bindings build artifacts from the prior branch - if: ${{ !inputs.single-cuda-major }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -548,14 +508,12 @@ jobs: rmdir $OLD_BASENAME - name: Build cuda.core wheel - if: ${{ !inputs.single-cuda-major }} uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 with: package-dir: ./cuda_core/ output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} env: CIBW_BUILD: ${{ env.CIBW_BUILD }} - CIBW_ARCHS_WINDOWS: ${{ (inputs.host-platform == 'win-arm64' && 'ARM64') || 'AMD64' }} # TODO: remove cpython-prerelease once 3.15 is officially supported # Allow CPython pre-release builds (currently 3.15 / 3.15t). This is a # no-op for stable Python versions because CIBW_BUILD still filters @@ -593,7 +551,7 @@ jobs: echo "ok!" - name: Report sccache stats (cuda.core prev) - if: ${{ !inputs.single-cuda-major && !startsWith(inputs.host-platform, 'win') }} + if: ${{ inputs.host-platform != 'win-64' }} uses: ./.github/actions/sccache-summary with: json-file: sccache_core_prev.json @@ -601,7 +559,6 @@ jobs: build-step: "Build cuda.core wheel" - name: List the cuda.core artifacts directory and rename - if: ${{ !inputs.single-cuda-major }} run: | if [[ "${{ inputs.host-platform }}" == win* ]]; then export CHOWN=chown @@ -625,7 +582,6 @@ jobs: ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }} - name: Merge cuda.core wheels - if: ${{ !inputs.single-cuda-major }} run: | pip install wheel python ci/tools/merge_cuda_core_wheels.py \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1d7071b7c7..fe43b52d01a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,6 @@ jobs: runs-on: ubuntu-latest outputs: CUDA_BUILD_VER: ${{ steps.get-vars.outputs.cuda_build_ver }} - CUDA_BUILD_CHANNEL: ${{ steps.get-vars.outputs.cuda_build_channel }} CUDA_PREV_BUILD_VER: ${{ steps.get-vars.outputs.cuda_prev_build_ver }} steps: - name: Checkout repository @@ -44,9 +43,6 @@ jobs: cuda_build_ver=$(yq '.cuda.build.version' ci/versions.yml) echo "cuda_build_ver=$cuda_build_ver" >> $GITHUB_OUTPUT - cuda_build_channel=$(yq '.cuda.build.channel // "stable"' ci/versions.yml) - echo "cuda_build_channel=$cuda_build_channel" >> $GITHUB_OUTPUT - cuda_prev_build_ver=$(yq '.cuda.prev_build.version' ci/versions.yml) echo "cuda_prev_build_ver=$cuda_prev_build_ver" >> $GITHUB_OUTPUT @@ -254,7 +250,6 @@ jobs: with: host-platform: ${{ matrix.host-platform }} cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} - cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }} prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }} # See build-linux-64 for why build jobs are split by platform. @@ -274,40 +269,13 @@ jobs: with: host-platform: ${{ matrix.host-platform }} cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} - cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }} prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }} - # Warm the shared CTK cache before the Windows matrix starts. This avoids - # downloading the multi-gigabyte prerelease installer once per Python job. - prepare-windows-ctk: - needs: - - ci-vars - - should-skip - name: Prepare win-64 CTK ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} - if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) }} - runs-on: windows-2022 - steps: - - name: Checkout repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - with: - fetch-depth: 1 - - name: Set up Python - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 - with: - python-version: "3.12" - - name: Populate mini CTK cache - uses: ./.github/actions/fetch_ctk - with: - host-platform: win-64 - cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} - cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }} - # See build-linux-64 for why build jobs are split by platform. build-windows: needs: - ci-vars - should-skip - - prepare-windows-ctk strategy: fail-fast: false matrix: @@ -320,25 +288,7 @@ jobs: with: host-platform: ${{ matrix.host-platform }} cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} - cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }} - prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }} - - # Windows ARM64 supports only the current CUDA major because the platform is - # new in CUDA 13.4; no prior-major toolkit or wheel artifacts exist. - build-windows-arm64: - needs: - - ci-vars - - should-skip - name: Build win-arm64, CUDA ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} - if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) && needs.ci-vars.outputs.CUDA_BUILD_CHANNEL == 'prerelease' }} - secrets: inherit - uses: ./.github/workflows/build-wheel.yml - with: - host-platform: win-arm64 - cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} - cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }} prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }} - single-cuda-major: true # NOTE: test-sdist jobs are split by platform (mirroring build-* and test-wheel-*) # so platform-specific sources (e.g. cuda_bindings/*_windows.pyx selected by @@ -357,14 +307,12 @@ jobs: with: host-platform: linux-64 cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} - cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }} # See test-sdist-linux for why sdist test jobs are split by platform. test-sdist-windows: needs: - ci-vars - should-skip - - prepare-windows-ctk name: Test sdist win-64 if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) }} secrets: inherit @@ -372,7 +320,6 @@ jobs: with: host-platform: win-64 cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} - cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }} # NOTE: Test jobs are split by platform for the same reason as build jobs (see # build-linux-64). Keep these job definitions textually identical except for: @@ -436,7 +383,7 @@ jobs: host-platform: - win-64 name: Test ${{ matrix.host-platform }} - if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.doc-only) && needs.ci-vars.outputs.CUDA_BUILD_CHANNEL != 'prerelease' }} + if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.doc-only) }} permissions: contents: read # This is required for actions/checkout needs: @@ -474,11 +421,8 @@ jobs: if: always() runs-on: ubuntu-latest needs: - - ci-vars - should-skip - detect-changes - - build-windows - - build-windows-arm64 - test-sdist-linux - test-sdist-windows - test-linux-64 @@ -503,7 +447,6 @@ jobs: fi doc_only="${{ needs.should-skip.outputs.doc-only }}" - cuda_build_channel="${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }}" status="success" check_result() { name=$1; expected=$2; result=$3 @@ -515,37 +458,16 @@ jobs: } # always expected to succeed (even in [doc-only] mode) - check_result "ci-vars" "success" "${{ needs.ci-vars.result }}" check_result "should-skip" "success" "${{ needs.should-skip.result }}" check_result "detect-changes" "success" "${{ needs.detect-changes.result }}" check_result "doc" "success" "${{ needs.doc.result }}" - # [doc-only] skips all builds and tests. Windows preview wheel builds - # run, but GPU tests remain skipped until suitable runners are available. - if [[ "$doc_only" == "true" ]]; then - linux_expected="skipped" - windows_build_expected="skipped" - windows_arm_build_expected="skipped" - windows_sdist_expected="skipped" - windows_test_expected="skipped" - else - linux_expected="success" - windows_build_expected="success" - windows_sdist_expected="success" - if [[ "$cuda_build_channel" == "prerelease" ]]; then - windows_arm_build_expected="success" - windows_test_expected="skipped" - else - windows_arm_build_expected="skipped" - windows_test_expected="success" - fi - fi - check_result "build-windows" "$windows_build_expected" "${{ needs.build-windows.result }}" - check_result "build-windows-arm64" "$windows_arm_build_expected" "${{ needs.build-windows-arm64.result }}" - check_result "test-sdist-linux" "$linux_expected" "${{ needs.test-sdist-linux.result }}" - check_result "test-sdist-windows" "$windows_sdist_expected" "${{ needs.test-sdist-windows.result }}" - check_result "test-linux-64" "$linux_expected" "${{ needs.test-linux-64.result }}" - check_result "test-linux-aarch64" "$linux_expected" "${{ needs.test-linux-aarch64.result }}" - check_result "test-windows" "$windows_test_expected" "${{ needs.test-windows.result }}" + # [doc-only] flips these from 'success' to 'skipped' + if [[ "$doc_only" == "true" ]]; then expected="skipped"; else expected="success"; fi + check_result "test-sdist-linux" "$expected" "${{ needs.test-sdist-linux.result }}" + check_result "test-sdist-windows" "$expected" "${{ needs.test-sdist-windows.result }}" + check_result "test-linux-64" "$expected" "${{ needs.test-linux-64.result }}" + check_result "test-linux-aarch64" "$expected" "${{ needs.test-linux-aarch64.result }}" + check_result "test-windows" "$expected" "${{ needs.test-windows.result }}" [[ "$status" == "success" ]] diff --git a/.github/workflows/test-sdist-linux.yml b/.github/workflows/test-sdist-linux.yml index cc00dfee680..9d077912f3c 100644 --- a/.github/workflows/test-sdist-linux.yml +++ b/.github/workflows/test-sdist-linux.yml @@ -11,10 +11,6 @@ on: cuda-version: required: true type: string - cuda-channel: - required: false - type: string - default: stable defaults: run: @@ -84,7 +80,6 @@ jobs: with: host-platform: ${{ inputs.host-platform }} cuda-version: ${{ inputs.cuda-version }} - cuda-channel: ${{ inputs.cuda-channel }} # cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH # (set by fetch_ctk) must be available for both sdist and wheel builds. diff --git a/.github/workflows/test-sdist-windows.yml b/.github/workflows/test-sdist-windows.yml index c0e4b2abc55..043bacc1cad 100644 --- a/.github/workflows/test-sdist-windows.yml +++ b/.github/workflows/test-sdist-windows.yml @@ -17,10 +17,6 @@ on: cuda-version: required: true type: string - cuda-channel: - required: false - type: string - default: stable defaults: run: @@ -74,7 +70,6 @@ jobs: with: host-platform: ${{ inputs.host-platform }} cuda-version: ${{ inputs.cuda-version }} - cuda-channel: ${{ inputs.cuda-channel }} # cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH # (set by fetch_ctk) must be available for both sdist and wheel builds. diff --git a/ci/tools/fetch_ctk_redistrib.py b/ci/tools/fetch_ctk_redistrib.py index af453c699a5..5007765516e 100644 --- a/ci/tools/fetch_ctk_redistrib.py +++ b/ci/tools/fetch_ctk_redistrib.py @@ -4,18 +4,16 @@ # # SPDX-License-Identifier: Apache-2.0 -"""Resolve mini-CTK components and prerelease installers.""" +"""Resolve mini-CTK components from NVIDIA redistrib metadata.""" from __future__ import annotations import argparse import json -import shutil import sys import urllib.error import urllib.parse import urllib.request -from dataclasses import dataclass from pathlib import Path from typing import Any @@ -23,7 +21,6 @@ "linux-64": "linux-x86_64", "linux-aarch64": "linux-sbsa", "win-64": "windows-x86_64", - "win-arm64": "windows-arm64", } # CTK 13.3.0 renamed the redistrib key from cuda_cccl to cccl. @@ -31,68 +28,6 @@ "cuda_cccl": ("cccl",), } -PREVIEW_COMPONENT_PACKAGES: dict[str, str] = { - "cuda_cccl": "cccl", - "cuda_crt": "cuda-crt", - "cuda_cudart": "cuda-cudart-dev", - "cuda_cupti": "cuda-cupti-dev", - "cuda_nvcc": "cuda-nvcc", - "cuda_nvrtc": "cuda-nvrtc-dev", - "cuda_profiler_api": "cuda-profiler-api", - "libcudla": "libcudla-dev", - "libcufile": "libcufile-dev", - "libnvfatbin": "libnvfatbin-dev", - "libnvjitlink": "libnvjitlink-dev", - "libnvvm": "libnvvm", -} - -# Top-level directories inside the Windows local installer archive. -PREVIEW_WINDOWS_ARCHIVE_DIRS: dict[str, str] = { - "cuda_cccl": "cccl", - "cuda_crt": "cuda_crt", - "cuda_cudart": "cuda_cudart", - "cuda_cupti": "cuda_cupti", - "cuda_nvcc": "cuda_nvcc", - "cuda_nvrtc": "cuda_nvrtc", - "cuda_profiler_api": "cuda_profiler_api", - "libnvfatbin": "libnvfatbin", - "libnvjitlink": "libnvjitlink", - "libnvvm": "libnvvm", -} - -# Paths inside the extracted installer tree for each component. -PREVIEW_WINDOWS_COMPONENT_ROOTS: dict[str, str] = { - "cuda_cccl": "cccl/cccl", - "cuda_crt": "cuda_crt/crt", - "cuda_cudart": "cuda_cudart/cudart", - "cuda_cupti": "cuda_cupti/cupti", - "cuda_nvcc": "cuda_nvcc/nvcc", - "cuda_nvrtc": "cuda_nvrtc", - "cuda_profiler_api": "cuda_profiler_api/cuda_profiler_api", - "libnvfatbin": "libnvfatbin/nvfatbin", - "libnvjitlink": "libnvjitlink/nvjitlink", - "libnvvm": "libnvvm/nvvm/nvvm", -} - - -@dataclass(frozen=True) -class PreviewInstaller: - url: str - sha256: str - - -# Source: https://packages.nvidia.com/prerelease/cuda/13.4.0/local_installers/sha256sum.txt -PREVIEW_WINDOWS_INSTALLERS: dict[tuple[str, str], PreviewInstaller] = { - ("13.4.0", "win-64"): PreviewInstaller( - url=("https://packages.nvidia.com/prerelease/cuda/13.4.0/local_installers/cuda_13.4.0_windows_x86_64.exe"), - sha256="b743a3323116bf33404953ef58a9b9a3319368241f6352e933e9461409e9a759", - ), - ("13.4.0", "win-arm64"): PreviewInstaller( - url=("https://packages.nvidia.com/prerelease/cuda/13.4.0/local_installers/cuda_13.4.0_windows_arm64.exe"), - sha256="a1f68c81160b16d519c4087788b9c07de41306c3f1b872471ceee0996621374d", - ), -} - def host_platform_to_subdir(host_platform: str) -> str: try: @@ -173,135 +108,6 @@ def filter_components( return filtered, skipped -def get_preview_packages(*, host_platform: str, cuda_version: str, components: str) -> tuple[list[str], list[str]]: - if not host_platform.startswith("linux-"): - raise ValueError(f"CUDA prerelease packages are not supported for host-platform {host_platform!r}") - - version_parts = cuda_version.split(".") - if len(version_parts) != 3 or not all(part.isdigit() for part in version_parts): - raise ValueError(f"invalid cuda-version: {cuda_version!r}") - package_suffix = "-".join(version_parts[:2]) - - packages = [] - skipped = [] - for component in filter_static_components(split_components(components), host_platform, cuda_version): - if component == "libcudla" and host_platform != "linux-aarch64": - skipped.append(component) - continue - try: - package_base = PREVIEW_COMPONENT_PACKAGES[component] - except KeyError as exc: - raise ValueError(f"unsupported CUDA prerelease component: {component!r}") from exc - package = f"{package_base}-{package_suffix}" - if package not in packages: - packages.append(package) - return packages, skipped - - -def windows_arch_for_host_platform(host_platform: str) -> str: - if host_platform == "win-arm64": - return "arm64" - if host_platform == "win-64": - return "x64" - raise ValueError(f"unsupported Windows host-platform: {host_platform!r}") - - -def get_preview_windows_archive_dirs( - *, host_platform: str, cuda_version: str, components: str -) -> tuple[list[str], list[str]]: - if not host_platform.startswith("win-"): - raise ValueError(f"CUDA prerelease Windows installer is not supported for host-platform {host_platform!r}") - - archive_dirs: list[str] = [] - skipped: list[str] = [] - for component in filter_static_components(split_components(components), host_platform, cuda_version): - if component == "libcudla": - skipped.append(component) - continue - try: - archive_dir = PREVIEW_WINDOWS_ARCHIVE_DIRS[component] - except KeyError as exc: - raise ValueError(f"unsupported CUDA prerelease component: {component!r}") from exc - if archive_dir not in archive_dirs: - archive_dirs.append(archive_dir) - return archive_dirs, skipped - - -def _merge_tree(source: Path, destination: Path) -> None: - if not source.exists(): - return - destination.mkdir(parents=True, exist_ok=True) - for item in source.iterdir(): - target = destination / item.name - if item.is_dir(): - _merge_tree(item, target) - elif target.exists(): - target.unlink() - shutil.copy2(item, target) - else: - shutil.copy2(item, target) - - -def merge_windows_preview_ctk( - *, - extract_root: Path, - destination: Path, - host_platform: str, - cuda_version: str, - components: str, -) -> None: - arch = windows_arch_for_host_platform(host_platform) - if destination.exists(): - shutil.rmtree(destination) - destination.mkdir(parents=True) - - for component in filter_static_components(split_components(components), host_platform, cuda_version): - if component not in PREVIEW_WINDOWS_COMPONENT_ROOTS: - continue - component_root = extract_root / PREVIEW_WINDOWS_COMPONENT_ROOTS[component] - if not component_root.exists(): - raise ValueError(f"CUDA prerelease installer did not provide {component_root}") - - lib_dir = destination / "lib" / arch - - if component == "cuda_nvrtc": - _merge_tree(component_root / "nvrtc_dev/include", destination / "include") - _merge_tree(component_root / "nvrtc_dev/lib" / arch, lib_dir) - _merge_tree(component_root / "nvrtc/bin" / arch, destination / "bin") - continue - - if component == "cuda_cupti": - _merge_tree(component_root / "extras/CUPTI", destination / "extras/CUPTI") - continue - - if component == "libnvvm": - _merge_tree(component_root, destination / "nvvm") - continue - - _merge_tree(component_root / "include", destination / "include") - arch_bin = component_root / "bin" / arch - if arch_bin.exists(): - _merge_tree(arch_bin, destination / "bin") - elif (component_root / "bin").exists(): - _merge_tree(component_root / "bin", destination / "bin") - arch_lib = component_root / "lib" / arch - if arch_lib.exists(): - _merge_tree(arch_lib, lib_dir) - - if not (destination / "include").is_dir() or not (destination / "bin/nvcc.exe").is_file(): - raise ValueError("CUDA prerelease installer did not provide the expected toolkit layout") - - -def get_preview_installer(*, host_platform: str, cuda_version: str) -> PreviewInstaller: - try: - return PREVIEW_WINDOWS_INSTALLERS[(cuda_version, host_platform)] - except KeyError as exc: - raise ValueError( - f"CUDA prerelease installer is not supported for " - f"cuda-version {cuda_version!r}, host-platform {host_platform!r}" - ) from exc - - def get_component_relative_path(metadata: dict[str, Any], *, host_platform: str, component: str) -> str: ctk_subdir = host_platform_to_subdir(host_platform) component = resolve_component_name(metadata, component) @@ -336,27 +142,6 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace: relpath_parser.add_argument("--metadata-path") relpath_parser.add_argument("--metadata-url") - preview_parser = subparsers.add_parser("preview-packages") - preview_parser.add_argument("--host-platform", required=True) - preview_parser.add_argument("--cuda-version", required=True) - preview_parser.add_argument("--components", required=True) - - preview_installer_parser = subparsers.add_parser("preview-installer") - preview_installer_parser.add_argument("--host-platform", required=True) - preview_installer_parser.add_argument("--cuda-version", required=True) - - preview_windows_archives_parser = subparsers.add_parser("preview-windows-archives") - preview_windows_archives_parser.add_argument("--host-platform", required=True) - preview_windows_archives_parser.add_argument("--cuda-version", required=True) - preview_windows_archives_parser.add_argument("--components", required=True) - - merge_windows_preview_parser = subparsers.add_parser("merge-windows-preview") - merge_windows_preview_parser.add_argument("--host-platform", required=True) - merge_windows_preview_parser.add_argument("--cuda-version", required=True) - merge_windows_preview_parser.add_argument("--components", required=True) - merge_windows_preview_parser.add_argument("--extract-root", required=True) - merge_windows_preview_parser.add_argument("--destination", required=True) - return parser.parse_args(argv) @@ -364,55 +149,8 @@ def main(argv: list[str] | None = None) -> int: args = parse_args(argv) try: - if args.command == "preview-packages": - packages, skipped = get_preview_packages( - host_platform=args.host_platform, - cuda_version=args.cuda_version, - components=args.components, - ) - for component in skipped: - print( - f"Skipping unsupported CUDA prerelease component {component!r} " - f"for host-platform {args.host_platform!r}", - file=sys.stderr, - ) - print(",".join(packages)) - return 0 - - if args.command == "preview-installer": - installer = get_preview_installer( - host_platform=args.host_platform, - cuda_version=args.cuda_version, - ) - print(f"{installer.url}\t{installer.sha256}") - return 0 - - if args.command == "preview-windows-archives": - archive_dirs, skipped = get_preview_windows_archive_dirs( - host_platform=args.host_platform, - cuda_version=args.cuda_version, - components=args.components, - ) - for component in skipped: - print( - f"Skipping unsupported CUDA prerelease component {component!r} " - f"for host-platform {args.host_platform!r}", - file=sys.stderr, - ) - print(",".join(archive_dirs)) - return 0 - - if args.command == "merge-windows-preview": - merge_windows_preview_ctk( - extract_root=Path(args.extract_root), - destination=Path(args.destination), - host_platform=args.host_platform, - cuda_version=args.cuda_version, - components=args.components, - ) - return 0 - metadata = load_metadata(metadata_path=args.metadata_path, metadata_url=args.metadata_url) + if args.command == "filter-components": filtered, skipped = filter_components( metadata, diff --git a/ci/versions.yml b/ci/versions.yml index 4da77b95ef7..41be137f128 100644 --- a/ci/versions.yml +++ b/ci/versions.yml @@ -5,7 +5,6 @@ backport_branch: "12.9.x" # keep in sync with target-branch in .github/dependab cuda: build: - version: "13.4.0" - channel: "prerelease" + version: "13.3.0" prev_build: version: "12.9.1" diff --git a/conftest.py b/conftest.py index ea53d79546e..7a0c59065d5 100644 --- a/conftest.py +++ b/conftest.py @@ -11,15 +11,17 @@ # Please keep in sync with the copy in cuda_core/tests/conftest.py. def _cuda_headers_available() -> bool: - """Return True if CUDA headers are available, False otherwise. + """Return True if CUDA headers are available, False if no CUDA path is set. - Returns False if no CUDA path is set or if the CUDA path has no - include/ subdirectory (e.g. a sanitizer-only mini-CTK install). + Raises AssertionError if a CUDA path is set but has no include/ subdirectory. """ cuda_path = get_cuda_path_or_home() if cuda_path is None: return False - return os.path.isdir(os.path.join(cuda_path, "include")) + assert os.path.isdir(os.path.join(cuda_path, "include")), ( + f"CUDA path {cuda_path} does not contain an 'include' subdirectory" + ) + return True def pytest_collection_modifyitems(config, items): # noqa: ARG001 diff --git a/cuda_core/tests/conftest.py b/cuda_core/tests/conftest.py index ca3782c67f2..8e4bfb7ff4b 100644 --- a/cuda_core/tests/conftest.py +++ b/cuda_core/tests/conftest.py @@ -449,15 +449,17 @@ def test_something(memory_resource_factory): # Please keep in sync with the copy in the top-level conftest.py. def _cuda_headers_available() -> bool: - """Return True if CUDA headers are available, False otherwise. + """Return True if CUDA headers are available, False if no CUDA path is set. - Returns False if no CUDA path is set or if the CUDA path has no - include/ subdirectory (e.g. a sanitizer-only mini-CTK install). + Raises AssertionError if a CUDA path is set but has no include/ subdirectory. """ cuda_path = get_cuda_path_or_home() if cuda_path is None: return False - return os.path.isdir(os.path.join(cuda_path, "include")) + assert os.path.isdir(os.path.join(cuda_path, "include")), ( + f"CUDA path {cuda_path} does not contain an 'include' subdirectory" + ) + return True skipif_need_cuda_headers = pytest.mark.skipif(