Skip to main content

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

Project description

Welcome to the CUDA Quantum Python API

CUDA Quantum 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 Quantum Python wheels contain the Python API and core components of CUDA Quantum. 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 requirements and compatibility are listed in the Getting Started section of the linked documentation.

Installation Including GPU-Acceleration

CUDA Quantum does not require a GPU to use, but some components are GPU-accelerated. If you have access to an NVIDIA GPU, you can enable GPU-acceleration within CUDA Quantum by installing the CUDA as well as a CUDA-aware MPI implementation. 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 Quantum with all its dependencies:

    conda create -y -n cuda-quantum python=3.10 pip
    conda install -y -n cuda-quantum -c "nvidia/label/cuda-11.8.0" cuda
    conda install -y -n cuda-quantum -c conda-forge mpi4py openmpi cxx-compiler cuquantum
    conda env config vars set -n cuda-quantum LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CONDA_PREFIX/envs/cuda-quantum/lib"
    conda env config vars set -n cuda-quantum MPI_PATH=$CONDA_PREFIX/envs/cuda-quantum
    conda run -n cuda-quantum pip install cuda-quantum
    conda activate cuda-quantum
    source $CONDA_PREFIX/lib/python3.10/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 Quantum

You should now be able to import CUDA Quantum 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 Quantum. If you are interested in developing quantum applications with CUDA Quantum, our GitHub repository is a great place to get started! For more information about contributing to the CUDA Quantum platform, please take a look at Contributing.md.

License

CUDA Quantum is an open source project. The source code is available on GitHub and licensed under Apache License 2.0. CUDA Quantum 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 Quantum 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

cuda_quantum-0.7.0-cp311-cp311-manylinux_2_28_x86_64.whl (104.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

cuda_quantum-0.7.0-cp311-cp311-manylinux_2_28_aarch64.whl (98.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ ARM64

cuda_quantum-0.7.0-cp310-cp310-manylinux_2_28_x86_64.whl (104.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

cuda_quantum-0.7.0-cp310-cp310-manylinux_2_28_aarch64.whl (98.3 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ ARM64

cuda_quantum-0.7.0-cp39-cp39-manylinux_2_28_x86_64.whl (104.4 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

cuda_quantum-0.7.0-cp39-cp39-manylinux_2_28_aarch64.whl (98.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ ARM64

cuda_quantum-0.7.0-cp38-cp38-manylinux_2_28_x86_64.whl (104.4 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

cuda_quantum-0.7.0-cp38-cp38-manylinux_2_28_aarch64.whl (98.3 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ ARM64

File details

Details for the file cuda_quantum-0.7.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum-0.7.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1b1a92611115fef1af88b9a5ac22c05bb09dce30dea7624ddbe6ab5ef48e4164
MD5 714700ce25e654c46b37c9dc934b451b
BLAKE2b-256 eede2378133190e1924b245fcb528fdee8de076dee7ccce136187d63f63de606

See more details on using hashes here.

File details

Details for the file cuda_quantum-0.7.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum-0.7.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 92ad3698003b14810ecba24f23846548dca51f9500a0bc98e82042f0a12b07df
MD5 95d9a70f4a575b40d6cea3386db2dda4
BLAKE2b-256 9dec0073ba3578ce3c9373a54ae53a80c9088206c116693c96920222ed26147b

See more details on using hashes here.

File details

Details for the file cuda_quantum-0.7.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum-0.7.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 06921e59f679c776959e4ce738f0f0a2ba861478caa49a7102801d30f465b6f9
MD5 e0418ba59a6e525ed6b68106d31718c4
BLAKE2b-256 d97461ab3b4cdc9d4da8c58ee3bcd5dfc71ee1264a25cdb64e3ef85587e371d7

See more details on using hashes here.

File details

Details for the file cuda_quantum-0.7.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum-0.7.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e2725e3387518b79c6f228d58b7b7710489b70b94650bdce051f28642b4ca5ef
MD5 86f6b1975103d4f9c6f14350c7bd72a6
BLAKE2b-256 c46e35942d86587afc82684dca6a71e8308d3f3120c00129a0698a2cf9196dd1

See more details on using hashes here.

File details

Details for the file cuda_quantum-0.7.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum-0.7.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e98f79daff4f74ace69dc10bc19bd038597deb708af675e14657df8f288d2969
MD5 eba187cec48b5a609155be55e5d67d90
BLAKE2b-256 ea511144b53c44e28722b6437f39b681ed53ecddc15baf7a9c31a783f8964a80

See more details on using hashes here.

File details

Details for the file cuda_quantum-0.7.0-cp39-cp39-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum-0.7.0-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 31c407a142ffcc4f22e3c9b498c7303e3426f39321e9a425f56110cc1e0b00cb
MD5 a0855ee836868d8f6e5eb6906888ce46
BLAKE2b-256 a5e6ee69b00a484db9ce01e0b095a11718d4b6c5e8fa93de3c6ea87438048490

See more details on using hashes here.

File details

Details for the file cuda_quantum-0.7.0-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cuda_quantum-0.7.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e3513d7372ce7d14a9d85c0f4145933c054fd966dc7f542b2054a5e285017986
MD5 48bf365bb0a0baafb0359fdde8c9e60d
BLAKE2b-256 814f6c39f250055faa88554236d790036760818b0d066930ba97164d1f9ad6af

See more details on using hashes here.

File details

Details for the file cuda_quantum-0.7.0-cp38-cp38-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cuda_quantum-0.7.0-cp38-cp38-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 08688d9ad580dba6c3af8f376df2ccb4b34cf19c5b6d12c73fb028aa8ad2ee8d
MD5 32efdb52fe751903a86ea62deecd4a57
BLAKE2b-256 0b45a3dc3c4c1d66978019c8b8e66d80f678fe743cdea5e70473ca17916ce948

See more details on using hashes here.

Supported by

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