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 supported on Linux (x86_64 and aarch64/arm64) and macOS (ARM64/Apple silicon, CPU-only simulation). GPU-accelerated simulation requires Linux with a supported NVIDIA GPU.

Installation Including GPU-Acceleration

CUDA-Q does not require a GPU to use, but some components are GPU-accelerated. Getting started with CUDA-Q requires pip install ${{ package_name }}. Please make sure your pip version is >= 24.0.

${{ 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.

Platform-specific instructions: Linux | macOS

Linux: GPU-Acceleration and Multi-GPU

If you have an NVIDIA GPU on your host system, you will be able to use it without any further installation steps.

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.

macOS

GPU-acceleration is not available on macOS, so a virtual environment is all you need:

python3 -m venv .venv
source .venv/bin/activate
pip install cudaq

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 Distribution

cuda_quantum_cu12-0.14.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distributions

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

cuda_quantum_cu12-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl (128.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

cuda_quantum_cu12-0.14.0-cp313-cp313-manylinux_2_28_aarch64.whl (114.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

cuda_quantum_cu12-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl (128.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

cuda_quantum_cu12-0.14.0-cp312-cp312-manylinux_2_28_aarch64.whl (114.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

cuda_quantum_cu12-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl (128.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

cuda_quantum_cu12-0.14.0-cp311-cp311-manylinux_2_28_aarch64.whl (114.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

File details

Details for the file cuda_quantum_cu12-0.14.0.tar.gz.

File metadata

  • Download URL: cuda_quantum_cu12-0.14.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for cuda_quantum_cu12-0.14.0.tar.gz
Algorithm Hash digest
SHA256 dddce110648e0450ff2df6709f7af021a67656de33218848e90814ae6c29025d
MD5 ee75de3ae2e5f7c040cd964b41c9ba78
BLAKE2b-256 7322249c2ba99b8c4e1c11df2be8bed80912e03f8be34a17c0cf162f80d9fc24

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 59cc9b4a5f0a39b3505e19551dbd4a4bed16918fa0b4ce14a8a6ffc3c2131c49
MD5 82af76ab0abe67babc8bb3c9bba74364
BLAKE2b-256 09f4c52e2dce81c9ae2f89906fc510b07004abec94a519e46bc51a877d6d7e0c

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.14.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.14.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9f57c0d1baf3d7bd35af8e940861c2e6fbe1e355b859a543384cacfc5f140b44
MD5 b877bd61574540b3312e2e2c246c36d1
BLAKE2b-256 dde32c16d83279dce5e65826b5765ab13edde4178b0f42fb3bb4b40fd016eb9c

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a62dbcfb126b1b2d7156b8a3fdba4def927aa7e9c605a3faf621c65081a698ed
MD5 a1a8e42179f81bd3ae582c827860d1d2
BLAKE2b-256 848eb1027f1cdbea0dacc03645441cef7f4b52b91c07fd9ebaf7591b112996c8

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.14.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.14.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 97beadf55358ebbc98cadef587b5a9f018d13a42fecd64ffc9cff265f2cd5360
MD5 f79cdd04b7243c2c85d200457a39f175
BLAKE2b-256 d5c6b88de04cc0a1c19858590ce2c7f5942ffc5a83a76520b9b50f0752bad21d

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 15d8ee34699128a38c163020362712a0bc417b449c0ed62782977c66c2ca2647
MD5 c3cd78a843d2e51dd5edfa65e5b3035d
BLAKE2b-256 ffb44c1e054bbb862e212ae6c17ad6a2c427ea6b68adab3d7c186c749d658487

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu12-0.14.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu12-0.14.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9c3c34fd9d2b2b5933331c5782ae6546b7d6a2cb8ff74be615de2c4074c968cc
MD5 7fff28d514f6e73e4f7633766baf0296
BLAKE2b-256 1921f1aef61ab2aa080154c4c5917f03cf75bba6747f9b4c455a601885faf8fe

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