Package: cuda-quantum
Welcome to the CUDA Quantum Python APICUDA 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 languagesA high-performance quantum compiler,nvq++, based on the industry standard
LLVM toolchainInteroperability with all of the leading models and tools for accelerated
computing, including CUDA, ISO standard parallelism, OpenMP, and OpenACCThe 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 therelease
notes. System requirements and compatibility are listed in
the Getting Started section of the linked documentation.Installing CUDA QuantumTo install the latest stable version of CUDA Quantum, runpython3 -m pip install cuda-quantumCUDA Quantum can be used to compile and run quantum programs on a CPU-only
system, but a GPU is highly recommended and necessary to use the some of the
simulators. The GPU-based simulators included in the CUDA Quantum Python wheels
require an existing CUDA installation. Additionally, multi-GPU simulators
require an existing CUDA-aware MPI installation.To install the necessary dependencies, we recommend usingConda. If you are not already using Conda,
you can install a minimal version following the instructionshere. 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 pipconda install -y -n cuda-quantum -c "nvidia/label/cuda-11.8.0" cudaconda install -y -n cuda-quantum -c conda-forge mpi4py openmpi cxx-compiler cuquantumconda 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-quantumconda run -n cuda-quantum pip install cuda-quantumconda activate cuda-quantumsource $CONDA_PREFIX/lib/python3.10/site-packages/distributed_interfaces/activate_custom_mpi.shYou 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 isnotsufficient to set these variable within the Conda
environment, like the commands above do forLD_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_profileor~/.bash_loginif such a file exists.MPI usesSSHorRSHto communicate with each node
unless another resource manager, such asSLURM, is used. If you are
encountering an error "The value of the MCA parameterplm_rsh_agentwas set to
a path that could not be found", please make sure you have an SSH Client
installed.Running CUDA QuantumYou should now be able to import CUDA Quantum and start building quantum
programs in Python!import cudaqkernel = cudaq.make_kernel()qubit = kernel.qalloc()kernel.x(qubit)kernel.mz(qubit)result = cudaq.sample(kernel)Additional examples and documentation are linked in therelease
notes.ContributingThere are many ways in which you can get involved with CUDA Quantum. If you are
interested in developing quantum applications with CUDA Quantum, ourGitHub
repositoryis a great place to get started! For more information
about contributing to the CUDA Quantum platform, please take a look atContributing.md.LicenseCUDA Quantum is an open source project. The source code is available onGitHuband licensed underApache 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.FeedbackPlease let us know your feedback and ideas for the CUDA Quantum platform in theDiscussionstab of ourGitHub repository, orfile
an issue. To report security concerns please reach out tocuda-quantum@nvidia.com.