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

Installation Including GPU-Acceleration

CUDA-Q 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-Q 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-Q 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
conda env config vars set -n cuda-quantum LD_LIBRARY_PATH="$CONDA_PREFIX/envs/cuda-quantum/lib:$LD_LIBRARY_PATH"
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-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-0.7.1-cp311-cp311-manylinux_2_28_x86_64.whl (105.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

cuda_quantum-0.7.1-cp311-cp311-manylinux_2_28_aarch64.whl (99.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

cuda_quantum-0.7.1-cp310-cp310-manylinux_2_28_x86_64.whl (105.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

cuda_quantum-0.7.1-cp310-cp310-manylinux_2_28_aarch64.whl (99.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

cuda_quantum-0.7.1-cp39-cp39-manylinux_2_28_x86_64.whl (105.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

cuda_quantum-0.7.1-cp39-cp39-manylinux_2_28_aarch64.whl (99.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ ARM64

cuda_quantum-0.7.1-cp38-cp38-manylinux_2_28_x86_64.whl (105.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

cuda_quantum-0.7.1-cp38-cp38-manylinux_2_28_aarch64.whl (99.5 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ ARM64

File details

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

File metadata

File hashes

Hashes for cuda_quantum-0.7.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d772efdf576ce65fd02be62b21be2959776dd287e128038a5e86b6009822811d
MD5 cc3807e0dac69afe42b6a789df9641c1
BLAKE2b-256 c3db7b42bc44c21376dd73d4438f514e4421a2a04f462298dc640d26bd49301f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum-0.7.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c840f274f2b770f0127f6722d4bd7f3143afc2e1b91b44bf69c1f1cfa448ac93
MD5 a648b7d7dda44fa6c54d3eff6be95d14
BLAKE2b-256 a306fb201c55afa8f18db93bdb9f07ff48762109dae2040b7cb71fe8b91def0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum-0.7.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6997eb9a25f705907b0b8109f39a3e3175f0f865e3dcbda57e01674230a9d211
MD5 70d183015e509deaf8ed5f5963419cb6
BLAKE2b-256 7190b31bfd60a0be19849e789f63a119cd7e7c8da212dfa2c2f5d0db06f5c050

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum-0.7.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c14ae86e272a109351aa19e0260626ce1937d951babf6d0e5724f555b1ee3549
MD5 e04deee6bdc7fef0ecd03771468c0b17
BLAKE2b-256 c442f71d925ffac2658f330691612db8e811620632456ab0cbcc42d6aa1c0b7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum-0.7.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8f5d1e9b55450dc65ec57eff45cb95a73484b05fbb40984a4d5e825b62da17d1
MD5 675a592280dd4011ea57e723f8ddb62b
BLAKE2b-256 e25f6c5f464632ab6b5eced68f4a2ddf3f1ba4bd650819bb258ed89eb42327d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum-0.7.1-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c8e36d3b14792c7748bfd04c7d5233ab9036d7c34432b42a43f0053d7760c7ac
MD5 be1b7c00565bf6b118c7c0050fa8ae8f
BLAKE2b-256 48d0ca6400cd3b00f5cf1623b6f30af41e1b14ddc69d32c002797b237c1f5ec6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum-0.7.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d8806c371ed862c2db201d7e7e21bb199e86c48451e9b265f216a37012925b6d
MD5 a1f6cf59205423653a301d0ecdad1eb6
BLAKE2b-256 b710029c7d91dce4801a5936243f6eca70bb91fb1844987dcb4deb93e7ff12a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuda_quantum-0.7.1-cp38-cp38-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ff5e122e16fb73fcd3883d2aec200d0e5d0fade2ac32bc1fa0ec3095189c9e23
MD5 145bdaa9fd7e3b8d4b6770453182d844
BLAKE2b-256 579ae5fd3078edb965d99aef6d3f297b6f359676ce6c7f968b75f990e9af8433

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