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

Note: Support for CUDA 11 will be removed in future releases. Please update to CUDA 12.

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 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">=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-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.11.0-cp312-cp312-manylinux_2_28_x86_64.whl (123.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

cuda_quantum_cu11-0.11.0-cp312-cp312-manylinux_2_28_aarch64.whl (118.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

cuda_quantum_cu11-0.11.0-cp311-cp311-manylinux_2_28_x86_64.whl (123.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

cuda_quantum_cu11-0.11.0-cp311-cp311-manylinux_2_28_aarch64.whl (118.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

cuda_quantum_cu11-0.11.0-cp310-cp310-manylinux_2_28_x86_64.whl (123.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

cuda_quantum_cu11-0.11.0-cp310-cp310-manylinux_2_28_aarch64.whl (118.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

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

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.11.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 73803d6b35d1caee57e7246792c12af22d0ef6f842b2db40e9661ccf9bb113e0
MD5 e570db0c8bbbe4f5b58cae825dab8963
BLAKE2b-256 00c032bce14b1270b420231edbb9159f9a620311794224248ab2909d2c318282

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.11.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 19fe312f9ad2b52acc8c7e033acda4a86b4c8bd18b2b1e32c36d55c194e10d4f
MD5 482960303b0f6d30d6404a8a3f2ee6c2
BLAKE2b-256 60845aca42741dbfb0c8f8a6af18153249174e32187634eaeb92d6d40ad6d841

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.11.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 64b98fa935d70463645cbc4c2b05eb576ee17ed4792d1874052309350b9eae34
MD5 e7539e4097b35c5802dd519cd35a764a
BLAKE2b-256 af27240f95566742fc657fa267f0f32464b8d668386d0081e003a9949b993a62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.11.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0348d6255fb705abab6f524526d1ff48b4e87fa28ca9658e6a1f8fb5a5189fe7
MD5 2ec442611aa41397904d2ec52ed21b7c
BLAKE2b-256 8eabb4753196a4de6a87d9b0e47ac94d87be1875c7b97ed1fbbd002e5542657a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.11.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 44630858da2cd8cb04010e77057b0a9cd62544b785c05c1779c9e56235b755ef
MD5 f810f81aaddc6f5c7b948d146a0f9f7b
BLAKE2b-256 835870527bd5a3b9a6ecc40c6e50d06300d68815edb0210f9363ea0c752281b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum_cu11-0.11.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 02a7c076367004013201a2ea2be6560ab37e500a71a67eb870b73f13a6e7780f
MD5 ad40767cd9dfd49ffea867fc3615d28b
BLAKE2b-256 728de1e84b19a74584250b3d0d736ff398bf40908fa60ece4d63cdcceb313fd3

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