-
Notifications
You must be signed in to change notification settings - Fork 243
ensure 'torch' CUDA wheels are installed in CI #2279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # [description] | ||
| # | ||
| # Downloads a CUDA variant of 'torch' from the correct index, based on CUDA major version. | ||
| # | ||
| # This exists to avoid using 'pip --extra-index-url', which has these undesirable properties: | ||
| # | ||
| # - allows for CPU-only 'torch' to be downloaded from pypi.org | ||
| # - allows for other non-torch packages like 'numpy' to be downloaded from the PyTorch indices | ||
| # - increases solve complexity for 'pip' | ||
| # | ||
|
|
||
| set -e -u -o pipefail | ||
|
|
||
| TORCH_WHEEL_DIR="${1}" | ||
|
|
||
| # Ensure CUDA-enabled 'torch' packages are always used. | ||
| # | ||
| # Downloading + passing the downloaded file as a requirement forces the use of this | ||
| # package and ensures 'pip' considers all of its requirements. | ||
| # | ||
| # Not appending this to PIP_CONSTRAINT, because we don't want the torch '--extra-index-url' | ||
| # to leak outside of this script into other 'pip {download,install}'' calls. | ||
| rapids-dependency-file-generator \ | ||
| --output requirements \ | ||
| --file-key "torch_only" \ | ||
| --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES};require_gpu_pytorch=true" \ | ||
| | tee ./torch-constraints.txt | ||
|
|
||
| rapids-pip-retry download \ | ||
| --isolated \ | ||
| --prefer-binary \ | ||
| --no-deps \ | ||
| -d "${TORCH_WHEEL_DIR}" \ | ||
| --constraint "${PIP_CONSTRAINT}" \ | ||
| --constraint ./torch-constraints.txt \ | ||
| 'torch' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,25 +4,23 @@ | |
|
|
||
| set -eou pipefail | ||
|
|
||
| RAPIDS_INIT_PIP_REMOVE_NVIDIA_INDEX="true" | ||
| export RAPIDS_INIT_PIP_REMOVE_NVIDIA_INDEX | ||
| source rapids-init-pip | ||
|
|
||
| RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen "${RAPIDS_CUDA_VERSION}")" | ||
| LIBRMM_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="librmm_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-github cpp) | ||
| RMM_WHEELHOUSE=$(rapids-download-from-github "$(rapids-package-name "wheel_python" rmm --stable --cuda "$RAPIDS_CUDA_VERSION")") | ||
|
|
||
| # generate constraints (possibly pinning to oldest support versions of dependencies) | ||
| rapids-generate-pip-constraints test_python ./constraints.txt | ||
| rapids-generate-pip-constraints test_python "${PIP_CONSTRAINT}" | ||
|
|
||
| # notes: | ||
| # | ||
| # * echo to expand wildcard before adding `[test]` requires for pip | ||
| # * need to provide --constraint="${PIP_CONSTRAINT}" because that environment variable is | ||
| # ignored if any other --constraint are passed via the CLI | ||
| # * just providing --constraint="${PIP_CONSTRAINT}" to be explicit, and because | ||
| # that environment variable is ignored if any other --constraint are passed via the CLI | ||
| # | ||
| PIP_INSTALL_SHARED_ARGS=( | ||
| --constraint=./constraints.txt | ||
| --prefer-binary | ||
| --constraint="${PIP_CONSTRAINT}" | ||
| "$(echo "${LIBRMM_WHEELHOUSE}"/librmm_"${RAPIDS_PY_CUDA_SUFFIX}"*.whl)" | ||
| "$(echo "${RMM_WHEELHOUSE}"/rmm_"${RAPIDS_PY_CUDA_SUFFIX}"*.whl)[test]" | ||
|
|
@@ -33,25 +31,29 @@ EXITCODE=0 | |
| rapids-logger "Check GPU usage" | ||
| nvidia-smi | ||
|
|
||
| # Check CUDA version for PyTorch compatibility (requires CUDA 12.8+) | ||
| echo "::group::PyTorch Tests" | ||
|
|
||
| CUDA_MAJOR=$(echo "${RAPIDS_CUDA_VERSION}" | cut -d'.' -f1) | ||
| CUDA_MINOR=$(echo "${RAPIDS_CUDA_VERSION}" | cut -d'.' -f2) | ||
|
|
||
| echo "::group::PyTorch Tests" | ||
| # Update this when 'torch' publishes CUDA wheels supporting newer CTKs. | ||
| # | ||
| # See notes in 'dependencies.yaml' for details on supported versions. | ||
| if \ | ||
| { [ "${CUDA_MAJOR}" -eq 12 ] && [ "${CUDA_MINOR}" -ge 9 ]; } \ | ||
| || { [ "${CUDA_MAJOR}" -eq 13 ] && [ "${CUDA_MINOR}" -le 0 ]; }; \ | ||
| then | ||
|
|
||
| if [ "${CUDA_MAJOR}" -gt 12 ] || { [ "${CUDA_MAJOR}" -eq 12 ] && [ "${CUDA_MINOR}" -ge 8 ]; }; then | ||
| rapids-logger "Generating PyTorch test requirements" | ||
| rapids-dependency-file-generator \ | ||
| --output requirements \ | ||
| --file-key test_wheels_pytorch \ | ||
| --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" \ | ||
| | tee test-pytorch-requirements.txt | ||
| # ensure a CUDA variant of 'torch' is used | ||
| rapids-logger "Downloading PyTorch CUDA wheels" | ||
| TORCH_WHEEL_DIR="$(mktemp -d)" | ||
| ./ci/download-torch-wheels.sh "${TORCH_WHEEL_DIR}" | ||
|
|
||
| rapids-logger "Installing PyTorch test requirements" | ||
| rapids-pip-retry install \ | ||
| -v \ | ||
| "${PIP_INSTALL_SHARED_ARGS[@]}" \ | ||
| -r test-pytorch-requirements.txt | ||
| "${TORCH_WHEEL_DIR}"/torch-*.whl | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks to me like this is working and pulling in what we want! CUDA 12.2.2, Python 3.11, arm64, ubuntu22.04, a100, latest-driver, latest-depsCUDA 12.9.1, Python 3.11, amd64, ubuntu22.04, l4, latest-driver, oldest-depsCUDA 12.9.1, Python 3.14, amd64, ubuntu24.04, h100, latest-driver, latest-depsCUDA 13.0.2, Python 3.12, amd64, ubuntu24.04, l4, latest-driver, latest-depsCUDA 13.0.2, Python 3.12, arm64, rockylinux8, l4, latest-driver, latest-depsCUDA 13.1.1, Python 3.13, amd64, rockylinux8, rtxpro6000, latest-driver, latest-depsCUDA 13.1.1, Python 3.14, amd64, ubuntu24.04, rtxpro6000, latest-driver, latest-depsCUDA 13.1.1, Python 3.14, arm64, ubuntu24.04, l4, latest-driver, latest-deps |
||
|
|
||
| timeout 15m python -m pytest -k "torch" ./python/rmm/rmm/tests \ | ||
| && EXITCODE_PYTORCH=$? || EXITCODE_PYTORCH=$? | ||
|
|
@@ -60,7 +62,7 @@ if [ "${CUDA_MAJOR}" -gt 12 ] || { [ "${CUDA_MAJOR}" -eq 12 ] && [ "${CUDA_MINOR | |
| EXITCODE="${EXITCODE_PYTORCH}" | ||
| fi | ||
| else | ||
| rapids-logger "Skipping PyTorch tests (requires CUDA 12.8+, found ${RAPIDS_CUDA_VERSION})" | ||
| rapids-logger "Skipping PyTorch tests (requires CUDA 12.9+ or 13.0, found ${RAPIDS_CUDA_VERSION})" | ||
| fi | ||
|
|
||
| echo "::endgroup::" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,10 +46,6 @@ files: | |
| - depends_on_cupy | ||
| - depends_on_librmm | ||
| - depends_on_rmm | ||
| test_wheels_pytorch: | ||
| output: none | ||
| includes: | ||
| - depends_on_pytorch | ||
| test_wheels_cupy: | ||
| output: none | ||
| includes: | ||
|
|
@@ -131,6 +127,10 @@ files: | |
| key: test | ||
| includes: | ||
| - test_python | ||
| torch_only: | ||
| output: none | ||
| includes: | ||
| - depends_on_pytorch | ||
| channels: | ||
| - rapidsai-nightly | ||
| - rapidsai | ||
|
|
@@ -397,25 +397,64 @@ dependencies: | |
| # pip recognizes the index as a global option for the requirements.txt file | ||
| - --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple | ||
| depends_on_pytorch: | ||
| common: | ||
| - output_types: conda | ||
| packages: | ||
| - pytorch-gpu>=2.10.0 | ||
| specific: | ||
| - output_types: [requirements, pyproject] | ||
| - output_types: conda | ||
| matrices: | ||
| - matrix: | ||
| cuda: "12.*" | ||
| require_gpu_pytorch: "true" | ||
| packages: | ||
| - --extra-index-url=https://download.pytorch.org/whl/cu128 | ||
| - pytorch-gpu>=2.9 | ||
| - matrix: | ||
| packages: | ||
| - --extra-index-url=https://download.pytorch.org/whl/cu130 | ||
| - output_types: [requirements, pyproject] | ||
| - pytorch>=2.9 | ||
| # The 'pytorch.org' indices referenced in --extra-index-url below host CPU-only variants too, | ||
| # so requirements like '>=' are not safe. | ||
| # | ||
| # Using '==' and a version with the CUDA specifier like '+cu130' is the most reliable way to ensure | ||
| # the packages we want are pulled (at the expense of needing to maintain this list). | ||
| # | ||
| # 'torch' tightly pins wheels to a single {major}.{minor} CTK version. | ||
| # | ||
| # This list only contains entries exactly matching CUDA {major}.{minor} that we test in RAPIDS CI, | ||
| # to ensure a loud error alerts us to the need to update this list (or CI scripts) when new | ||
| # CTKs are added to the support matrix. | ||
| - output_types: requirements | ||
| matrices: | ||
| # avoid pulling in 'torch' in places like DLFW builds that prefer to install it other ways | ||
| - matrix: | ||
| no_pytorch: "true" | ||
| packages: | ||
|
Comment on lines
+423
to
+426
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This follows the pattern @trxcllnt has been introducing across RAPIDS: rapidsai/cugraph-gnn#421 Think |
||
| # matrices below ensure CUDA 'torch' packages are used | ||
| - matrix: | ||
| cuda: "12.9" | ||
| dependencies: "oldest" | ||
| require_gpu_pytorch: "true" | ||
| packages: | ||
| - &torch_cu129_index --extra-index-url=https://download.pytorch.org/whl/cu129 | ||
| - torch==2.9.0+cu129 | ||
| - matrix: | ||
| cuda: "12.9" | ||
| require_gpu_pytorch: "true" | ||
| packages: | ||
| - *torch_cu129_index | ||
| - torch==2.10.0+cu129 | ||
| - matrix: | ||
| cuda: "13.0" | ||
| dependencies: "oldest" | ||
| require_gpu_pytorch: "true" | ||
| packages: | ||
| - &torch_index_cu13 --extra-index-url=https://download.pytorch.org/whl/cu130 | ||
| - torch==2.9.0+cu130 | ||
| - matrix: | ||
| cuda: "13.0" | ||
| require_gpu_pytorch: "true" | ||
| packages: | ||
| - *torch_index_cu13 | ||
| - torch==2.10.0+cu130 | ||
| - matrix: | ||
| require_gpu_pytorch: "false" | ||
| packages: | ||
| - torch>=2.10.0 | ||
| - torch>=2.9 | ||
| depends_on_cupy: | ||
| common: | ||
| - output_types: conda | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.