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

= 12.0. 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 cuda-quantum-cu12. 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.

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 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=12.0.0 # set this variable to version >= 12.0
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 cuda-quantum-cu12
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.12.0.post1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (118.5 MB view details)

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

cuda_quantum_cu12-0.12.0.post1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (112.5 MB view details)

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

cuda_quantum_cu12-0.12.0.post1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (118.5 MB view details)

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

cuda_quantum_cu12-0.12.0.post1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (112.5 MB view details)

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

cuda_quantum_cu12-0.12.0.post1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (118.5 MB view details)

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

cuda_quantum_cu12-0.12.0.post1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (112.5 MB view details)

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

cuda_quantum_cu12-0.12.0.post1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (118.5 MB view details)

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

cuda_quantum_cu12-0.12.0.post1-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (112.5 MB view details)

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

File details

Details for the file cuda_quantum_cu12-0.12.0.post1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.12.0.post1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fc469a7e1e28eae096453361b6f72fc6f64537a89e53165a12398bb4ad4a2023
MD5 0475b8adf1a511a0550293200901e907
BLAKE2b-256 77abb28acd7bb2ad6c18c632cebfe2e9b9af632b95a55826326884e020fec214

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.12.0.post1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.12.0.post1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 edc57c89a3983ea54ee1662cdce6c205b8aa2152b89efa9f629e2977b819c387
MD5 5e2491c159b95b1c9ff3132047cda32b
BLAKE2b-256 77637054df15cf800019a2b46a8d27487b78498783ac4e8f33e54b68b8ca1f94

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.12.0.post1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.12.0.post1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a0a16aa41c4b51d48d8be19a60ef48c09f3cfe5d2c3db3dae8ab5d8ece879016
MD5 a08248b20b4968126539cb25d3bba3f9
BLAKE2b-256 97b3a6fb371d330ab8361e6f7a6af8e81e33eff28bef0b88c092ed42c8716ada

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.12.0.post1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.12.0.post1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 00a2443e225ae562ed362db1604d8a26f0440ee710c9e4b37662cfc4f67d6f3e
MD5 a3379c3de016288f81272272778eac66
BLAKE2b-256 29ffa378d6c0f1fa83a6e5c35c359448ccdd6429afd1100c3bfb8f4350ff0be5

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.12.0.post1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.12.0.post1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e5481cd3c3a9d8570f2f759f973e9589fbb3faba8d2db3ba773a5c1e1462e2b
MD5 c036bf726acd9164bb51ad19df1fe125
BLAKE2b-256 d66ce0018e0c5d935530dee42330579079cb71a7ed3cfc3a0df47b805a5ac020

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.12.0.post1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.12.0.post1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 431217f149f352bc5061ca5446cc0c569a681453ed7a1afe7305ce8e24caff6e
MD5 5c0ff09a616e3894d07b0a1405936273
BLAKE2b-256 1d0d40117e8e157ec4ebb6abfe566edbb7bb9d7772f05fa90d2682c5d8fbd3b6

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.12.0.post1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.12.0.post1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e81a97f6618b358f06c132e3f305db672f50eb8f3c6f0ad546b7d2bb1efe05e0
MD5 bab2cbb817fa590ec953f43dbfa698e1
BLAKE2b-256 662df3fff0f8e56d138fa6364ecd9a9c181935d008071066009f2033e0afc1b7

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.12.0.post1-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.12.0.post1-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cfd365d5b67ab622d00c802a2c4c68ec7f7d1fdf5daae67409e812e530e7eeeb
MD5 6d7a5ca9312ee6fd5cb6f245b4df29e6
BLAKE2b-256 2dea091514bc43f26fdc252031c87ae870e4119cc8bc608e98fa2b3e13df94dd

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