From 615eba20cd898349b86e56ed2cd2f3adbc553025 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Thu, 23 Oct 2025 12:31:01 -0700 Subject: [PATCH 01/34] install cuda-cudart-dev-* Signed-off-by: Mitchell --- .github/workflows/publishing.yml | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index fd23898dead..71056483666 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -964,24 +964,15 @@ jobs: dpkg -i cuda-keyring_1.1-1_all.deb cuda_version_suffix="$(echo ${{ matrix.cuda_version }} | tr . -)" apt-get update - if [ $(echo ${{ matrix.cuda_version }} | cut -d . -f1) -gt 11 ]; then - apt-get install -y --no-install-recommends \ - cuda-cudart-$cuda_version_suffix \ - cuda-nvrtc-$cuda_version_suffix \ - libnvjitlink-$cuda_version_suffix \ - libcurand-$cuda_version_suffix \ - libcublas-$cuda_version_suffix \ - libcusparse-$cuda_version_suffix \ - libcusolver-$cuda_version_suffix - else - apt-get install -y --no-install-recommends \ - cuda-cudart-$cuda_version_suffix \ - cuda-nvrtc-$cuda_version_suffix \ - libcurand-$cuda_version_suffix \ - libcublas-$cuda_version_suffix \ - libcusparse-$cuda_version_suffix \ - libcusolver-$cuda_version_suffix - fi + apt-get install -y --no-install-recommends \ + cuda-cudart-$cuda_version_suffix \ + cuda-cudart-dev-$cuda_version_suffix \ + cuda-nvrtc-$cuda_version_suffix \ + libnvjitlink-$cuda_version_suffix \ + libcurand-$cuda_version_suffix \ + libcublas-$cuda_version_suffix \ + libcusparse-$cuda_version_suffix \ + libcusolver-$cuda_version_suffix - name: Runtime dependencies (dnf) if: startsWith(matrix.os_image, 'redhat') From ed9a7e6beab575b037f09e0b9f71f011873acd29 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Thu, 23 Oct 2025 15:42:04 -0700 Subject: [PATCH 02/34] update torch/torchvision to cu12 versions Signed-off-by: Mitchell --- .../applications/python/hybrid_quantum_neural_networks.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/applications/python/hybrid_quantum_neural_networks.ipynb b/docs/sphinx/applications/python/hybrid_quantum_neural_networks.ipynb index cc3f054e614..4c08b3e0ae4 100644 --- a/docs/sphinx/applications/python/hybrid_quantum_neural_networks.ipynb +++ b/docs/sphinx/applications/python/hybrid_quantum_neural_networks.ipynb @@ -34,7 +34,7 @@ "source": [ "# Install the relevant packages.\n", "\n", - "!pip install matplotlib==3.8.4 torch==2.0.1+cu118 torchvision==0.15.2+cu118 scikit-learn==1.4.2 -q --extra-index-url https://download.pytorch.org/whl/cu118" + "!pip install matplotlib==3.8.4 torch==2.9.0+cu126 torchvision==0.24.0+cu126 scikit-learn==1.4.2 -q --extra-index-url https://download.pytorch.org/whl/cu126" ] }, { From 603e74f8f0293b44fd1e22329bc69dde458c9642 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Fri, 24 Oct 2025 11:16:24 -0700 Subject: [PATCH 03/34] use venv instead of --break-system-packages Signed-off-by: Mitchell --- .github/workflows/publishing.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 71056483666..396eb953ce0 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -1077,20 +1077,22 @@ jobs: # These simple steps are only expected to work for # test cases that don't require MPI. # Create clean python3 environment. - apt-get update && apt-get install -y --no-install-recommends python3 python3-pip - mkdir -p /tmp/packages && mv /tmp/wheels/* /tmp/packages && rmdir /tmp/wheels + apt-get update && apt-get install -y --no-install-recommends python3 python3-pip python3-venv - python3 -m pip install pypiserver - server=`find / -name pypi-server -executable -type f` - $server run -p 8080 /tmp/packages & + # Make a place for local wheels + mkdir -p /tmp/packages && mv /tmp/wheels/* /tmp/packages && rmdir /tmp/wheels + # Create and activate virtual environment + python3 -m venv /opt/cudaq-venv + source /opt/cudaq-venv/bin/activate + if [ -n "${{ matrix.cuda_major }}" ]; then pip install cuda-quantum-cu${{ matrix.cuda_major }}==${{ needs.assets.outputs.cudaq_version }} -v \ - --extra-index-url http://localhost:8080 + --find-links "file:///tmp/packages" else pip install --upgrade pip pip install cudaq==${{ needs.assets.outputs.cudaq_version }} -v \ - --extra-index-url http://localhost:8080 \ + --find-links "file:///tmp/packages" 2>&1 | tee /tmp/install.out if [ -z "$(cat /tmp/install.out | grep -o 'Autodetection succeeded')" ]; then From 10a7ccc97acbbe436aa9a9e77c53dd1ca510925a Mon Sep 17 00:00:00 2001 From: Mitchell Date: Fri, 24 Oct 2025 20:35:00 -0700 Subject: [PATCH 04/34] remove cuda_major 11, add 13 Signed-off-by: Mitchell --- .github/workflows/publishing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 396eb953ce0..f2384acd34d 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -1039,7 +1039,7 @@ jobs: strategy: matrix: platform: ['amd64-gpu-a100', 'arm64-gpu-a100'] - cuda_major: ['', '11', '12'] + cuda_major: ['', '12', '13'] fail-fast: false runs-on: linux-${{ matrix.platform }}-latest-1 From 587f6bc817125170edde30234ce121f925c427df Mon Sep 17 00:00:00 2001 From: Mitchell Date: Sat, 25 Oct 2025 06:30:50 -0700 Subject: [PATCH 05/34] fix missing slash Signed-off-by: Mitchell --- .github/workflows/publishing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index f2384acd34d..edd81554fef 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -1092,7 +1092,7 @@ jobs: else pip install --upgrade pip pip install cudaq==${{ needs.assets.outputs.cudaq_version }} -v \ - --find-links "file:///tmp/packages" + --find-links "file:///tmp/packages" \ 2>&1 | tee /tmp/install.out if [ -z "$(cat /tmp/install.out | grep -o 'Autodetection succeeded')" ]; then From f23bf26b809d9c4a590d993b12827d499342f15a Mon Sep 17 00:00:00 2001 From: Mitchell Date: Sun, 26 Oct 2025 11:03:05 -0700 Subject: [PATCH 06/34] add note about cuda 12.x driver; split pyproject into *.cu{12,3} Signed-off-by: Mitchell --- docker/build/assets.Dockerfile | 23 ++--- docker/release/cudaq.wheel.Dockerfile | 25 ++---- .../using/install/local_installation.rst | 6 +- pyproject.toml.cu12 | 83 +++++++++++++++++++ pyproject.toml => pyproject.toml.cu13 | 0 5 files changed, 102 insertions(+), 35 deletions(-) create mode 100644 pyproject.toml.cu12 rename pyproject.toml => pyproject.toml.cu13 (100%) diff --git a/docker/build/assets.Dockerfile b/docker/build/assets.Dockerfile index bba44004ee5..d6d77cc3886 100644 --- a/docker/build/assets.Dockerfile +++ b/docker/build/assets.Dockerfile @@ -186,22 +186,13 @@ RUN dnf install -y --nobest --setopt=install_weak_deps=False ${PYTHON}-devel && ${PYTHON} -m ensurepip --upgrade && \ ${PYTHON} -m pip install numpy build auditwheel patchelf -RUN cd /cuda-quantum && source scripts/configure_build.sh && \ - if [ "${CUDA_VERSION#12.}" != "${CUDA_VERSION}" ]; then \ - cublas_version=12.0 && \ - cusolver_version=11.4 && \ - cuda_runtime_version=12.0 && \ - cuda_nvrtc_version=12.0 && \ - cupy_version=13.4.1 && \ - sed -i "s/-cu13/-cu12/g" pyproject.toml && \ - sed -i "s/-cuda13/-cuda12/g" pyproject.toml && \ - sed -i -E "s/cupy-cuda[0-9]+x/cupy-cuda12x/g" pyproject.toml && \ - sed -i -E "s/(cupy-cuda[0-9]+x? ~= )[0-9\.]*/\1${cupy_version}/g" pyproject.toml && \ - sed -i -E "s/(nvidia-cublas-cu[0-9]* ~= )[0-9\.]*/\1${cublas_version}/g" pyproject.toml && \ - sed -i -E "s/(nvidia-cusolver-cu[0-9]* ~= )[0-9\.]*/\1${cusolver_version}/g" pyproject.toml && \ - sed -i -E "s/(nvidia-cuda-nvrtc-cu[0-9]* ~= )[0-9\.]*/\1${cuda_nvrtc_version}/g" pyproject.toml && \ - sed -i -E "s/(nvidia-cuda-runtime-cu[0-9]* ~= )[0-9\.]*/\1${cuda_runtime_version}/g" pyproject.toml; \ - fi && \ +RUN cd /cuda-quantum && \ + . scripts/configure_build.sh && \ + case "${CUDA_VERSION%%.*}" in \ + 12) cp pyproject.toml.cu12 pyproject.toml ;; \ + 13) cp pyproject.toml.cu13 pyproject.toml ;; \ + *) echo "Unsupported CUDA_VERSION=${CUDA_VERSION}"; exit 1 ;; \ + esac && \ # Needed to retrigger the LLVM build, since the MLIR Python bindings # are not built in the prereqs stage. rm -rf "${LLVM_INSTALL_PREFIX}" && \ diff --git a/docker/release/cudaq.wheel.Dockerfile b/docker/release/cudaq.wheel.Dockerfile index ea382ac299f..d3cd7af9b55 100644 --- a/docker/release/cudaq.wheel.Dockerfile +++ b/docker/release/cudaq.wheel.Dockerfile @@ -37,23 +37,14 @@ RUN echo "Building MLIR bindings for python${python_version}" && \ LLVM_CMAKE_CACHE=/cmake/caches/LLVM.cmake LLVM_SOURCE=/llvm-project \ bash /scripts/build_llvm.sh -c Release -v -# Patch the pyproject.toml file to change the CUDA version if needed -RUN cd cuda-quantum && sed -i "s/README.md.in/README.md/g" pyproject.toml && \ - if [ "${CUDA_VERSION#12.}" != "${CUDA_VERSION}" ]; then \ - cublas_version=12.0 && \ - cusolver_version=11.4 && \ - cuda_runtime_version=12.0 && \ - cuda_nvrtc_version=12.0 && \ - cupy_version=13.4.1 && \ - sed -i "s/-cu13/-cu12/g" pyproject.toml && \ - sed -i "s/-cuda13/-cuda12/g" pyproject.toml && \ - sed -i -E "s/cupy-cuda[0-9]+x/cupy-cuda12x/g" pyproject.toml && \ - sed -i -E "s/(cupy-cuda[0-9]+x? ~= )[0-9\.]*/\1${cupy_version}/g" pyproject.toml && \ - sed -i -E "s/(nvidia-cublas-cu[0-9]* ~= )[0-9\.]*/\1${cublas_version}/g" pyproject.toml && \ - sed -i -E "s/(nvidia-cusolver-cu[0-9]* ~= )[0-9\.]*/\1${cusolver_version}/g" pyproject.toml && \ - sed -i -E "s/(nvidia-cuda-nvrtc-cu[0-9]* ~= )[0-9\.]*/\1${cuda_nvrtc_version}/g" pyproject.toml && \ - sed -i -E "s/(nvidia-cuda-runtime-cu[0-9]* ~= )[0-9\.]*/\1${cuda_runtime_version}/g" pyproject.toml; \ - fi +# Configure the build based on the CUDA version +RUN cd /cuda-quantum && \ + . scripts/configure_build.sh && \ + case "${CUDA_VERSION%%.*}" in \ + 12) cp pyproject.toml.cu12 pyproject.toml ;; \ + 13) cp pyproject.toml.cu13 pyproject.toml ;; \ + *) echo "Unsupported CUDA_VERSION=${CUDA_VERSION}"; exit 1 ;; \ + esac # Create the README RUN cd cuda-quantum && cat python/README.md.in > python/README.md && \ diff --git a/docs/sphinx/using/install/local_installation.rst b/docs/sphinx/using/install/local_installation.rst index 4aa49182803..4610c87cb79 100644 --- a/docs/sphinx/using/install/local_installation.rst +++ b/docs/sphinx/using/install/local_installation.rst @@ -892,9 +892,11 @@ The following table summarizes the required components. * - NVIDIA GPU with Compute Capability - 7.5+ * - CUDA - - 12.x (Driver 525.60.13+), 13.x (Driver 580.65.06+) + - 12.x (Driver 525.60.13+) For GPUs that support CUDA Forward Compatibility + - 12.6+ (Driver 560.35.05+) For all GPUs with supported architecture + - 13.x (Driver 580.65.06+) -Detailed information about supported drivers for different CUDA versions and be found `here `__. +Detailed information about supported drivers for different CUDA versions and be found `here `__. For more information on GPU forward capabilities, please refer to `this page `__. .. note:: diff --git a/pyproject.toml.cu12 b/pyproject.toml.cu12 new file mode 100644 index 00000000000..58dd7a1e6eb --- /dev/null +++ b/pyproject.toml.cu12 @@ -0,0 +1,83 @@ +# ============================================================================ # +# Copyright (c) 2022 - 2025 NVIDIA Corporation & Affiliates. # +# All rights reserved. # +# # +# This source code and the accompanying materials are made available under # +# the terms of the Apache License 2.0 which accompanies this distribution. # +# ============================================================================ # + +[project] +name = "cuda-quantum-cu12" +dynamic = ["version"] +keywords = [ "cudaq", "cuda-quantum", "cuda", "quantum", "quantum computing", "nvidia", "high-performance computing" ] +description="Python bindings for the CUDA-Q toolkit for heterogeneous quantum-classical workflows." +authors = [{name = "NVIDIA Corporation & Affiliates"}] +maintainers = [{name = "NVIDIA Corporation & Affiliates"}] +readme = { file="python/README.md.in", content-type = "text/markdown"} +requires-python = ">=3.10" +license = { file="LICENSE" } +dependencies = [ + 'astpretty ~= 3.0', + 'cuquantum-cu12 == 25.09', + 'numpy >= 1.24', + 'scipy >= 1.10.1', + 'requests >= 2.31', + 'nvidia-cublas-cu12 ~= 12.0', + 'nvidia-curand-cu12 ~= 10.3', + 'nvidia-cusparse-cu12 ~= 12.5', + 'nvidia-cuda-runtime-cu12 ~= 12.0', + 'nvidia-cusolver-cu12 ~= 11.4', + 'nvidia-cuda-nvrtc-cu12 ~= 12.0', + 'cupy-cuda12x ~= 13.4.1' +] +classifiers = [ + 'Intended Audience :: Science/Research', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', + "Environment :: GPU :: NVIDIA CUDA", + "Environment :: GPU :: NVIDIA CUDA :: 11", + "Environment :: GPU :: NVIDIA CUDA :: 12", + 'Topic :: Software Development', + 'Topic :: Scientific/Engineering', +] + +[project.urls] +Homepage = "https://developer.nvidia.com/cuda-q" +Documentation = "https://nvidia.github.io/cuda-quantum" +Repository = "https://github.com/NVIDIA/cuda-quantum" +Releases = "https://nvidia.github.io/cuda-quantum/latest/releases.html" + +# We must use h5py<3.11 because 3.11 doesn't include aarch64 Linux wheels. +# https://github.com/h5py/h5py/issues/2408 +[project.optional-dependencies] +chemistry = [ "openfermionpyscf==0.5", "h5py<3.11" ] +visualization = [ "qutip<5" , "matplotlib>=3.5" ] +# Additional torch-based integrator +integrators = [ "torchdiffeq" ] + +[build-system] +requires = ["scikit-build-core==0.9.10", "cmake>=3.27,<3.29", "numpy>=1.24", "pytest==8.2.0"] +build-backend = "scikit_build_core.build" + +[tool.scikit-build] +wheel.packages = ["python/cudaq"] +wheel.license-files = [ "LICENSE", "NOTICE", "CITATION.cff" ] +build-dir = "_skbuild" +metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" +cmake.minimum-version = "3.27" +cmake.build-type = "Release" +cmake.verbose = false +cmake.args = [ + "-DCUDAQ_ENABLE_PYTHON=TRUE", + "-DCUDAQ_DISABLE_CPP_FRONTEND=TRUE", + "-DCUDAQ_DISABLE_TOOLS=TRUE", + "-DCUDAQ_BUILD_TESTS=TRUE" +] + +[tool.setuptools_scm] +write_to = "_version.py" diff --git a/pyproject.toml b/pyproject.toml.cu13 similarity index 100% rename from pyproject.toml rename to pyproject.toml.cu13 From d101bca945a0a8720a33457d7b633f66f0d4a6ea Mon Sep 17 00:00:00 2001 From: Mitchell Date: Sun, 26 Oct 2025 14:53:40 -0700 Subject: [PATCH 07/34] update pyproject.toml.cu13 deps Signed-off-by: Mitchell --- pyproject.toml.cu13 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml.cu13 b/pyproject.toml.cu13 index a2423d5fa7b..aa7bd274301 100644 --- a/pyproject.toml.cu13 +++ b/pyproject.toml.cu13 @@ -22,13 +22,13 @@ dependencies = [ 'numpy >= 1.24', 'scipy >= 1.10.1', 'requests >= 2.31', - 'nvidia-cublas-cu12 ~= 12.9', - 'nvidia-curand-cu12 ~= 10.3', - 'nvidia-cusparse-cu12 ~= 12.5', - 'nvidia-cuda-runtime-cu12 ~= 12.9', - 'nvidia-cusolver-cu12 ~= 11.7', - 'nvidia-cuda-nvrtc-cu12 ~= 12.9', - 'cupy-cuda13x ~= 13.6.0' + 'nvidia-cublas ~= 13.1', + 'nvidia-curand ~= 10.4', + 'nvidia-cusparse ~= 12.6', + 'nvidia-cuda-runtime ~= 13.0', + 'nvidia-cusolver ~= 12.0', + 'nvidia-cuda-nvrtc ~= 13.0', + 'cupy-cuda13x ~= 13.4.1' ] classifiers = [ 'Intended Audience :: Science/Research', From 5d61f7a75b975f7aaeb26c1f235b48a089eef3b5 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Sun, 26 Oct 2025 15:04:31 -0700 Subject: [PATCH 08/34] copy all pyproject templates Signed-off-by: Mitchell --- docker/build/assets.Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/build/assets.Dockerfile b/docker/build/assets.Dockerfile index d6d77cc3886..6d5cb333a43 100644 --- a/docker/build/assets.Dockerfile +++ b/docker/build/assets.Dockerfile @@ -164,7 +164,8 @@ RUN source /cuda-quantum/scripts/configure_build.sh && \ ## [Python support] FROM prereqs AS python_build -ADD "pyproject.toml" /cuda-quantum/pyproject.toml +# Bring all possible templates into the image, then pick the exact one +ADD pyproject.toml.cu* /cuda-quantum/ ADD "python" /cuda-quantum/python ADD "cmake" /cuda-quantum/cmake ADD "include" /cuda-quantum/include From 12de0fac38753848f56cc0aaeceda82c38e25126 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Sun, 26 Oct 2025 15:05:39 -0700 Subject: [PATCH 09/34] bump cupy Signed-off-by: Mitchell --- pyproject.toml.cu13 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml.cu13 b/pyproject.toml.cu13 index aa7bd274301..3e8e085372b 100644 --- a/pyproject.toml.cu13 +++ b/pyproject.toml.cu13 @@ -28,7 +28,7 @@ dependencies = [ 'nvidia-cuda-runtime ~= 13.0', 'nvidia-cusolver ~= 12.0', 'nvidia-cuda-nvrtc ~= 13.0', - 'cupy-cuda13x ~= 13.4.1' + 'cupy-cuda13x ~= 13.6.0' ] classifiers = [ 'Intended Audience :: Science/Research', From f4e2ffe7ca19deba236d5b3e777830eba84228fa Mon Sep 17 00:00:00 2001 From: Mitchell Date: Sun, 26 Oct 2025 15:15:27 -0700 Subject: [PATCH 10/34] explcitly copy cu13 for pyproject template for metapackage build Signed-off-by: Mitchell --- .github/workflows/python_metapackages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python_metapackages.yml b/.github/workflows/python_metapackages.yml index 9d3ff0249d5..e49774925f7 100644 --- a/.github/workflows/python_metapackages.yml +++ b/.github/workflows/python_metapackages.yml @@ -82,6 +82,7 @@ jobs: echo "For more information, please see [CUDA-Q on PyPI](https://pypi.org/project/cudaq)." >> README.md echo "Building cuda-quantum metapackage ..." + cp pyproject.toml.cu13 pyproject.toml sed -i 's/name = "cudaq"/name = "cuda-quantum"/' pyproject.toml echo 'Please remove the cuda-quantum package and `pip install cudaq` instead.' > _deprecated.txt CUDAQ_META_WHEEL_BUILD=1 python3 -m build . --sdist From 5f7d16fef51b1f3ddd04e14e3fef9b8f6161af6e Mon Sep 17 00:00:00 2001 From: Mitchell Date: Sun, 26 Oct 2025 21:12:32 -0700 Subject: [PATCH 11/34] remove bad cp Signed-off-by: Mitchell --- .github/workflows/python_metapackages.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python_metapackages.yml b/.github/workflows/python_metapackages.yml index e49774925f7..9d3ff0249d5 100644 --- a/.github/workflows/python_metapackages.yml +++ b/.github/workflows/python_metapackages.yml @@ -82,7 +82,6 @@ jobs: echo "For more information, please see [CUDA-Q on PyPI](https://pypi.org/project/cudaq)." >> README.md echo "Building cuda-quantum metapackage ..." - cp pyproject.toml.cu13 pyproject.toml sed -i 's/name = "cudaq"/name = "cuda-quantum"/' pyproject.toml echo 'Please remove the cuda-quantum package and `pip install cudaq` instead.' > _deprecated.txt CUDAQ_META_WHEEL_BUILD=1 python3 -m build . --sdist From 5fe3f621142d682b49ef7ac10d7eee28482facf6 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Sun, 26 Oct 2025 21:13:27 -0700 Subject: [PATCH 12/34] make docs formatting happy Signed-off-by: Mitchell --- docs/sphinx/using/install/local_installation.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/sphinx/using/install/local_installation.rst b/docs/sphinx/using/install/local_installation.rst index 4610c87cb79..fd46bbf5752 100644 --- a/docs/sphinx/using/install/local_installation.rst +++ b/docs/sphinx/using/install/local_installation.rst @@ -892,10 +892,11 @@ The following table summarizes the required components. * - NVIDIA GPU with Compute Capability - 7.5+ * - CUDA - - 12.x (Driver 525.60.13+) For GPUs that support CUDA Forward Compatibility - - 12.6+ (Driver 560.35.05+) For all GPUs with supported architecture - - 13.x (Driver 580.65.06+) + - 12.x (Driver 525.60.13+) – For GPUs that support CUDA Forward Compatibility + 12.6+ (Driver 560.35.05+) – For all GPUs with supported architecture + + 13.x (Driver 580.65.06+) Detailed information about supported drivers for different CUDA versions and be found `here `__. For more information on GPU forward capabilities, please refer to `this page `__. .. note:: From 6b27b5a68beb468f158ed9b088b20c6f49109e03 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Mon, 27 Oct 2025 07:39:33 -0700 Subject: [PATCH 13/34] fix weird formatting for CUDA driver version Signed-off-by: Mitchell --- docs/sphinx/using/install/local_installation.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/sphinx/using/install/local_installation.rst b/docs/sphinx/using/install/local_installation.rst index fd46bbf5752..f2b46a51c74 100644 --- a/docs/sphinx/using/install/local_installation.rst +++ b/docs/sphinx/using/install/local_installation.rst @@ -892,11 +892,10 @@ The following table summarizes the required components. * - NVIDIA GPU with Compute Capability - 7.5+ * - CUDA - - 12.x (Driver 525.60.13+) – For GPUs that support CUDA Forward Compatibility - - 12.6+ (Driver 560.35.05+) – For all GPUs with supported architecture - - 13.x (Driver 580.65.06+) + - • 12.x (Driver 525.60.13+) – For GPUs that support CUDA Forward Compatibility + • 12.6+ (Driver 560.35.05+) – For all GPUs with supported architecture + • 13.x (Driver 580.65.06+) + Detailed information about supported drivers for different CUDA versions and be found `here `__. For more information on GPU forward capabilities, please refer to `this page `__. .. note:: From ccb885918b261086ddb9483cec7bac27c30f54ab Mon Sep 17 00:00:00 2001 From: Mitchell Date: Mon, 27 Oct 2025 08:04:27 -0700 Subject: [PATCH 14/34] update pyproject metadata to accurately reflect capabilities Signed-off-by: Mitchell --- pyproject.toml.cu12 | 2 -- pyproject.toml.cu13 | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml.cu12 b/pyproject.toml.cu12 index 58dd7a1e6eb..9aace12c265 100644 --- a/pyproject.toml.cu12 +++ b/pyproject.toml.cu12 @@ -35,12 +35,10 @@ classifiers = [ 'Intended Audience :: Developers', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', "Environment :: GPU :: NVIDIA CUDA", - "Environment :: GPU :: NVIDIA CUDA :: 11", "Environment :: GPU :: NVIDIA CUDA :: 12", 'Topic :: Software Development', 'Topic :: Scientific/Engineering', diff --git a/pyproject.toml.cu13 b/pyproject.toml.cu13 index 3e8e085372b..6695c365c88 100644 --- a/pyproject.toml.cu13 +++ b/pyproject.toml.cu13 @@ -35,13 +35,12 @@ classifiers = [ 'Intended Audience :: Developers', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', "Environment :: GPU :: NVIDIA CUDA", - "Environment :: GPU :: NVIDIA CUDA :: 11", "Environment :: GPU :: NVIDIA CUDA :: 12", + "Environment :: GPU :: NVIDIA CUDA :: 13", 'Topic :: Software Development', 'Topic :: Scientific/Engineering', ] From 470301b488e69d0fa47682410f426cae8b9ef080 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Mon, 27 Oct 2025 12:30:29 -0700 Subject: [PATCH 15/34] copy cuda 13 pyproject template for test in devenv Signed-off-by: Mitchell --- .github/workflows/test_in_devenv.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_in_devenv.yml b/.github/workflows/test_in_devenv.yml index 92c9c1e4412..61e7d6db35a 100644 --- a/.github/workflows/test_in_devenv.yml +++ b/.github/workflows/test_in_devenv.yml @@ -242,6 +242,7 @@ jobs: . "$VENV_DIR/bin/activate" pip install iqm-client -vvv + cp pyproject.toml.cu13 pyproject.toml pip install . -vvv pyinstall_status=$? if [ ! $pyinstall_status -eq 0 ]; then From e82745e2ce6aafaeb8be872ec74796979a8e5b1d Mon Sep 17 00:00:00 2001 From: Mitchell Date: Mon, 27 Oct 2025 12:53:29 -0700 Subject: [PATCH 16/34] unitary_compiliation pin huggingface-hub to 0.36.0 Signed-off-by: Mitchell --- .../python/unitary_compilation_diffusion_models.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/applications/python/unitary_compilation_diffusion_models.ipynb b/docs/sphinx/applications/python/unitary_compilation_diffusion_models.ipynb index da445040bce..2c9890d733f 100644 --- a/docs/sphinx/applications/python/unitary_compilation_diffusion_models.ipynb +++ b/docs/sphinx/applications/python/unitary_compilation_diffusion_models.ipynb @@ -89,7 +89,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install genQC==0.2.3 torch --break-system-packages -q" + "!pip install genQC==0.2.3 huggingface-hub==0.36.0 torch --break-system-packages -q" ] }, { From 8ed8ff58be58a7bdd29a58a505886777e6e48af5 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 28 Oct 2025 07:02:40 -0700 Subject: [PATCH 17/34] add debug messaging for python metapackage Signed-off-by: Mitchell --- python/cudaq/__init__.py | 101 ++++++++++++++++++++++++++++---------- python/cudaq/_packages.py | 4 ++ 2 files changed, 80 insertions(+), 25 deletions(-) diff --git a/python/cudaq/__init__.py b/python/cudaq/__init__.py index ced6751ee5a..e290bd22599 100644 --- a/python/cudaq/__init__.py +++ b/python/cudaq/__init__.py @@ -18,31 +18,82 @@ # LinkedLibraryHolder. if not "CUDAQ_DYNLIBS" in os.environ and not cuda_major is None: try: - custatevec_libs = get_library_path(f"custatevec-cu{cuda_major}") - custatevec_path = os.path.join(custatevec_libs, "libcustatevec.so.1") - - cutensornet_libs = get_library_path(f"cutensornet-cu{cuda_major}") - cutensornet_path = os.path.join(cutensornet_libs, "libcutensornet.so.2") - - cudensitymat_libs = get_library_path(f"cudensitymat-cu{cuda_major}") - cudensitymat_path = os.path.join(cudensitymat_libs, - "libcudensitymat.so.0") - - cutensor_libs = get_library_path(f"cutensor-cu{cuda_major}") - cutensor_path = os.path.join(cutensor_libs, "libcutensor.so.2") - - curand_libs = get_library_path(f"nvidia-curand-cu{cuda_major}") - curand_path = os.path.join(curand_libs, "libcurand.so.10") - - cudart_libs = get_library_path(f"nvidia-cuda_runtime-cu{cuda_major}") - cudart_path = os.path.join(cudart_libs, f"libcudart.so.{cuda_major}") - - cuda_nvrtc_libs = get_library_path(f"nvidia-cuda_nvrtc-cu{cuda_major}") - cuda_nvrtc_path = os.path.join(cuda_nvrtc_libs, - f"libnvrtc.so.{cuda_major}") - - os.environ[ - "CUDAQ_DYNLIBS"] = f"{custatevec_path}:{cutensornet_path}:{cudensitymat_path}:{cutensor_path}:{cudart_path}:{curand_path}:{cuda_nvrtc_path}" + if cuda_major == 12: + custatevec_libs = get_library_path(f"custatevec-cu{cuda_major}") + custatevec_path = os.path.join(custatevec_libs, "libcustatevec.so.1") + + cutensornet_libs = get_library_path(f"cutensornet-cu{cuda_major}") + cutensornet_path = os.path.join(cutensornet_libs, "libcutensornet.so.2") + + cudensitymat_libs = get_library_path(f"cudensitymat-cu{cuda_major}") + cudensitymat_path = os.path.join(cudensitymat_libs, + "libcudensitymat.so.0") + + cutensor_libs = get_library_path(f"cutensor-cu{cuda_major}") + cutensor_path = os.path.join(cutensor_libs, "libcutensor.so.2") + + curand_libs = get_library_path(f"nvidia-curand-cu{cuda_major}") + curand_path = os.path.join(curand_libs, "libcurand.so.10") + + cudart_libs = get_library_path(f"nvidia-cuda_runtime-cu{cuda_major}") + cudart_path = os.path.join(cudart_libs, f"libcudart.so.{cuda_major}") + + cuda_nvrtc_libs = get_library_path(f"nvidia-cuda_nvrtc-cu{cuda_major}") + cuda_nvrtc_path = os.path.join(cuda_nvrtc_libs, + f"libnvrtc.so.{cuda_major}") + + os.environ[ + "CUDAQ_DYNLIBS"] = f"{custatevec_path}:{cutensornet_path}:{cudensitymat_path}:{cutensor_path}:{cudart_path}:{curand_path}:{cuda_nvrtc_path}" + else: # CUDA 13 + print(cuda_major) + + custatevec_libs = get_library_path(f"custatevec-cu{cuda_major}") + print(custatevec_libs) + custatevec_path = os.path.join(custatevec_libs, "libcustatevec.so.1") + print(custatevec_path) + print() + + cutensornet_libs = get_library_path(f"cutensornet-cu{cuda_major}") + print(cutensornet_libs) + cutensornet_path = os.path.join(cutensornet_libs, "libcutensornet.so.2") + print(cutensornet_path) + print() + + + cudensitymat_libs = get_library_path(f"cudensitymat-cu{cuda_major}") + print(cudensitymat_libs) + cudensitymat_path = os.path.join(cudensitymat_libs, + "libcudensitymat.so.0") + print(cudensitymat_path) + print() + + cutensor_libs = get_library_path(f"cutensor-cu{cuda_major}") + print(cutensor_libs) + cutensor_path = os.path.join(cutensor_libs, "libcutensor.so.2") + print(cutensor_path) + print() + + curand_libs = get_library_path(f"nvidia-curand") + print(curand_libs) + curand_path = os.path.join(curand_libs, "libcurand.so.10") + print(curand_path) + print() + + cudart_libs = get_library_path(f"nvidia-cuda_runtime") + print(cudart_libs) + cudart_path = os.path.join(cudart_libs, f"libcudart.so.{cuda_major}") + print(cudart_path) + print() + + cuda_nvrtc_libs = get_library_path(f"nvidia-cuda_nvrtc") + print(cuda_nvrtc_libs) + cuda_nvrtc_path = os.path.join(cuda_nvrtc_libs, + f"libnvrtc.so.{cuda_major}") + print(cuda_nvrtc_path) + print() + + os.environ[ + "CUDAQ_DYNLIBS"] = f"{custatevec_path}:{cutensornet_path}:{cudensitymat_path}:{cutensor_path}:{cudart_path}:{curand_path}:{cuda_nvrtc_path}" except: import importlib.util package_spec = importlib.util.find_spec(f"cuda-quantum-cu{cuda_major}") diff --git a/python/cudaq/_packages.py b/python/cudaq/_packages.py index a419b6b6ec4..0bdf8f89172 100644 --- a/python/cudaq/_packages.py +++ b/python/cudaq/_packages.py @@ -45,5 +45,9 @@ def get_library_path(package_name): package_location = _find_package_location_by_root(package_name) dirname = os.path.join(package_location, subdir, "lib") + if not os.path.isdir(dirname): + # In cuda 13, path looks like /**/site-packages/nvidia/cu13/lib + dirname = os.path.join(package_location, subdir, "cu13/lib") + print("dirname: ", dirname) assert os.path.isdir(dirname) return dirname From 8bee2eb19bf473384d0a85d2d935faef3632ff62 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 28 Oct 2025 10:28:52 -0700 Subject: [PATCH 18/34] add symlink for pyproject.toml template to be cu13 by default Signed-off-by: Mitchell --- MANIFEST.in | 2 ++ pyproject.toml | 1 + 2 files changed, 3 insertions(+) create mode 100644 MANIFEST.in create mode 120000 pyproject.toml diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000000..6989b1f7978 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include pyproject.toml.cu12 +include pyproject.toml.cu13 diff --git a/pyproject.toml b/pyproject.toml new file mode 120000 index 00000000000..aedc7fe21e0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1 @@ +pyproject.toml.cu13 \ No newline at end of file From 051a56b3687f97fb3abde7b1ffee21ea3ee4bdff Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 28 Oct 2025 10:29:25 -0700 Subject: [PATCH 19/34] add cublas* to dynlibs Signed-off-by: Mitchell --- python/cudaq/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python/cudaq/__init__.py b/python/cudaq/__init__.py index e290bd22599..8e305f015cd 100644 --- a/python/cudaq/__init__.py +++ b/python/cudaq/__init__.py @@ -92,8 +92,18 @@ print(cuda_nvrtc_path) print() + cublas_libs = get_library_path(f"nvidia-cublas") + print(cuda_nvrtc_libs) + cublas_path = os.path.join(cuda_nvrtc_libs, + f"libcublas.so.{cuda_major}") + cublaslt_path = os.path.join(cuda_nvrtc_libs, + f"libcublasLt.so.{cuda_major}") + print(cublas_path) + print(cublaslt_path) + print() + os.environ[ - "CUDAQ_DYNLIBS"] = f"{custatevec_path}:{cutensornet_path}:{cudensitymat_path}:{cutensor_path}:{cudart_path}:{curand_path}:{cuda_nvrtc_path}" + "CUDAQ_DYNLIBS"] = f"{custatevec_path}:{cutensornet_path}:{cudensitymat_path}:{cutensor_path}:{cudart_path}:{curand_path}:{cuda_nvrtc_path}:{cublas_path}:{cublaslt_path}" except: import importlib.util package_spec = importlib.util.find_spec(f"cuda-quantum-cu{cuda_major}") From 9b5182f57b17d0c39bd611b218ca566705e50ed2 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 28 Oct 2025 10:41:16 -0700 Subject: [PATCH 20/34] true out when cp pyproject. Same as symlink so will error. Signed-off-by: Mitchell --- .github/workflows/test_in_devenv.yml | 1 - docker/build/assets.Dockerfile | 4 ++-- docker/release/cudaq.wheel.Dockerfile | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_in_devenv.yml b/.github/workflows/test_in_devenv.yml index 61e7d6db35a..92c9c1e4412 100644 --- a/.github/workflows/test_in_devenv.yml +++ b/.github/workflows/test_in_devenv.yml @@ -242,7 +242,6 @@ jobs: . "$VENV_DIR/bin/activate" pip install iqm-client -vvv - cp pyproject.toml.cu13 pyproject.toml pip install . -vvv pyinstall_status=$? if [ ! $pyinstall_status -eq 0 ]; then diff --git a/docker/build/assets.Dockerfile b/docker/build/assets.Dockerfile index 6d5cb333a43..b5a18f4c72d 100644 --- a/docker/build/assets.Dockerfile +++ b/docker/build/assets.Dockerfile @@ -190,8 +190,8 @@ RUN dnf install -y --nobest --setopt=install_weak_deps=False ${PYTHON}-devel && RUN cd /cuda-quantum && \ . scripts/configure_build.sh && \ case "${CUDA_VERSION%%.*}" in \ - 12) cp pyproject.toml.cu12 pyproject.toml ;; \ - 13) cp pyproject.toml.cu13 pyproject.toml ;; \ + 12) cp pyproject.toml.cu12 pyproject.toml || true ;; \ + 13) cp pyproject.toml.cu13 pyproject.toml || true ;; \ *) echo "Unsupported CUDA_VERSION=${CUDA_VERSION}"; exit 1 ;; \ esac && \ # Needed to retrigger the LLVM build, since the MLIR Python bindings diff --git a/docker/release/cudaq.wheel.Dockerfile b/docker/release/cudaq.wheel.Dockerfile index d3cd7af9b55..6e6624d6201 100644 --- a/docker/release/cudaq.wheel.Dockerfile +++ b/docker/release/cudaq.wheel.Dockerfile @@ -41,8 +41,8 @@ RUN echo "Building MLIR bindings for python${python_version}" && \ RUN cd /cuda-quantum && \ . scripts/configure_build.sh && \ case "${CUDA_VERSION%%.*}" in \ - 12) cp pyproject.toml.cu12 pyproject.toml ;; \ - 13) cp pyproject.toml.cu13 pyproject.toml ;; \ + 12) cp pyproject.toml.cu12 pyproject.toml || true ;; \ + 13) cp pyproject.toml.cu13 pyproject.toml || true ;; \ *) echo "Unsupported CUDA_VERSION=${CUDA_VERSION}"; exit 1 ;; \ esac From 04879c289a94532ce285b653b6f207fdd60e9ab3 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 28 Oct 2025 10:46:38 -0700 Subject: [PATCH 21/34] place MANIFEST.in properly Signed-off-by: Mitchell --- MANIFEST.in => python/metapackages/MANIFEST.in | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename MANIFEST.in => python/metapackages/MANIFEST.in (100%) diff --git a/MANIFEST.in b/python/metapackages/MANIFEST.in similarity index 100% rename from MANIFEST.in rename to python/metapackages/MANIFEST.in From e09453a10c3103fe6f113de21f9f1cbb73acc4ce Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 28 Oct 2025 11:06:43 -0700 Subject: [PATCH 22/34] ignore license check for new MANIFEST file Signed-off-by: Mitchell --- .licenserc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.licenserc.yaml b/.licenserc.yaml index 70a23a33914..c981aca94bb 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -41,6 +41,7 @@ header: - 'include/cudaq/Optimizer/CodeGen/OptUtils.h' - 'lib/Optimizer/CodeGen/OptUtils.cpp' - 'runtime/cudaq/algorithms/optimizers/nlopt/nlopt-src' + - 'python/metapackages/MANIFEST.in' comment: on-failure From 2d4f052c8f362a20455d967124e322cd0954528e Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 28 Oct 2025 11:20:37 -0700 Subject: [PATCH 23/34] make spellechecker happy Signed-off-by: Mitchell --- python/cudaq/__init__.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/python/cudaq/__init__.py b/python/cudaq/__init__.py index 8e305f015cd..173ea6686d5 100644 --- a/python/cudaq/__init__.py +++ b/python/cudaq/__init__.py @@ -20,14 +20,16 @@ try: if cuda_major == 12: custatevec_libs = get_library_path(f"custatevec-cu{cuda_major}") - custatevec_path = os.path.join(custatevec_libs, "libcustatevec.so.1") + custatevec_path = os.path.join(custatevec_libs, + "libcustatevec.so.1") cutensornet_libs = get_library_path(f"cutensornet-cu{cuda_major}") - cutensornet_path = os.path.join(cutensornet_libs, "libcutensornet.so.2") + cutensornet_path = os.path.join(cutensornet_libs, + "libcutensornet.so.2") cudensitymat_libs = get_library_path(f"cudensitymat-cu{cuda_major}") cudensitymat_path = os.path.join(cudensitymat_libs, - "libcudensitymat.so.0") + "libcudensitymat.so.0") cutensor_libs = get_library_path(f"cutensor-cu{cuda_major}") cutensor_path = os.path.join(cutensor_libs, "libcutensor.so.2") @@ -35,35 +37,39 @@ curand_libs = get_library_path(f"nvidia-curand-cu{cuda_major}") curand_path = os.path.join(curand_libs, "libcurand.so.10") - cudart_libs = get_library_path(f"nvidia-cuda_runtime-cu{cuda_major}") - cudart_path = os.path.join(cudart_libs, f"libcudart.so.{cuda_major}") + cudart_libs = get_library_path( + f"nvidia-cuda_runtime-cu{cuda_major}") + cudart_path = os.path.join(cudart_libs, + f"libcudart.so.{cuda_major}") - cuda_nvrtc_libs = get_library_path(f"nvidia-cuda_nvrtc-cu{cuda_major}") + cuda_nvrtc_libs = get_library_path( + f"nvidia-cuda_nvrtc-cu{cuda_major}") cuda_nvrtc_path = os.path.join(cuda_nvrtc_libs, - f"libnvrtc.so.{cuda_major}") + f"libnvrtc.so.{cuda_major}") os.environ[ "CUDAQ_DYNLIBS"] = f"{custatevec_path}:{cutensornet_path}:{cudensitymat_path}:{cutensor_path}:{cudart_path}:{curand_path}:{cuda_nvrtc_path}" - else: # CUDA 13 + else: # CUDA 13 print(cuda_major) custatevec_libs = get_library_path(f"custatevec-cu{cuda_major}") print(custatevec_libs) - custatevec_path = os.path.join(custatevec_libs, "libcustatevec.so.1") + custatevec_path = os.path.join(custatevec_libs, + "libcustatevec.so.1") print(custatevec_path) print() cutensornet_libs = get_library_path(f"cutensornet-cu{cuda_major}") print(cutensornet_libs) - cutensornet_path = os.path.join(cutensornet_libs, "libcutensornet.so.2") + cutensornet_path = os.path.join(cutensornet_libs, + "libcutensornet.so.2") print(cutensornet_path) print() - cudensitymat_libs = get_library_path(f"cudensitymat-cu{cuda_major}") print(cudensitymat_libs) cudensitymat_path = os.path.join(cudensitymat_libs, - "libcudensitymat.so.0") + "libcudensitymat.so.0") print(cudensitymat_path) print() @@ -81,23 +87,24 @@ cudart_libs = get_library_path(f"nvidia-cuda_runtime") print(cudart_libs) - cudart_path = os.path.join(cudart_libs, f"libcudart.so.{cuda_major}") + cudart_path = os.path.join(cudart_libs, + f"libcudart.so.{cuda_major}") print(cudart_path) print() cuda_nvrtc_libs = get_library_path(f"nvidia-cuda_nvrtc") print(cuda_nvrtc_libs) cuda_nvrtc_path = os.path.join(cuda_nvrtc_libs, - f"libnvrtc.so.{cuda_major}") + f"libnvrtc.so.{cuda_major}") print(cuda_nvrtc_path) print() cublas_libs = get_library_path(f"nvidia-cublas") print(cuda_nvrtc_libs) cublas_path = os.path.join(cuda_nvrtc_libs, - f"libcublas.so.{cuda_major}") + f"libcublas.so.{cuda_major}") cublaslt_path = os.path.join(cuda_nvrtc_libs, - f"libcublasLt.so.{cuda_major}") + f"libcublasLt.so.{cuda_major}") print(cublas_path) print(cublaslt_path) print() From b856a7dcb1f947ac7e07216451948381e243817d Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 28 Oct 2025 11:22:05 -0700 Subject: [PATCH 24/34] make spellcheck happy Signed-off-by: Mitchell --- python/cudaq/_packages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cudaq/_packages.py b/python/cudaq/_packages.py index 0bdf8f89172..3610a68ad53 100644 --- a/python/cudaq/_packages.py +++ b/python/cudaq/_packages.py @@ -46,7 +46,7 @@ def get_library_path(package_name): dirname = os.path.join(package_location, subdir, "lib") if not os.path.isdir(dirname): - # In cuda 13, path looks like /**/site-packages/nvidia/cu13/lib + # Check for cu13 layout dirname = os.path.join(package_location, subdir, "cu13/lib") print("dirname: ", dirname) assert os.path.isdir(dirname) From c3a733456909cc62c7cef285f951f88fd28c3bcd Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 28 Oct 2025 13:21:47 -0700 Subject: [PATCH 25/34] link more nvidia libraries for cu13 Signed-off-by: Mitchell --- python/cudaq/__init__.py | 41 ++++++++-------------------- python/cudaq/_packages.py | 1 - python/utils/LinkedLibraryHolder.cpp | 14 ++++++++-- 3 files changed, 22 insertions(+), 34 deletions(-) diff --git a/python/cudaq/__init__.py b/python/cudaq/__init__.py index 173ea6686d5..6c837ca4c4b 100644 --- a/python/cudaq/__init__.py +++ b/python/cudaq/__init__.py @@ -50,67 +50,48 @@ os.environ[ "CUDAQ_DYNLIBS"] = f"{custatevec_path}:{cutensornet_path}:{cudensitymat_path}:{cutensor_path}:{cudart_path}:{curand_path}:{cuda_nvrtc_path}" else: # CUDA 13 - print(cuda_major) - custatevec_libs = get_library_path(f"custatevec-cu{cuda_major}") - print(custatevec_libs) custatevec_path = os.path.join(custatevec_libs, "libcustatevec.so.1") - print(custatevec_path) - print() cutensornet_libs = get_library_path(f"cutensornet-cu{cuda_major}") - print(cutensornet_libs) cutensornet_path = os.path.join(cutensornet_libs, "libcutensornet.so.2") - print(cutensornet_path) - print() cudensitymat_libs = get_library_path(f"cudensitymat-cu{cuda_major}") - print(cudensitymat_libs) cudensitymat_path = os.path.join(cudensitymat_libs, "libcudensitymat.so.0") - print(cudensitymat_path) - print() cutensor_libs = get_library_path(f"cutensor-cu{cuda_major}") - print(cutensor_libs) cutensor_path = os.path.join(cutensor_libs, "libcutensor.so.2") - print(cutensor_path) - print() curand_libs = get_library_path(f"nvidia-curand") - print(curand_libs) curand_path = os.path.join(curand_libs, "libcurand.so.10") - print(curand_path) - print() cudart_libs = get_library_path(f"nvidia-cuda_runtime") - print(cudart_libs) cudart_path = os.path.join(cudart_libs, f"libcudart.so.{cuda_major}") - print(cudart_path) - print() cuda_nvrtc_libs = get_library_path(f"nvidia-cuda_nvrtc") - print(cuda_nvrtc_libs) cuda_nvrtc_path = os.path.join(cuda_nvrtc_libs, f"libnvrtc.so.{cuda_major}") - print(cuda_nvrtc_path) - print() + cuda_nvrtc_builtin_path = os.path.join(cuda_nvrtc_libs, + f"libnvrtc-builtins.so.{cuda_major}.0") cublas_libs = get_library_path(f"nvidia-cublas") - print(cuda_nvrtc_libs) - cublas_path = os.path.join(cuda_nvrtc_libs, + cublas_path = os.path.join(cublas_libs, f"libcublas.so.{cuda_major}") - cublaslt_path = os.path.join(cuda_nvrtc_libs, + cublaslt_path = os.path.join(cublas_libs, f"libcublasLt.so.{cuda_major}") - print(cublas_path) - print(cublaslt_path) - print() + + cusolver_libs = get_library_path(f"nvidia-cusolver") + cusolver_path = os.path.join(cusolver_libs, + f"libcusolver.so.12") + cusolvermg_path = os.path.join(cusolver_libs, + f"libcusolverMg.so.12") os.environ[ - "CUDAQ_DYNLIBS"] = f"{custatevec_path}:{cutensornet_path}:{cudensitymat_path}:{cutensor_path}:{cudart_path}:{curand_path}:{cuda_nvrtc_path}:{cublas_path}:{cublaslt_path}" + "CUDAQ_DYNLIBS"] = f"{cudart_path}:{curand_path}:{cuda_nvrtc_path}:{cuda_nvrtc_builtin_path}:{cublas_path}:{cublaslt_path}:{cusolver_path}:{cusolvermg_path}:{cutensor_path}:{custatevec_path}:{cutensornet_path}:{cudensitymat_path}" except: import importlib.util package_spec = importlib.util.find_spec(f"cuda-quantum-cu{cuda_major}") diff --git a/python/cudaq/_packages.py b/python/cudaq/_packages.py index 3610a68ad53..3147a94d0fb 100644 --- a/python/cudaq/_packages.py +++ b/python/cudaq/_packages.py @@ -48,6 +48,5 @@ def get_library_path(package_name): if not os.path.isdir(dirname): # Check for cu13 layout dirname = os.path.join(package_location, subdir, "cu13/lib") - print("dirname: ", dirname) assert os.path.isdir(dirname) return dirname diff --git a/python/utils/LinkedLibraryHolder.cpp b/python/utils/LinkedLibraryHolder.cpp index c2164085efe..66e3ecd3ce1 100644 --- a/python/utils/LinkedLibraryHolder.cpp +++ b/python/utils/LinkedLibraryHolder.cpp @@ -216,9 +216,17 @@ LinkedLibraryHolder::LinkedLibraryHolder() { } // Load all the defaults - for (auto &p : libPaths) - libHandles.emplace(p.string(), - dlopen(p.string().c_str(), RTLD_GLOBAL | RTLD_NOW)); + for (auto &p : libPaths) { + void *libHandle = dlopen(p.string().c_str(), RTLD_GLOBAL | RTLD_NOW); + libHandles.emplace(p.string(), libHandle); + + if (!libHandle) { + char *error_msg = dlerror(); + CUDAQ_INFO("Failed to load '{}': ERROR '{}'", + p.string(), + (error_msg ? std::string(error_msg) : "unknown.")); + } + } // directory_iterator ordering is unspecified, so sort it to make it // repeatable and consistent. From 8b7a5e250e92b8fac85c8db90f1a5b9cff712bcd Mon Sep 17 00:00:00 2001 From: Thien Nguyen Date: Mon, 14 Jul 2025 02:31:41 +0000 Subject: [PATCH 26/34] Compatability fixes for cupy 13.5+ Signed-off-by: Thien Nguyen --- python/runtime/cudaq/algorithms/py_state.cpp | 100 +++++++++++++++++-- 1 file changed, 92 insertions(+), 8 deletions(-) diff --git a/python/runtime/cudaq/algorithms/py_state.cpp b/python/runtime/cudaq/algorithms/py_state.cpp index a96a056f6a0..966a4fa3c1c 100644 --- a/python/runtime/cudaq/algorithms/py_state.cpp +++ b/python/runtime/cudaq/algorithms/py_state.cpp @@ -182,6 +182,58 @@ state pyGetStateLibraryMode(py::object kernel, py::args args) { }); } +static py::buffer_info getCupyBufferInfo(py::buffer cupy_buffer) { + // Note: cupy 13.5+ arrays will bind (overload resolution) to a py::buffer + // type. However, we cannot access the underlying buffer info via a + // `.request()` as it will throw unless that is managed memory. Here, we + // retrieve and construct buffer_info from the CuPy array interface. + + if (!py::hasattr(cupy_buffer, "__cuda_array_interface__")) { + throw std::runtime_error("Buffer is not a CuPy array"); + } + + py::dict cupy_array_info = cupy_buffer.attr("__cuda_array_interface__"); + // Ref: https://numba.readthedocs.io/en/stable/cuda/cuda_array_interface.html + // example: {'shape': (2, 2), 'typestr': '(); + void *dataPtr = (void *)dataInfo[0].cast(); + const bool readOnly = dataInfo[1].cast(); + auto shapeTuple = cupy_array_info["shape"].cast(); + std::vector extents; + for (std::size_t i = 0; i < shapeTuple.size(); i++) { + extents.push_back(shapeTuple[i].cast()); + } + const std::string typeStr = cupy_array_info["typestr"].cast(); + if (typeStr != "), + py::format_descriptor>::format()) + : std::make_tuple( + sizeof(std::complex), + py::format_descriptor>::format()); + + std::vector strides(extents.size(), dataTypeSize); + for (size_t i = 1; i < extents.size(); ++i) + strides[i] = strides[i - 1] * extents[i - 1]; + + return py::buffer_info(dataPtr, dataTypeSize, /*itemsize */ + desc, extents.size(), /* ndim */ + extents, /* shape */ + strides, /* strides */ + readOnly /* readonly */ + ); +} + /// @brief Bind the get_state cudaq function void bindPyState(py::module &mod, LinkedLibraryHolder &holder) { py::enum_(mod, "InitialStateType", @@ -292,8 +344,16 @@ void bindPyState(py::module &mod, LinkedLibraryHolder &holder) { .def_static( "from_data", [&](py::buffer data) { - // This is by default host data - auto info = data.request(); + const bool isHostData = + !py::hasattr(data, "__cuda_array_interface__"); + // Check that the target is GPU-based, i.e., can handle device + // pointer. + if (!holder.getTarget().config.GpuRequired && !isHostData) + throw std::runtime_error(fmt::format( + "Current target '{}' does not support CuPy arrays.", + holder.getTarget().name)); + + auto info = isHostData ? data.request() : getCupyBufferInfo(data); if (info.format == py::format_descriptor>::format()) { return state::from_data(std::make_pair( @@ -318,10 +378,20 @@ void bindPyState(py::module &mod, LinkedLibraryHolder &holder) { "Return a state from data.") .def_static( "from_data", - [](const std::vector &tensors) { + [&holder](const std::vector &tensors) { + const bool isHostData = + tensors.empty() || + !py::hasattr(tensors[0], "__cuda_array_interface__"); + // Check that the target is GPU-based, i.e., can handle device + // pointer. + if (!holder.getTarget().config.GpuRequired && !isHostData) + throw std::runtime_error(fmt::format( + "Current target '{}' does not support CuPy arrays.", + holder.getTarget().name)); cudaq::TensorStateData tensorData; for (auto &tensor : tensors) { - auto info = tensor.request(); + auto info = + isHostData ? tensor.request() : getCupyBufferInfo(tensor); const std::vector extents(info.shape.begin(), info.shape.end()); tensorData.emplace_back( @@ -387,6 +457,8 @@ void bindPyState(py::module &mod, LinkedLibraryHolder &holder) { .def_static( "from_data", [&holder](py::object opaqueData) { + // Note: This overload is no longer needed from cupy 13.5+ onward. + // We can remove it in future releases. // Make sure this is a CuPy array if (!py::hasattr(opaqueData, "data")) throw std::runtime_error( @@ -582,16 +654,26 @@ index pair. "Compute the overlap between the provided :class:`State`'s.") .def( "overlap", - [](state &self, py::buffer &other) { + [&holder](state &self, py::buffer &other) { if (self.get_num_tensors() != 1) throw std::runtime_error("overlap NumPy interop only supported " "for vector and matrix state data."); - py::buffer_info info = other.request(); + const bool isHostData = + !py::hasattr(other, "__cuda_array_interface__"); + // Check that the target is GPU-based, i.e., can handle device + // pointer. + if (!holder.getTarget().config.GpuRequired && !isHostData) + throw std::runtime_error(fmt::format( + "Current target '{}' does not support CuPy arrays.", + holder.getTarget().name)); + py::buffer_info info = + isHostData ? other.request() : getCupyBufferInfo(other); if (info.shape.size() > 2) - throw std::runtime_error("overlap NumPy interop only supported " - "for vector and matrix state data."); + throw std::runtime_error( + "overlap NumPy/CuPy interop only supported " + "for vector and matrix state data."); // Check that the shapes are compatible std::size_t otherNumElements = 1; @@ -638,6 +720,8 @@ index pair. .def( "overlap", [](state &self, py::object other) { + // Note: This overload is no longer needed from cupy 13.5+ onward. + // We can remove it in future releases. // Make sure this is a CuPy array if (!py::hasattr(other, "data")) throw std::runtime_error( From 8b19f7e88f38f46163cea062495f2e957129b257 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Thu, 30 Oct 2025 17:16:23 -0700 Subject: [PATCH 27/34] upgrade cupy to 13.6.0 for cu12 Signed-off-by: Mitchell --- pyproject.toml.cu12 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml.cu12 b/pyproject.toml.cu12 index 9aace12c265..703330389d5 100644 --- a/pyproject.toml.cu12 +++ b/pyproject.toml.cu12 @@ -28,7 +28,7 @@ dependencies = [ 'nvidia-cuda-runtime-cu12 ~= 12.0', 'nvidia-cusolver-cu12 ~= 11.4', 'nvidia-cuda-nvrtc-cu12 ~= 12.0', - 'cupy-cuda12x ~= 13.4.1' + 'cupy-cuda12x ~= 13.6.0' ] classifiers = [ 'Intended Audience :: Science/Research', From 4db45ec6b3414bf98835e1d1260cce7968203069 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Thu, 30 Oct 2025 17:20:29 -0700 Subject: [PATCH 28/34] install nvidia-curand-cu in docker image Signed-off-by: Mitchell --- docker/release/cudaq.ext.Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/release/cudaq.ext.Dockerfile b/docker/release/cudaq.ext.Dockerfile index 46fe28fd3d4..38ef5dec59b 100644 --- a/docker/release/cudaq.ext.Dockerfile +++ b/docker/release/cudaq.ext.Dockerfile @@ -49,6 +49,9 @@ RUN if [ -x "$(command -v pip)" ]; then \ pip install --no-cache-dir mpi4py~=3.1; \ fi; \ fi +RUN cuda_version_suffix=$(echo ${CUDA_VERSION} | tr . -) && \ + pip install nvidia-curand-cu${cuda_version_suffix} + # Make sure that apt-get remains updated at the end!; # If we don't do that, then apt-get will get confused when some CUDA # components are already installed but not all of them. From 03c2595a50f0411b629022be671817bdab8df764 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Thu, 30 Oct 2025 22:48:46 -0700 Subject: [PATCH 29/34] remove CUDA 11 references from docs Signed-off-by: Mitchell --- .github/workflows/docker_images.yml | 2 +- .github/workflows/python_metapackages.yml | 2 +- docs/sphinx/using/install/data_center_install.rst | 4 ++-- docs/sphinx/using/quick_start.rst | 2 +- scripts/build_docs.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker_images.yml b/.github/workflows/docker_images.yml index 4a6ab0b33f5..d3b2237ca26 100644 --- a/.github/workflows/docker_images.yml +++ b/.github/workflows/docker_images.yml @@ -495,7 +495,7 @@ jobs: platform_tag=${{ needs.metadata.outputs.platform_tag }} cuda_major=`echo ${{ inputs.cuda_version }} | cut -d . -f1` if [ "$cuda_major" == "11" ]; then - deprecation_notice="**Note**: Support for CUDA 11 will be removed in future releases. Please update to CUDA 12." + deprecation_notice="" fi image_tag=${platform_tag:+$platform_tag-}${cuda_major:+cu${cuda_major}-} if ${{ github.event.pull_request.number != '' }} || [ -n "$(echo ${{ github.ref_name }} | grep pull-request/)" ]; then diff --git a/.github/workflows/python_metapackages.yml b/.github/workflows/python_metapackages.yml index 9d3ff0249d5..cc434a2f334 100644 --- a/.github/workflows/python_metapackages.yml +++ b/.github/workflows/python_metapackages.yml @@ -60,7 +60,7 @@ jobs: package_name=cudaq cuda_version_requirement="12.x or 13.x" cuda_version_conda=12.4.0 # only used as example in the install script - deprecation_notice="**Note**: Support for CUDA 11 will be removed in future releases. Please update to CUDA 12." + deprecation_notice="" cat python/README.md.in > python/metapackages/README.md for variable in package_name cuda_version_requirement cuda_version_conda deprecation_notice; do sed -i "s/.{{[ ]*$variable[ ]*}}/${!variable}/g" python/metapackages/README.md diff --git a/docs/sphinx/using/install/data_center_install.rst b/docs/sphinx/using/install/data_center_install.rst index 941dc5dcf8b..d52d45242c6 100644 --- a/docs/sphinx/using/install/data_center_install.rst +++ b/docs/sphinx/using/install/data_center_install.rst @@ -255,8 +255,8 @@ Python-specific tools: .. note:: - The wheel build by default is configured to depend on CUDA 12. To build a wheel for CUDA 11, - you need to adjust the dependencies and project name in the `pyproject.toml` file. + The wheel build by default is configured to depend on CUDA 13. To build a wheel for CUDA 12, + you need to copy the `pyproject.toml.cu12` file as `pyproject.toml`. From within the folder where you cloned the CUDA-Q repository, run the following command to build the CUDA-Q Python wheel: diff --git a/docs/sphinx/using/quick_start.rst b/docs/sphinx/using/quick_start.rst index 2872daae844..fe7a1fc351c 100644 --- a/docs/sphinx/using/quick_start.rst +++ b/docs/sphinx/using/quick_start.rst @@ -42,7 +42,7 @@ Install CUDA-Q To develop CUDA-Q applications using C++, please make sure you have a C++ toolchain installed that supports C++20, for example `g++` version 11 or newer. - Download the `install_cuda_quantum` file for your processor architecture and CUDA version (`_cu11` suffix for CUDA 11 and `_cu12` suffix for CUDA 12) + Download the `install_cuda_quantum` file for your processor architecture and CUDA version (`_cu12` suffix for CUDA 12 and `_cu13` suffix for CUDA 13) from the assets of the respective `GitHub release `__; that is, the file with the `aarch64` extension for ARM processors, and the one with `x86_64` for, e.g., Intel and AMD processors. diff --git a/scripts/build_docs.sh b/scripts/build_docs.sh index 1a8881922cd..d9e85bc9aa6 100644 --- a/scripts/build_docs.sh +++ b/scripts/build_docs.sh @@ -146,7 +146,7 @@ echo "Creating README.md for cudaq package" package_name=cudaq cuda_version_requirement="12.x or 13.x" cuda_version_conda=12.4.0 # only used as example in the install script -deprecation_notice="**Note**: Support for CUDA 11 will be removed in future releases. Please update to CUDA 12." +deprecation_notice="" cat "$repo_root/python/README.md.in" > "$repo_root/python/README.md" for variable in package_name cuda_version_requirement cuda_version_conda deprecation_notice; do sed -i "s/.{{[ ]*$variable[ ]*}}/${!variable}/g" "$repo_root/python/README.md" From 6d70560f936907d6989d595c835dae151f2bf370 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Thu, 30 Oct 2025 23:02:13 -0700 Subject: [PATCH 30/34] make code formatting happy Signed-off-by: Mitchell --- python/utils/LinkedLibraryHolder.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/utils/LinkedLibraryHolder.cpp b/python/utils/LinkedLibraryHolder.cpp index 412a2fb151d..4fcb3ee5449 100644 --- a/python/utils/LinkedLibraryHolder.cpp +++ b/python/utils/LinkedLibraryHolder.cpp @@ -222,9 +222,8 @@ LinkedLibraryHolder::LinkedLibraryHolder() { if (!libHandle) { char *error_msg = dlerror(); - CUDAQ_INFO("Failed to load '{}': ERROR '{}'", - p.string(), - (error_msg ? std::string(error_msg) : "unknown.")); + CUDAQ_INFO("Failed to load '{}': ERROR '{}'", p.string(), + (error_msg ? std::string(error_msg) : "unknown.")); } } From 33f19246527eba274c9a0f24e695960acc5fdbef Mon Sep 17 00:00:00 2001 From: Mitchell Date: Fri, 31 Oct 2025 01:17:23 -0700 Subject: [PATCH 31/34] make spell format happy Signed-off-by: Mitchell --- python/cudaq/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/python/cudaq/__init__.py b/python/cudaq/__init__.py index 6c837ca4c4b..19df5b6b69d 100644 --- a/python/cudaq/__init__.py +++ b/python/cudaq/__init__.py @@ -75,8 +75,8 @@ cuda_nvrtc_libs = get_library_path(f"nvidia-cuda_nvrtc") cuda_nvrtc_path = os.path.join(cuda_nvrtc_libs, f"libnvrtc.so.{cuda_major}") - cuda_nvrtc_builtin_path = os.path.join(cuda_nvrtc_libs, - f"libnvrtc-builtins.so.{cuda_major}.0") + cuda_nvrtc_builtin_path = os.path.join( + cuda_nvrtc_libs, f"libnvrtc-builtins.so.{cuda_major}.0") cublas_libs = get_library_path(f"nvidia-cublas") cublas_path = os.path.join(cublas_libs, @@ -85,10 +85,9 @@ f"libcublasLt.so.{cuda_major}") cusolver_libs = get_library_path(f"nvidia-cusolver") - cusolver_path = os.path.join(cusolver_libs, - f"libcusolver.so.12") + cusolver_path = os.path.join(cusolver_libs, f"libcusolver.so.12") cusolvermg_path = os.path.join(cusolver_libs, - f"libcusolverMg.so.12") + f"libcusolverMg.so.12") os.environ[ "CUDAQ_DYNLIBS"] = f"{cudart_path}:{curand_path}:{cuda_nvrtc_path}:{cuda_nvrtc_builtin_path}:{cublas_path}:{cublaslt_path}:{cusolver_path}:{cusolvermg_path}:{cutensor_path}:{custatevec_path}:{cutensornet_path}:{cudensitymat_path}" From 6925dbb66543a38da362126c3850d8de2b809d3a Mon Sep 17 00:00:00 2001 From: Mitchell Date: Fri, 31 Oct 2025 11:28:40 -0700 Subject: [PATCH 32/34] finish removing cu11, and add cuda-quantum-cu13 to setup.py Signed-off-by: Mitchell --- .github/workflows/docker_images.yml | 4 +--- docs/sphinx/using/install/local_installation.rst | 4 ++-- python/README.md.in | 2 +- python/metapackages/setup.py | 14 +++++++------- scripts/build_cudaq.sh | 6 +++--- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docker_images.yml b/.github/workflows/docker_images.yml index d3b2237ca26..f549db071b5 100644 --- a/.github/workflows/docker_images.yml +++ b/.github/workflows/docker_images.yml @@ -494,9 +494,7 @@ jobs: platform_tag=${{ needs.metadata.outputs.platform_tag }} cuda_major=`echo ${{ inputs.cuda_version }} | cut -d . -f1` - if [ "$cuda_major" == "11" ]; then - deprecation_notice="" - fi + deprecation_notice="" image_tag=${platform_tag:+$platform_tag-}${cuda_major:+cu${cuda_major}-} if ${{ github.event.pull_request.number != '' }} || [ -n "$(echo ${{ github.ref_name }} | grep pull-request/)" ]; then pr_number=`echo ${{ github.ref_name }} | grep -o [0-9]*` diff --git a/docs/sphinx/using/install/local_installation.rst b/docs/sphinx/using/install/local_installation.rst index f2b46a51c74..3ccd1e96233 100644 --- a/docs/sphinx/using/install/local_installation.rst +++ b/docs/sphinx/using/install/local_installation.rst @@ -834,10 +834,10 @@ by running the command .. note:: Please check if you have an existing installation of the `cuda-quantum`, - `cudaq-quantum-cu11`, or `cuda-quantum-cu12` package, + `cudaq-quantum-cu12`, or `cuda-quantum-cu13` package, and uninstall it prior to installing `cudaq`. The `cudaq` package supersedes the `cuda-quantum` package and will install a suitable binary distribution (either - `cuda-quantum-cu11` or `cuda-quantum-cu12`) for your system. Multiple versions + `cuda-quantum-cu12` or `cuda-quantum-cu13`) for your system. Multiple versions of a CUDA-Q binary distribution will conflict with each other and not work properly. If you previously installed the CUDA-Q pre-built binaries, you should first uninstall your diff --git a/python/README.md.in b/python/README.md.in index 34493a472ed..840ba6e3e1d 100644 --- a/python/README.md.in +++ b/python/README.md.in @@ -40,7 +40,7 @@ ${{ deprecation_notice }} > **Important:** > Please check if you have an existing installation of the `cuda-quantum`, -`cudaq-quantum-cu11`, or `cuda-quantum-cu12` package, and uninstall it prior to +`cudaq-quantum-cu12`, or `cuda-quantum-cu12` package, and uninstall it prior to installation. Different CUDA-Q binary distributions may conflict with each other causing issues. diff --git a/python/metapackages/setup.py b/python/metapackages/setup.py index 98663cf35a2..d4d69cec779 100644 --- a/python/metapackages/setup.py +++ b/python/metapackages/setup.py @@ -183,25 +183,25 @@ def _infer_best_package() -> str: """ # Find the existing wheel installation installed = [] - for pkg in ['cuda-quantum', 'cuda-quantum-cu11', 'cuda-quantum-cu12']: + for pkg in ['cuda-quantum', 'cuda-quantum-cu11', 'cuda-quantum-cu12', 'cuda-quantum-cu13']: _log(f"Looking for existing installation of {pkg}.") if _check_package_installed(pkg): installed.append(pkg) cuda_version = _get_cuda_version() if cuda_version is None: - cudaq_bdist = 'cuda-quantum-cu12' - elif cuda_version < 11000: - raise Exception(f'Your CUDA version ({cuda_version}) is too old.') + cudaq_bdist = 'cuda-quantum-cu13' elif cuda_version < 12000: - cudaq_bdist = 'cuda-quantum-cu11' - elif cuda_version <= 13000: + raise Exception(f'Your CUDA version ({cuda_version}) is too old.') + elif cuda_version < 13000: cudaq_bdist = 'cuda-quantum-cu12' + elif cuda_version < 14000: + cudaq_bdist = 'cuda-quantum-cu13' else: raise Exception(f'Your CUDA version ({cuda_version}) is too new.') _log(f"Identified {cudaq_bdist} as the best package.") - # Disallow -cu11 & -cu12 wheels from coexisting + # Disallow -cu11 & -cu12 & -cu13 wheels from coexisting conflicting = ", ".join((pkg for pkg in installed if pkg != cudaq_bdist)) _log(f"Conflicting packages: {conflicting}") if conflicting != '': diff --git a/scripts/build_cudaq.sh b/scripts/build_cudaq.sh index ccfdc4b789d..78e3a02f9b3 100755 --- a/scripts/build_cudaq.sh +++ b/scripts/build_cudaq.sh @@ -117,11 +117,11 @@ cuda_driver=${CUDACXX:-${CUDA_HOME:-/usr/local/cuda}/bin/nvcc} cuda_version=`"$cuda_driver" --version 2>/dev/null | grep -o 'release [0-9]*\.[0-9]*' | cut -d ' ' -f 2` cuda_major=`echo $cuda_version | cut -d '.' -f 1` cuda_minor=`echo $cuda_version | cut -d '.' -f 2` -if [ "$cuda_version" = "" ] || [ "$cuda_major" -lt "11" ] || ([ "$cuda_minor" -lt "8" ] && [ "$cuda_major" -eq "11" ]); then - echo "CUDA version requirement not satisfied (required: >= 11.8, got: $cuda_version)." +if [ "$cuda_version" = "" ] || [ "$cuda_major" -lt "12" ]; then + echo "CUDA version requirement not satisfied (required: >= 12.0, got: $cuda_version)." echo "GPU-accelerated components will be omitted from the build." unset cuda_driver -else +else echo "CUDA version $cuda_version detected." if [ -z "$CUQUANTUM_INSTALL_PREFIX" ] && [ -x "$(command -v pip)" ] && [ -n "$(pip list | grep -o cuquantum-python-cu$cuda_major)" ]; then CUQUANTUM_INSTALL_PREFIX="$(pip show cuquantum-python-cu$cuda_major | sed -nE 's/Location: (.*)$/\1/p')/cuquantum" From e330c0e7cf0e4d46960dfc7aa2cd813b475e9e57 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Fri, 31 Oct 2025 11:41:31 -0700 Subject: [PATCH 33/34] appease the code formatting gods Signed-off-by: Mitchell --- python/metapackages/setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/metapackages/setup.py b/python/metapackages/setup.py index d4d69cec779..2dd18f335a8 100644 --- a/python/metapackages/setup.py +++ b/python/metapackages/setup.py @@ -183,7 +183,10 @@ def _infer_best_package() -> str: """ # Find the existing wheel installation installed = [] - for pkg in ['cuda-quantum', 'cuda-quantum-cu11', 'cuda-quantum-cu12', 'cuda-quantum-cu13']: + for pkg in [ + 'cuda-quantum', 'cuda-quantum-cu11', 'cuda-quantum-cu12', + 'cuda-quantum-cu13' + ]: _log(f"Looking for existing installation of {pkg}.") if _check_package_installed(pkg): installed.append(pkg) From 5fdfafe4e7db8b44174249621efc8dbc0d637448 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Fri, 31 Oct 2025 13:43:28 -0700 Subject: [PATCH 34/34] Update python/README.md.in Co-authored-by: Bettina Heim Signed-off-by: Mitchell --- python/README.md.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/README.md.in b/python/README.md.in index 840ba6e3e1d..d65f7bf50b8 100644 --- a/python/README.md.in +++ b/python/README.md.in @@ -40,7 +40,7 @@ ${{ deprecation_notice }} > **Important:** > Please check if you have an existing installation of the `cuda-quantum`, -`cudaq-quantum-cu12`, or `cuda-quantum-cu12` package, and uninstall it prior to +`cudaq-quantum-cu11`, `cuda-quantum-cu12`, or `cuda-quantum-cu13` package, and uninstall it prior to installation. Different CUDA-Q binary distributions may conflict with each other causing issues.