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.
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
. If you have an NVIDIA GPU on your host system, you
will be able to use it without any further installation steps.
However, 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:
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
Built Distributions
File details
Details for the file cuda_quantum-0.8.0-cp311-cp311-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: cuda_quantum-0.8.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 118.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00313ac125d908f3f99b9b90e7257767d0924501cef779c1af27488038912129 |
|
MD5 | b43778b31c0e40a9a47f0330c2b5646a |
|
BLAKE2b-256 | 75911a001a98438e7d479ee479009484ac8edb0b9af3c2852a9184ec8a9b22ce |
File details
Details for the file cuda_quantum-0.8.0-cp311-cp311-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: cuda_quantum-0.8.0-cp311-cp311-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 112.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b700ab2b9f7bb66ca7bb8d19de7ddd78f9d95165f818aa485b80fc94ada4fee2 |
|
MD5 | 9bcec432a1eb96a2b293cbdeff8acbb3 |
|
BLAKE2b-256 | 38dae4a4d6cf1f358f5becbe4ba7e097c0e2acf8137a69cd5361d70e273483c4 |
File details
Details for the file cuda_quantum-0.8.0-cp310-cp310-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: cuda_quantum-0.8.0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 118.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a201ded430d3f7d5eb52017c2514b7ba2a8a6dc768060940539a2c30d5a4d3b |
|
MD5 | d3b63164c83b357c09dbf4428ca3c958 |
|
BLAKE2b-256 | 3d042ef6dd96297be6ef7e5e38d5a212a972f1a8e3f7bbc527c8d62a532884d2 |
File details
Details for the file cuda_quantum-0.8.0-cp310-cp310-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: cuda_quantum-0.8.0-cp310-cp310-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 112.5 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 372e2e437d984515ac84e5ccd589cf5401ebb4bac1f2dd090305fb6b8ff046fa |
|
MD5 | ec15ae502260be70aad231ea8b8e2530 |
|
BLAKE2b-256 | 46a289b54e1d88fe78a50a9f92e05c36a1cadc894854e9455b1b33cf9ce427d2 |
File details
Details for the file cuda_quantum-0.8.0-cp39-cp39-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: cuda_quantum-0.8.0-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 118.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9563081b2a9f7afce95ae21b18af2686cbc8528bf34a45a4f7f21d64d84d4cb1 |
|
MD5 | 27e24606bcfd4455faec2ddb2990b568 |
|
BLAKE2b-256 | 1918fe5306db6cb32ea7061d76c9ad005799028d2d04ced5dc2e0fcd490d2e8c |
File details
Details for the file cuda_quantum-0.8.0-cp39-cp39-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: cuda_quantum-0.8.0-cp39-cp39-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 112.5 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c69ce0e79250ba7546a9ea1004b195a312ed48c15e8d562d73dc728b4014440 |
|
MD5 | 02c0913eecd4f357310d7b105cb0c531 |
|
BLAKE2b-256 | eb04cf23566309877bcc0aeeb81bcb413d2eece263f0d77efc7b507a220e5f21 |
File details
Details for the file cuda_quantum-0.8.0-cp38-cp38-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: cuda_quantum-0.8.0-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 118.7 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ae23a25b6a0c44407c551e45b75671ce9505d688efc111e9bdd50fcd5fd7018 |
|
MD5 | 5aa3e838fd86024e9e6ee3c152e4791e |
|
BLAKE2b-256 | a28c966cd16e5598013115f57bb1b1ce656d87f7c83f7bf774ed4e1abb659d49 |
File details
Details for the file cuda_quantum-0.8.0-cp38-cp38-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: cuda_quantum-0.8.0-cp38-cp38-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 112.5 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b4f3997ae9c536fc4c197c8a438f6f38e411ee64d1ad5aef958a6aeb9604c60 |
|
MD5 | bac824b4558b554a0657603cc32058a6 |
|
BLAKE2b-256 | d1b6a2b294f34859da45e00b51cb5374183695bdf96d1e49e854bdbbc6c593ff |