Skip to content

Commit 43f539c

Browse files
authored
Support CUDA 13 (#3502)
1 parent 0e4e5fb commit 43f539c

21 files changed

+164
-83
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
strategy:
106106
matrix:
107107
platform: [amd64, arm64]
108-
cuda_version: ["12.6"]
108+
cuda_version: ["12.6", "13.0"]
109109
fail-fast: false
110110
uses: ./.github/workflows/dev_environment.yml
111111
secrets:
@@ -132,7 +132,7 @@ jobs:
132132
strategy:
133133
matrix:
134134
platform: [amd64, arm64]
135-
cuda_version: ["12.6"]
135+
cuda_version: ["12.6", "13.0"]
136136
fail-fast: false
137137
uses: ./.github/workflows/dev_environment.yml
138138
secrets:
@@ -235,7 +235,7 @@ jobs:
235235
matrix:
236236
platform: [amd64, arm64]
237237
python_version: ['3.11', '3.13']
238-
cuda_version: ["12.6"]
238+
cuda_version: ["12.6", "13.0"]
239239
fail-fast: false
240240
uses: ./.github/workflows/python_wheels.yml
241241
secrets:
@@ -256,7 +256,7 @@ jobs:
256256
with:
257257
cudaq_version: ${{ needs.python_wheels.outputs.cudaq_version }}
258258
python_versions: "['3.11', '3.13']"
259-
cuda_versions: "['', '12.6']"
259+
cuda_versions: "['', '12.6', '13.0']"
260260
wheel_artifacts: 'pycudaq-*'
261261

262262
binaries:
@@ -265,7 +265,7 @@ jobs:
265265
strategy:
266266
matrix:
267267
platform: [amd64, arm64]
268-
cuda_version: ["12.6"]
268+
cuda_version: ["12.6", "13.0"]
269269
fail-fast: false
270270
uses: ./.github/workflows/prebuilt_binaries.yml
271271
secrets:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
nvidia-mgpu-repo: cuda-quantum/cuquantum-mgpu.git
2-
nvidia-mgpu-commit: 8346e5d327318e49d1d6a117fccdd2eea78a803d
2+
nvidia-mgpu-commit: bb46a64f7a17f4aafac019adbdde78edd792b16e

.github/workflows/config/validation_config.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,41 @@
7575
"cuda_distribution": "fedora42"
7676
}
7777
},
78+
{
79+
"platform": "linux/amd64",
80+
"cuda_major": 13,
81+
"operating_systems":
82+
[
83+
"ubuntu:22.04",
84+
"debian:12",
85+
"opensuse/leap:15.5",
86+
"fedora:42"
87+
],
88+
"ubuntu:22.04":
89+
{
90+
"libcdev_package": "libc6-dev",
91+
"cudart_version": "13.0",
92+
"cuda_distribution": "ubuntu2204"
93+
},
94+
"debian:12":
95+
{
96+
"libcdev_package": "libc6-dev",
97+
"cudart_version": "13.0",
98+
"cuda_distribution": "debian12"
99+
},
100+
"opensuse/leap:15.5":
101+
{
102+
"libcdev_package": "glibc-devel",
103+
"cudart_version": "13.0",
104+
"cuda_distribution": "opensuse15"
105+
},
106+
"fedora:42":
107+
{
108+
"libcdev_package": "glibc-devel",
109+
"cudart_version": "13.0",
110+
"cuda_distribution": "fedora42"
111+
}
112+
},
78113
{
79114
"platform": "linux/arm64",
80115
"cuda_major": 12,
@@ -95,6 +130,20 @@
95130
"cudart_version": "12.6",
96131
"cuda_distribution": "rhel9"
97132
}
133+
},
134+
{
135+
"platform": "linux/arm64",
136+
"cuda_major": 13,
137+
"operating_systems":
138+
[
139+
"ubuntu:22.04"
140+
],
141+
"ubuntu:22.04":
142+
{
143+
"libcdev_package": "libc6-dev",
144+
"cudart_version": "13.0",
145+
"cuda_distribution": "ubuntu2204"
146+
}
98147
}
99148
]
100149
}

.github/workflows/create_cache_command.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
strategy:
113113
matrix:
114114
platform: [amd64, arm64]
115-
cuda_version: ["12.6"]
115+
cuda_version: ["12.6", "13.0"]
116116
fail-fast: false
117117
uses: ./.github/workflows/dev_environment.yml
118118
secrets:
@@ -141,7 +141,7 @@ jobs:
141141
strategy:
142142
matrix:
143143
platform: [amd64, arm64]
144-
cuda_version: ["12.6"]
144+
cuda_version: ["12.6", "13.0"]
145145
fail-fast: false
146146
uses: ./.github/workflows/dev_environment.yml
147147
secrets:

.github/workflows/deployments.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ jobs:
205205
# There are currently no multi-platform manylinux images available.
206206
# See https://github.com/pypa/manylinux/issues/1306.
207207
platform: ${{ fromJson(needs.metadata.outputs.platforms).ids }}
208-
cuda_version: ["12.6"]
208+
cuda_version: ["12.6", "13.0"]
209209
fail-fast: false
210210
uses: ./.github/workflows/dev_environment.yml
211211
secrets:
@@ -237,7 +237,7 @@ jobs:
237237
strategy:
238238
matrix:
239239
platform: ${{ fromJson(needs.metadata.outputs.platforms).ids }}
240-
cuda_version: ["12.6"]
240+
cuda_version: ["12.6", "13.0"]
241241
fail-fast: false
242242
uses: ./.github/workflows/dev_environment.yml
243243
secrets:
@@ -268,7 +268,7 @@ jobs:
268268
strategy:
269269
matrix:
270270
platform: ${{ fromJson(needs.metadata.outputs.platforms).ids }}
271-
cuda_version: ["12.6"]
271+
cuda_version: ["12.6", "13.0"]
272272
fail-fast: false
273273
uses: ./.github/workflows/dev_environment.yml
274274
secrets:
@@ -354,7 +354,7 @@ jobs:
354354
strategy:
355355
matrix:
356356
platform: ${{ fromJson(needs.metadata.outputs.platforms).ids }}
357-
cuda_version: ["12.6"]
357+
cuda_version: ["12.6", "13.0"]
358358
fail-fast: false
359359
uses: ./.github/workflows/dev_environment.yml
360360
secrets:
@@ -402,7 +402,7 @@ jobs:
402402
strategy:
403403
matrix:
404404
platform: ${{ fromJson(needs.metadata.outputs.platforms).ids }}
405-
cuda_version: ["12.6"]
405+
cuda_version: ["12.6", "13.0"]
406406
fail-fast: false
407407
uses: ./.github/workflows/docker_images.yml
408408
secrets:
@@ -443,7 +443,7 @@ jobs:
443443
runs-on: ubuntu-latest
444444
strategy:
445445
matrix:
446-
cuda: ["12.6"]
446+
cuda: ["12.6", "13.0"]
447447

448448
environment: ghcr-deployment
449449

@@ -666,7 +666,7 @@ jobs:
666666
STITCHED_JSON='${{ needs.aggregate_stitched_images.outputs.json }}'
667667
echo "$STITCHED_JSON" | jq .
668668
669-
for cuda in 12.6; do
669+
for cuda in 12.6 13.0; do
670670
cuda_major="${cuda%%.*}"
671671
artifact_name="image_cu${cuda_major}_publishing"
672672
info_file="$artifact_name.txt"
@@ -704,14 +704,22 @@ jobs:
704704
retention-days: 30
705705
if-no-files-found: error
706706

707+
- name: Upload image_cu13_publishing
708+
uses: actions/upload-artifact@v4
709+
with:
710+
name: image_cu13_publishing
711+
path: image_cu13_publishing.txt
712+
retention-days: 30
713+
if-no-files-found: error
714+
707715
python_wheels:
708716
name: Create Python wheels
709717
needs: [metadata, config]
710718
strategy:
711719
matrix:
712720
platform: ${{ fromJson(needs.metadata.outputs.platforms).ids }}
713721
python_version: ['3.11', '3.12', '3.13']
714-
cuda_version: ["12.6"]
722+
cuda_version: ["12.6", "13.0"]
715723
fail-fast: false
716724
uses: ./.github/workflows/python_wheels.yml
717725
secrets:
@@ -730,7 +738,7 @@ jobs:
730738
strategy:
731739
matrix:
732740
platform: ${{ fromJson(needs.metadata.outputs.platforms).ids }}
733-
cuda_version: ["12.6"]
741+
cuda_version: ["12.6", "13.0"]
734742
fail-fast: false
735743
uses: ./.github/workflows/prebuilt_binaries.yml
736744
secrets:

.github/workflows/publishing.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ jobs:
783783
with:
784784
cudaq_version: ${{ needs.assets.outputs.cudaq_version }}
785785
python_versions: "['3.11', '3.12', '3.13']"
786-
cuda_versions: "['', '12.6']"
786+
cuda_versions: "['', '12.6', '13.0']"
787787
wheel_artifacts: '*-wheels'
788788
github_commit: ${{ inputs.github_commit || needs.assets.outputs.github_commit }}
789789

@@ -925,7 +925,7 @@ jobs:
925925
strategy:
926926
matrix:
927927
os_image: ['redhat/ubi8:8.10', 'ubuntu:24.04']
928-
cuda_version: ['12.6']
928+
cuda_version: ['12.6', '13.0']
929929
fail-fast: false
930930

931931
container:
@@ -1143,7 +1143,7 @@ jobs:
11431143

11441144
strategy:
11451145
matrix:
1146-
cuda_version: ['11.8', '12.4']
1146+
cuda_version: ['12.4', '13.0']
11471147
fail-fast: false
11481148

11491149
# Must have environment to access environment secreats

.github/workflows/python_metapackages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
5959
echo "Creating README.md for cudaq package"
6060
package_name=cudaq
61-
cuda_version_requirement="11.x (where x \>= 8) or 12.x"
61+
cuda_version_requirement="12.x or 13.x"
6262
cuda_version_conda=12.4.0 # only used as example in the install script
6363
deprecation_notice="**Note**: Support for CUDA 11 will be removed in future releases. Please update to CUDA 12."
6464
cat python/README.md.in > python/metapackages/README.md
@@ -201,9 +201,9 @@ jobs:
201201
set -e && check_package=cuda-quantum
202202
;;
203203
*)
204-
# Skip conflict test entirely on Python 3.13 (cuda-quantum==0.8.0 not available)
205-
if [ "${{ matrix.python_version }}" = "3.13" ]; then
206-
echo "::warning::Skipping conflict test on Python 3.13 (cuda-quantum==0.8.0 unavailable)."
204+
# Skip conflict test entirely on Python 3.{13,12} (cuda-quantum==0.8.0 not available)
205+
if [ "${{ matrix.python_version }}" = "3.12" ] || [ "${{ matrix.python_version }}" = "3.13" ]; then
206+
echo "::warning::Skipping conflict test on Python 3.{12,13} (cuda-quantum==0.8.0 unavailable)."
207207
test_conflicting="<skipped>"
208208
check_package=cudaq
209209
else

CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,17 @@ endfunction()
537537

538538
if(CMAKE_CUDA_COMPILER)
539539
if (NOT CUDA_TARGET_ARCHS)
540-
# Volta, Ampere, Hopper
541-
set(CUDA_TARGET_ARCHS "70;80;90")
540+
find_package(CUDAToolkit REQUIRED)
541+
542+
message(STATUS "Found CUDA Toolkit version: ${CUDAToolkit_VERSION}")
543+
544+
if (CUDAToolkit_VERSION VERSION_LESS 13.0)
545+
# Turing, Ampere, Hopper
546+
set(CUDA_TARGET_ARCHS "75;80;90")
547+
else()
548+
# Turing, Ampere, Hopper, Blackwell
549+
set(CUDA_TARGET_ARCHS "75;80;90;100")
550+
endif()
542551
endif()
543552
CUDA_get_gencode_args(CUDA_gencode_flags ${CUDA_TARGET_ARCHS})
544553
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -shared -std=c++17 ${CUDA_gencode_flags} --compiler-options -fPIC")

docker/build/assets.Dockerfile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,20 @@ RUN dnf install -y --nobest --setopt=install_weak_deps=False ${PYTHON}-devel &&
187187
${PYTHON} -m pip install numpy build auditwheel patchelf
188188

189189
RUN cd /cuda-quantum && source scripts/configure_build.sh && \
190-
if [ "${CUDA_VERSION#11.}" != "${CUDA_VERSION}" ]; then \
191-
cublas_version=11.11 && \
192-
cusparse_version=11.7 && \
193-
sed -i "s/-cu12/-cu11/g" pyproject.toml && \
194-
sed -i "s/-cuda12/-cuda11/g" pyproject.toml && \
190+
if [ "${CUDA_VERSION#12.}" != "${CUDA_VERSION}" ]; then \
191+
cublas_version=12.0 && \
192+
cusolver_version=11.4 && \
193+
cuda_runtime_version=12.0 && \
194+
cuda_nvrtc_version=12.0 && \
195+
cupy_version=13.4.1 && \
196+
sed -i "s/-cu13/-cu12/g" pyproject.toml && \
197+
sed -i "s/-cuda13/-cuda12/g" pyproject.toml && \
198+
sed -i -E "s/cupy-cuda[0-9]+x/cupy-cuda12x/g" pyproject.toml && \
199+
sed -i -E "s/(cupy-cuda[0-9]+x? ~= )[0-9\.]*/\1${cupy_version}/g" pyproject.toml && \
195200
sed -i -E "s/(nvidia-cublas-cu[0-9]* ~= )[0-9\.]*/\1${cublas_version}/g" pyproject.toml && \
196-
sed -i -E "s/(nvidia-cusparse-cu[0-9]* ~= )[0-9\.]*/\1${cusparse_version}/g" pyproject.toml && \
197-
sed -i -E "s/(nvidia-cuda-nvrtc-cu[0-9]* ~= )[0-9\.]*/\1${CUDA_VERSION}/g" pyproject.toml && \
198-
sed -i -E "s/(nvidia-cuda-runtime-cu[0-9]* ~= )[0-9\.]*/\1${CUDA_VERSION}/g" pyproject.toml; \
201+
sed -i -E "s/(nvidia-cusolver-cu[0-9]* ~= )[0-9\.]*/\1${cusolver_version}/g" pyproject.toml && \
202+
sed -i -E "s/(nvidia-cuda-nvrtc-cu[0-9]* ~= )[0-9\.]*/\1${cuda_nvrtc_version}/g" pyproject.toml && \
203+
sed -i -E "s/(nvidia-cuda-runtime-cu[0-9]* ~= )[0-9\.]*/\1${cuda_runtime_version}/g" pyproject.toml; \
199204
fi && \
200205
# Needed to retrigger the LLVM build, since the MLIR Python bindings
201206
# are not built in the prereqs stage.

docker/build/devdeps.ext.Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,12 @@ ENV PIP_BREAK_SYSTEM_PACKAGES=1
175175
RUN apt-get update && apt-get install -y --no-install-recommends \
176176
python3 python3-pip && \
177177
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* && \
178-
python3 -m pip install --break-system-packages cupy-cuda$(echo $CUDA_VERSION | cut -d . -f1)x==13.4.1 cuquantum-cu$(echo $CUDA_VERSION | cut -d . -f1)==25.09 && \
178+
if [ "$(echo $CUDA_VERSION | cut -d . -f1)" = "13" ]; then \
179+
cupy_version=13.6.0; \
180+
else \
181+
cupy_version=13.4.1; \
182+
fi && \
183+
python3 -m pip install --break-system-packages cupy-cuda$(echo $CUDA_VERSION | cut -d . -f1)x==${cupy_version} cuquantum-cu$(echo $CUDA_VERSION | cut -d . -f1)==25.09 && \
179184
if [ "$(python3 --version | grep -o [0-9\.]* | cut -d . -f -2)" != "3.12" ]; then \
180185
echo "expecting Python version 3.12"; \
181186
fi

0 commit comments

Comments
 (0)