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

= 11.8. 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 on x86_64 platforms simply requires pip install cuda-quantum-cu11. 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, or if you are using aarch64/arm64 processors, 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 the instructions here. The following commands will create and activate a complete environment for CUDA-Q with all its dependencies:

cuda_version=11.8.0 # set this variable to version >= 11.8
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 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-cu11
source $CONDA_PREFIX/lib/python3.11/site-packages/distributed_interfaces/activate_custom_mpi.sh

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_cu11-0.9.1-cp312-cp312-manylinux_2_28_x86_64.whl (117.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

cuda_quantum_cu11-0.9.1-cp312-cp312-manylinux_2_28_aarch64.whl (111.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

cuda_quantum_cu11-0.9.1-cp311-cp311-manylinux_2_28_x86_64.whl (117.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

cuda_quantum_cu11-0.9.1-cp311-cp311-manylinux_2_28_aarch64.whl (112.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

cuda_quantum_cu11-0.9.1-cp310-cp310-manylinux_2_28_x86_64.whl (117.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

cuda_quantum_cu11-0.9.1-cp310-cp310-manylinux_2_28_aarch64.whl (111.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

Details for the file cuda_quantum_cu11-0.9.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.9.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1d00225bbae8c5d6c483cb1b71330084b32ef2b18aa6d612fc4398c280fbfe46
MD5 0692927ae58f6db31c8d75435cb14112
BLAKE2b-256 5dfef3016dbecb85e5c2f68c8c8daf31e2b53d333a5054004bf415d11b68a0a7

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu11-0.9.1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.9.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 71782f8d3a9c4eea3a04110b76cebfc0971ba5e47d8e780ee09c21a1aee47483
MD5 6f475633adcfd60174c00e707783d6e7
BLAKE2b-256 cc863920f937b8c0aeb8d73ada0ce48b12ac65a3cc7307cf9015eb3d52c3e2f7

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu11-0.9.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.9.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7d57ac4a68eac1117801230220cb17cc49564a1717b98bb596f9a7f26bc95aa1
MD5 93fc45fb83e5f94e7eac71aa82d476b3
BLAKE2b-256 d9898fc17f9cd51c8e8e68411668ddfcae074bc3da82661d98a4eeee76564440

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu11-0.9.1-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.9.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d12659dcf6b1e4de30026fee7d23d4c48e9c6284cff042937773a7142a35bc0a
MD5 8983f01ea40a16f61008087897ae7839
BLAKE2b-256 86d6e52f17f8d186f510977428d45dc26aabb70aaaa58a36c8e99c923ef9f7ba

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu11-0.9.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.9.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 378f190d5d09b0c78150e6f9422f788e1f3732b6cf6694d75b756c56b4230c3e
MD5 39af1611f3d97e79dcebf998b4c2e031
BLAKE2b-256 d3876f2519334e3371113a21a66bf0ae590bde8bd7124aa51ba398cdf31d6365

See more details on using hashes here.

File details

Details for the file cuda_quantum_cu11-0.9.1-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.9.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dcd589b3809eec34f984be2fae41e3d5c31cffbe59dcb34a54c3a7c62708be2f
MD5 e96710f30aa44b822ca7210b0a84857f
BLAKE2b-256 2940542fd65b4fc3e7bbc9c9743df6064262dd1fc28ebfe30bdea3792d6839a3

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