Skip to main content

Python bindings for the CUDA-Q toolkit for heterogeneous quantum-classical workflows.

Project description

Welcome to the CUDA-Q Python API

CUDA-Q is a comprehensive framework for quantum programming. It features:

  • A programming model which extends C++ and Python with quantum kernels, enabling high-level programming in familiar languages
  • A high-performance quantum compiler, nvq++, based on the industry standard LLVM toolchain
  • Interoperability with all of the leading models and tools for accelerated computing, including CUDA, ISO standard parallelism, OpenMP, and OpenACC
  • The ability to utilize and seamlessly switch between different quantum technologies, including state-of-the-art simulator backends with NVIDIA cuQuantum and a number of different physical quantum processors (QPUs)

The CUDA-Q Python wheels contain the Python API and core components of CUDA-Q. This package installs CUDA-Q binaries that are compatible with a CUDA version ${{ cuda_version_requirement }}. More information about available packages as well as a link to the documentation and examples for each version can be found in the release notes. System and compatibility requirements are listed in the Installation Guide of the linked documentation.

Note: CUDA-Q is currently only supported on Linux operating systems using x86_64 or aarch64/arm64 processors.

Installation Including GPU-Acceleration

CUDA-Q does not require a GPU to use, but some components are GPU-accelerated.

Getting started with CUDA-Q simply requires pip install ${{ package_name }}. Please make sure your pip version is >= 24.0. If you have an NVIDIA GPU on your host system, you will be able to use it without any further installation steps.

${{ deprecation_notice }}

Important: Please check if you have an existing installation of the cuda-quantum, 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.

If you want to perform multi-GPU simulations, additional components must be installed. We recommend using Conda to do so. If you are not already using Conda, you can install a minimal version following miniconda instructions here. The following commands will create and activate a complete environment for CUDA-Q with all its dependencies:

cuda_version=${{ cuda_version_conda }} # set this variable to version ${{ cuda_version_requirement }}
conda create -y -n cudaq-env python=3.11 pip
conda install -y -n cudaq-env -c "nvidia/label/cuda-${cuda_version}" cuda
conda install -y -n cudaq-env -c conda-forge mpi4py openmpi">=5.0.3" cxx-compiler
conda env config vars set -n cudaq-env LD_LIBRARY_PATH="$CONDA_PREFIX/envs/cudaq-env/lib:$LD_LIBRARY_PATH"
conda env config vars set -n cudaq-env MPI_PATH=$CONDA_PREFIX/envs/cudaq-env
conda activate cudaq-env
pip install ${{ package_name }}
source $CONDA_PREFIX/lib/python3.11/site-packages/distributed_interfaces/activate_custom_mpi.sh

Warning (conda-forge): Installing cudaq from the conda-forge channel on recent versions of Python can lead to segmentation faults. If you see such errors, please switch to one of the Python versions 3.10.15, 3.11.10, or 3.12.7 as per the issue #2999 or #3104.

You must configure MPI by setting the following environment variables:

export OMPI_MCA_opal_cuda_support=true OMPI_MCA_btl='^openib'

If you do not set these variables you may encounter a segmentation fault.

Important: It is not sufficient to set these variable within the Conda environment, like the commands above do for LD_LIBRARY_PATH. To avoid having to set them every time you launch a new shell, we recommend adding them to ~/.profile (create the file if it does not exist), and to ~/.bash_profile or ~/.bash_login if such a file exists.

MPI uses SSH or RSH to communicate with each node unless another resource manager, such as SLURM, is used. If you are encountering an error "The value of the MCA parameter plm_rsh_agent was set to a path that could not be found", please make sure you have an SSH Client installed.

Running CUDA-Q

You should now be able to import CUDA-Q and start building quantum programs in Python!

import cudaq

kernel = cudaq.make_kernel()
qubit = kernel.qalloc()
kernel.x(qubit)
kernel.mz(qubit)

result = cudaq.sample(kernel)

Additional examples and documentation are linked in the release notes.

Contributing

There are many ways in which you can get involved with CUDA-Q. If you are interested in developing quantum applications with CUDA-Q, our GitHub repository is a great place to get started! For more information about contributing to the CUDA-Q platform, please take a look at Contributing.md.

License

CUDA-Q is an open source project. The source code is available on GitHub and licensed under Apache License 2.0. CUDA-Q makes use of the NVIDIA cuQuantum SDK to enable high-performance simulation, which is held to its own respective license.

Feedback

Please let us know your feedback and ideas for the CUDA-Q platform in the Discussions tab of our GitHub repository, or file an issue. To report security concerns please reach out to cuda-quantum@nvidia.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cuda_quantum_cu12-0.13.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (122.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

cuda_quantum_cu12-0.13.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (116.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

cuda_quantum_cu12-0.13.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (122.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

cuda_quantum_cu12-0.13.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (116.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

cuda_quantum_cu12-0.13.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (122.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

cuda_quantum_cu12-0.13.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (116.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file cuda_quantum_cu12-0.13.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.13.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3cf33b9cba6da178ca4c0583b9f8019f65d0924c7617679a1527d65b573022b8
MD5 08f6ecc00e340a84addc5a0303fe14c3
BLAKE2b-256 f2008d0d2a99904d24ad31a539929ddd05da57160bd72dc09bbb2917e11bfda6

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.13.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.13.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 17bbe5862af745e9111f426c9e36d729d95abfb0df3dea97b4c18ad44abdf02e
MD5 1acc9dd49faa062091779180b5fb806a
BLAKE2b-256 ff929ad9d75eb8a22d9b15b680e2fda58664544639a683196dd35f04cffdffde

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.13.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.13.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f8d5156c88f7105ccfebd84d0e996693f3894effe04cb6efafe7071c9cf48614
MD5 0ee66efad69461bb98e1223bd6e085d1
BLAKE2b-256 305bf09c96567d4c0fe70722750c87f3952a7c3b7bc48e50c45420069e7a171c

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.13.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.13.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 afa4ee7dd5c3fa2bb29b308e98777a84e6d13ff24d724b01b649680ed57af4f0
MD5 25d9fa536e2842cc59eda21b7b6c875e
BLAKE2b-256 11042a15ada27d859e165a9bd328f27198497680dc53c6e9a67cb3145370b1b2

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.13.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.13.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2151ef63d0204c1a756d12808efe6b7bfaa4b7c2aca894d4fd6141c74f7240aa
MD5 b6f8e84b8796f0039fc19c088051fd20
BLAKE2b-256 5645ed7e0aafa8e446cf489a740fbbf8b110d79d99d1edb0e73b32ebacbc9f2d

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.13.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.13.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 43cc9219c4b0b27a41a344ab1a0c6f4c5ab4d24bedc005717d7a042adbb4b6c8
MD5 68602d20a4299178969619cf92aab6ea
BLAKE2b-256 732f2e9531ccaababedb11e5640618b1fc69a131243d7055d98de8bdf10e503b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page