Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions ci/download-torch-wheels.sh
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'
2 changes: 1 addition & 1 deletion ci/test_python_integrations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if [ "${CUDA_MAJOR}" -gt 12 ] || { [ "${CUDA_MAJOR}" -eq 12 ] && [ "${CUDA_MINOR
rapids-dependency-file-generator \
--output conda \
--file-key test_pytorch \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES}" \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES};require_gpu_pytorch=true" \
--prepend-channel "${CPP_CHANNEL}" \
--prepend-channel "${PYTHON_CHANNEL}" \
| tee env.yaml
Expand Down
7 changes: 3 additions & 4 deletions ci/test_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ LIBRMM_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="librmm_${RAPIDS_PY_CUDA_SUFFIX}" rapid
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
#
rapids-pip-retry install \
-v \
--constraint ./constraints.txt \
--constraint "${PIP_CONSTRAINT}" \
"$(echo "${LIBRMM_WHEELHOUSE}"/librmm_"${RAPIDS_PY_CUDA_SUFFIX}"*.whl)" \
"$(echo "${RMM_WHEELHOUSE}"/rmm_"${RAPIDS_PY_CUDA_SUFFIX}"*.whl)[test]"
Expand Down
36 changes: 19 additions & 17 deletions ci/test_wheel_integrations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand All @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The 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-deps

(build link)

  RAPIDS logger » [03/06/26 19:41:00]
  ┌──────────────────────────────────────────────────────────────────────────┐
  |    Skipping PyTorch tests (requires CUDA 12.9+ or 13.0, found 12.2.2)    |
  └──────────────────────────────────────────────────────────────────────────┘

CUDA 12.9.1, Python 3.11, amd64, ubuntu22.04, l4, latest-driver, oldest-deps

(build link)

  Successfully installed ... torch-2.9.0+cu129 ...

CUDA 12.9.1, Python 3.14, amd64, ubuntu24.04, h100, latest-driver, latest-deps

(build link)

  Successfully installed ... torch-2.10.0+cu129 ...

CUDA 13.0.2, Python 3.12, amd64, ubuntu24.04, l4, latest-driver, latest-deps

(build link)

  Successfully installed ... torch-2.10.0+cu130 ...

CUDA 13.0.2, Python 3.12, arm64, rockylinux8, l4, latest-driver, latest-deps

(build link)

  Successfully installed ... torch-2.10.0+cu130 ...

CUDA 13.1.1, Python 3.13, amd64, rockylinux8, rtxpro6000, latest-driver, latest-deps

(build link)

  RAPIDS logger » [03/06/26 19:35:46]
  ┌──────────────────────────────────────────────────────────────────────────┐
  |    Skipping PyTorch tests (requires CUDA 12.9+ or 13.0, found 13.1.1)    |
  └──────────────────────────────────────────────────────────────────────────┘

CUDA 13.1.1, Python 3.14, amd64, ubuntu24.04, rtxpro6000, latest-driver, latest-deps

(build link)

  RAPIDS logger » [03/06/26 19:34:37]
  ┌──────────────────────────────────────────────────────────────────────────┐
  |    Skipping PyTorch tests (requires CUDA 12.9+ or 13.0, found 13.1.1)    |
  └──────────────────────────────────────────────────────────────────────────┘

CUDA 13.1.1, Python 3.14, arm64, ubuntu24.04, l4, latest-driver, latest-deps

(build link)

  RAPIDS logger » [03/06/26 19:36:06]
  ┌──────────────────────────────────────────────────────────────────────────┐
  |    Skipping PyTorch tests (requires CUDA 12.9+ or 13.0, found 13.1.1)    |
  └──────────────────────────────────────────────────────────────────────────┘


timeout 15m python -m pytest -k "torch" ./python/rmm/rmm/tests \
&& EXITCODE_PYTORCH=$? || EXITCODE_PYTORCH=$?
Expand All @@ -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::"
Expand Down
67 changes: 53 additions & 14 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -131,6 +127,10 @@ files:
key: test
includes:
- test_python
torch_only:
output: none
includes:
- depends_on_pytorch
channels:
- rapidsai-nightly
- rapidsai
Expand Down Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The 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 rmm never needed patches for DLFW and so was missed in that round of PRs because its - depends_on_pytorch group doesn't end up in test_python or similar commonly-used lists.

# 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
Expand Down