NVIDIA cuQuantum Python
Project description
cuQuantum Python
Documentation
Please visit the NVIDIA cuQuantum Python documentation.
Building
Requirements
Build-time dependencies of the cuQuantum Python package and some versions that are known to work are as follows:
- CUDA Toolkit 11.x
- cuQuantum 22.07+
- cuTENSOR 1.5.0+
- Python 3.8+
- Cython - e.g. 0.29.21
- packaging
Install cuQuantum Python from conda-forge
If you already have a Conda environment set up, it is the easiest to install cuQuantum Python from the conda-forge channel:
conda install -c conda-forge cuquantum-python
The Conda solver will install all required dependencies for you.
Install cuQuantum Python from PyPI
Alternatively, assuming you already have a Python environment set up (it doesn't matter if it's a Conda env or not), you can also install cuQuantum Python this way:
pip install cuquantum-python
The pip
solver will also install both cuTENSOR and cuQuantum for you.
Note: To properly install the wheels the environment variable CUQUANTUM_ROOT
must not be set.
Install cuQuantum Python from source
To compile and install cuQuantum Python from source, please follow the steps below:
- Set
CUDA_PATH
to point to your CUDA installation - Set
CUQUANTUM_ROOT
to point to your cuQuantum installation - Set
CUTENSOR_ROOT
to point to your cuTENSOR installation - Make sure CUDA, cuQuantum and cuTENSOR are visible in your
LD_LIBRARY_PATH
- Run
pip install -v .
Notes:
- For the
pip install
step, adding the-e
flag after-v
would allow installing the package in-place (i.e., in "editable mode" for testing/developing). - If
CUSTATEVEC_ROOT
andCUTENSORNET_ROOT
are set (for the cuStateVec and the cuTensorNet libraries, respectively), they overwriteCUQUANTUM_ROOT
. - For local development, set
CUQUANTUM_IGNORE_SOLVER=1
to ignore the dependency on thecuquantum
wheel.
Running
Requirements
Runtime dependencies of the cuQuantum Python package include:
- An NVIDIA GPU with compute capability 7.0+
- Driver: Linux (450.80.02+)
- CUDA Toolkit 11.x
- cuQuantum 22.07+
- cuTENSOR 1.5.0+
- Python 3.8+
- NumPy v1.19+
- CuPy v9.5.0+ (see installation guide)
- PyTorch v1.10+ (optional, see installation guide)
- Qiskit v0.24.0+ (optional, see installation guide)
- Cirq v0.6.0+ (optional, see installation guide)
If you install everything from conda-forge, the dependencies are taken care for you (except for the driver).
If you install the pip wheels, cuTENSOR and cuQuantum (but not CUDA Toolkit or the driver,
please make sure the CUDA libraries are discoverable through your LD_LIBRARY_PATH
) are installed for you.
If you build cuQuantum Python from source, please make sure the paths to the cuQuantum and cuTENSOR libraries are added
to your LD_LIBRARY_PATH
environment variable.
Known issues:
- If a system has multiple copies of cuTENSOR, one of which is installed in a default system path, the Python runtime could pick it up despite cuQuantum Python is linked to another copy installed elsewhere, potentially causing a version-mismatch error. The proper fix is to remove cuTENSOR from the system paths to ensure the visibility of the proper copy. DO NOT ATTEMPT to use
LD_PRELOAD
to overwrite it --- it could cause hard to debug behaviors! - In certain environments, if PyTorch is installed
import cuquantum
could fail (with a segmentation fault). It is currently under investigation and a temporary workaround is to importtorch
before importingcuquantum
.
Samples
Samples for demonstrating the usage of both low-level and high-level Python APIs are
available in the samples
directory. The low-level API samples are 1:1 translations of the corresponding
samples written in C. The high-level API samples demonstrate pythonic usages of the cuTensorNet
library in Python.
Testing
If pytest is installed, typing pytest tests
at the command prompt in the Python source root directory will
run all tests. Some tests would be skipped if cffi
is not installed or if the environment
variable CUDA_PATH
is not set.
Citing cuQuantum
Project details
Release history Release notifications | RSS feed
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
Hashes for cuquantum_python_cu11-22.7.1-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1c039dfb79630d36daf5c635b453be25546d2a9cbfb19d9a3f35ad2092f4279 |
|
MD5 | 1d75b42528959f0d06e8f97ff844ec5d |
|
BLAKE2b-256 | 6389b99d8bc4a6c52b7fe5b0e8f205f8299881827f35fa6e9675687b6d6f378f |
Hashes for cuquantum_python_cu11-22.7.1-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7cc7e40e57e3b6833519da2e9ccb6b866486d87be8aae4851bd796a71a105b1 |
|
MD5 | faec6b2ca3a6fac709f9c118ada085a8 |
|
BLAKE2b-256 | f5b45a9ad75b5f4920ac917a8b7e3137f404310c8dee93c6270d4088539831e5 |
Hashes for cuquantum_python_cu11-22.7.1-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d458b832d9af531dc65ec26da609597804f2c739002e78b93cea1bb155ea05b4 |
|
MD5 | d7ce47fe8e04d277b5d9f1c3d8ae45f8 |
|
BLAKE2b-256 | 4704206f44cc6b72db8db787234f0a2d6885101c538b4dd49c3a572fac7ea635 |