Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document CUDA library dependencies for python wheel #716

Merged
merged 26 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d630c0b
initial gpu backend docs
anthony-santana Sep 28, 2023
a6ce026
fill out instructions
anthony-santana Sep 28, 2023
8d450d0
fix devcontainer change
anthony-santana Sep 28, 2023
2034b58
pr comments
anthony-santana Sep 29, 2023
50c2201
more pr comments
anthony-santana Sep 29, 2023
3cf03a5
spell cehcker
anthony-santana Sep 29, 2023
e3b04ff
typo in code block
anthony-santana Sep 29, 2023
78d4f7d
rephrasing
bettinaheim Oct 2, 2023
d17e748
Merge branch 'main' into bheim/python_gpu
bettinaheim Oct 2, 2023
9505fe4
initial gpu backend docs
anthony-santana Sep 28, 2023
eb6743f
fill out instructions
anthony-santana Sep 28, 2023
8c8f7ae
fix devcontainer change
anthony-santana Sep 28, 2023
8a22715
pr comments
anthony-santana Sep 29, 2023
403db4b
more pr comments
anthony-santana Sep 29, 2023
4ff10b1
spell cehcker
anthony-santana Sep 29, 2023
74c37d8
typo in code block
anthony-santana Sep 29, 2023
16c62c7
restructuring
bettinaheim Oct 2, 2023
a4f2f80
linking examples in the release notes
bettinaheim Oct 2, 2023
7dfa8b9
just a tweak
bettinaheim Oct 2, 2023
687e7cb
Merge branch 'python_gpu' into bheim/python_gpu
bettinaheim Oct 2, 2023
51d6989
Merge pull request #1 from bettinaheim/bheim/python_gpu
anthony-santana Oct 2, 2023
c726fca
Cleaning up docs preview for PR #1.
cuda-quantum-bot Oct 2, 2023
2d75ca5
remove trailing space
anthony-santana Oct 2, 2023
48bae22
python version
anthony-santana Oct 2, 2023
ac9a9cc
Fix link in install.rst
bettinaheim Oct 2, 2023
b75477b
Fix links in simulators.rst
bettinaheim Oct 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/sphinx/api/languages/python_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Program Construction
.. automethod:: my
.. automethod:: mz
.. automethod:: c_if
.. automethod:: for_loop
.. automethod:: adjoint
.. automethod:: control
.. automethod:: apply_call
.. automethod:: for_loop

Kernel Execution
=============================
Expand Down
39 changes: 22 additions & 17 deletions docs/sphinx/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,42 +118,45 @@ or run the Python examples using the Python interpreter.
Python wheels
--------------------

CUDA Quantum Python wheels are available on [PyPI.org](https://pypi.org/project/cuda-quantum).
The CUDA Quantum Python wheels contain the Python API and core components of
CUDA Quantum. For more information about available packages and documentation,
CUDA Quantum Python wheels are available on `PyPI.org <https://pypi.org/project/cuda-quantum>`__. Installation instructions can be found in the `project description <https://pypi.org/project/cuda-quantum/#description>`__.
For more information about available versions and documentation,
see :doc:`versions`.

To install the latest release using `pip <https://pypi.org/project/pip/>`__, run
At this time, wheels are distributed for Linux operating systems only.

.. code-block:: console
There are currently no source distributions available on PyPI, but you can download the source code for the latest version of the CUDA Quantum Python wheels from our `GitHub repository <https://github.com/NVIDIA/cuda-quantum>`__. The source code for previous versions can be downloaded from the respective `GitHub Release <https://github.com/NVIDIA/cuda-quantum/releases>`__.

python3 -m pip install cuda-quantum
To build the CUDA Quantum Python API from source using pip, run the following commands:

There are currently no source distributions available on PyPI, but you can download the source code
for all releases `here <https://github.com/NVIDIA/cuda-quantum/releases>`__.
For more information about building a CUDA Quantum Python wheel from source, see the
`README <https://github.com/NVIDIA/cuda-quantum/blob/main/python/README.md>`__.
```console
git clone https://github.com/NVIDIA/cuda-quantum.git
cd cuda-quantum && ./scripts/install_prerequisites.sh
pip install .
```

For more information about building the entire C++ and Python API's, please see `Building from Source`_.

Build CUDA Quantum from Source
Building from Source
------------------------------

For more information about building CUDA Quantum from source,
we refer to the `CUDA Quantum GitHub repository`_.
Instructions for building the Python wheels from source are given in the section :ref:`install-python-wheels`.
For more information about building the entire C++ and Python API from source, we refer to the `CUDA Quantum GitHub repository`_.

.. _CUDA Quantum GitHub repository: https://github.com/NVIDIA/cuda-quantum/blob/main/Building.md


CUDA Quantum Dependencies
-------------------------
.. _dependencies-and-compatibility:

Dependencies and Compatibility
--------------------------------

CUDA Quantum can be used to simulate quantum programs (see :doc:`using/simulators`) on a CPU-only system, but a GPU is highly recommended.
CUDA 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 GPU-based simulators, see also :doc:`using/simulators`.

The supported CPUs include x86_64 (x86-64-v3 architecture and newer) and ARM64 architectures.

.. note::

The CUDA Quantum Python wheels depend on an existing CUDA installation on your system. For more information about installing the CUDA Quantum Python wheels, take a look at :ref:`this page <install-python-wheels>`.
Some of the components included in the CUDA Quantum Python wheels depend on an existing CUDA installation on your system. For more information about installing the CUDA Quantum Python wheels, take a look at :ref:`this section <install-python-wheels>`.

The following table summarizes the required components.

Expand All @@ -167,6 +170,8 @@ The following table summarizes the required components.
- Linux
* - Tested Distributions
- CentOS 8; Debian 11, 12; Fedora 38; OpenSUSE/SELD/SLES 15.5; RHEL 8, 9; Rocky 8, 9; Ubuntu 22.04
* - Python versions
- 3.8+

.. list-table:: Requirements for GPU Simulation
:widths: 30 50
Expand Down
4 changes: 4 additions & 0 deletions docs/sphinx/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The latest version of CUDA Quantum is on the main branch of our `GitHub reposito

- `Docker image (nightly builds) <https://catalog.ngc.nvidia.com/orgs/nvidia/teams/nightly/containers/cuda-quantum>`__
- `Documentation <https://nvidia.github.io/cuda-quantum/latest>`__
- `Examples <https://github.com/NVIDIA/cuda-quantum/tree/main/docs/sphinx/examples>`__

**0.4.1**

Expand All @@ -16,6 +17,7 @@ The 0.4.1 release adds support for ARM processors in the form of multi-platform
- `Docker image <https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda-quantum>`__
- `Python wheel <https://pypi.org/project/cuda-quantum/>`__
- `Documentation <https://nvidia.github.io/cuda-quantum/0.4.1>`__
- `Examples <https://github.com/NVIDIA/cuda-quantum/tree/releases/v0.4.1/docs/sphinx/examples>`__

The full change log can be found `here <https://github.com/NVIDIA/cuda-quantum/releases>`__.

Expand All @@ -30,6 +32,7 @@ The fully featured version is available as a Docker image for `linux/amd64` plat
- `Docker image <https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda-quantum/tags>`__
- `Python wheel <https://pypi.org/project/cuda-quantum/0.4.0>`__
- `Documentation <https://nvidia.github.io/cuda-quantum/0.4.0>`__
- `Examples <https://github.com/NVIDIA/cuda-quantum/tree/0.4.0/docs/sphinx/examples>`__

The full change log can be found `here <https://github.com/NVIDIA/cuda-quantum/releases/tag/0.4.0>`__.

Expand All @@ -39,3 +42,4 @@ The 0.3.0 release of CUDA Quantum is available as a Docker image for `linux/amd6

- `Docker image <https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda-quantum/tags>`__
- `Documentation <https://nvidia.github.io/cuda-quantum/0.3.0>`__
- `Examples <https://github.com/NVIDIA/cuda-quantum/tree/0.3.0/docs/sphinx/examples>`__
12 changes: 12 additions & 0 deletions docs/sphinx/using/simulators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ In python, this can be specified with
By default, this will leverage :code:`FP32` floating point types for the simulation. To
switch to :code:`FP64`, specify the :code:`nvidia-fp64` target instead.

.. note::

This backend requires an NVIDIA GPU and CUDA runtime libraries. See the section :ref:`dependencies-and-compatibility` for more information.

cuQuantum multi-node multi-GPU
++++++++++++++++++++++++++++++++++

Expand All @@ -48,6 +52,10 @@ In python, this can be specified with

cudaq.set_target('nvidia-mgpu')

.. note::

This backend requires an NVIDIA GPU, CUDA runtime libraries, as well as an MPI installation. See the section :ref:`dependencies-and-compatibility` for more information.

OpenMP CPU-only
++++++++++++++++++++++++++++++++++

Expand All @@ -66,6 +74,10 @@ The :code:`tensornet` target provides a tensor-network simulator accelerated wit
the :code:`cuTensorNet` library. This backend is currently available for use from C++ and supports
Multi-Node, Multi-GPU distribution of tensor operations required to evaluate and simulate the circuit.

.. note::

This backend requires an NVIDIA GPU and CUDA runtime libraries. See the section :ref:`dependencies-and-compatibility` for more information.

This backend exposes a set of environment variables to configure specific aspects of the simulation:

* **`CUDAQ_CUTN_HOST_RAM=8`**: Prescribes the size of the CPU Host RAM allocated by each MPI process (defaults to 4 GB). A rule of thumb is to give each MPI process the same amount of CPU Host RAM as the RAM size of the GPU assigned to it. If there is more CPU RAM available, it is fine to further increase this number.
Expand Down
7 changes: 0 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ Releases = "https://nvidia.github.io/cuda-quantum/latest/releases.html"

[project.optional-dependencies]
chemistry = [ "scipy==1.10.1", "openfermionpyscf==0.5" ]
cudart = [
# cublas is (the only library) need for the simulators but available for x86_64 only
'nvidia-cublas-cu11 ~= 11.11',
'nvidia-cusolver-cu11 ~= 11.4',
'nvidia-cusparse-cu11 ~= 11.7',
'nvidia-cuda-runtime-cu11 ~= 11.8'
]

[build-system]
requires = ["scikit-build-core", "cmake>=3.26"]
Expand Down
60 changes: 36 additions & 24 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,52 @@ computing, including CUDA, ISO standard parallelism, OpenMP, and OpenACC
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. For more information about available packages and documentation,
see our [release
notes](https://nvidia.github.io/cuda-quantum/latest/releases.html).
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][cudaq_docs_releases]. System requirements and compatibility are listed in
the Getting Started section of the linked documentation.

[cudaq_docs_releases]:
https://nvidia.github.io/cuda-quantum/latest/releases.html

## Installing CUDA Quantum

CUDA Quantum Python wheels are available on
[PyPI.org](https://pypi.org/project/cuda-quantum). To install the latest
release, simply run
To install the latest stable version of CUDA Quantum, run

```console
pip install cuda-quantum
python3 -m pip install cuda-quantum
```

At this time, wheels are distributed for Linux operating systems only. To build
the CUDA Quantum Python API from source using pip:
CUDA 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 MPI installation.

In most cases, the CUDA and MPI dependencies can be installed via package
manager. On Ubuntu 22.04, for example, the following commands install all
optional CUDA dependencies:

```console
git clone https://github.com/NVIDIA/cuda-quantum.git
cd cuda-quantum && ./scripts/install_prerequisites.sh
pip install .
arch=x86_64 # set this to sbsa for ARM processors
sudo apt-get update && sudo apt-get install -y wget
wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/$arch/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update && sudo apt-get install -y cuda-11-8
```

For more information about building the entire C++ and Python API's, please see
the CUDA Quantum [documentation][official_install].
Detailed instructions for how to install the complete CUDA toolkit on different
operating systems can be found in the [CUDA
documentation](https://docs.nvidia.com/cuda/).

[official_install]: https://nvidia.github.io/cuda-quantum/latest/install.html
If you have several GPUs available but no MPI installation yet, we recommend
taking a look at the [OpenMPI documentation](https://docs.open-mpi.org/). On
Ubuntu 22.04, for example, the following commands install the necessary MPI
libraries:

```console
sudo apt-get update && sudo apt-get install openmpi
```

## Running CUDA Quantum

Expand All @@ -57,15 +76,8 @@ kernel.mz(qubit)
result = cudaq.sample(kernel)
```

## Documentation

To see more examples, go to [python examples][python_examples], or check out the
[Python API reference][python_api_reference].

[python_examples]:
https://nvidia.github.io/cuda-quantum/latest/using/python.html
[python_api_reference]:
https://nvidia.github.io/cuda-quantum/latest/api/languages/python_api.html
Additional examples and documentation are linked in the [release
notes][cudaq_docs_releases].

## Contributing

Expand Down
Loading