Skip to main content

NVIDIA cuQuantum Python

Project description

cuQuantum Python

Documentation

Please visit the NVIDIA cuQuantum Python documentation.

For instructions on installing cuQuantum Python, refer to our getting started section

Building and installing cuQuantum Python from source

Requirements

The build-time dependencies of the cuQuantum Python package include:

  • CUDA Toolkit 11.x or 12.x
  • cuStateVec 1.8.0+
  • cuTensorNet 2.7.0+
  • cuDensityMat >=0.1.0
  • Python 3.10+
  • Cython >=0.29.22,<3
  • pip 21.3.1+
  • packaging
  • setuptools 61.0.0+
  • wheel 0.34.0+

Except for CUDA and Python, the rest of the build-time dependencies are handled by the new PEP-517-based build system (see Step 7 below).

To compile and install cuQuantum Python from source, please follow the steps below:

  1. Clone the NVIDIA/cuQuantum repository: git clone https://github.com/NVIDIA/cuQuantum
  2. Set CUDA_PATH to point to your CUDA installation
  3. [optional] Set CUQUANTUM_ROOT to point to your cuQuantum installation
  4. [optional] Set CUTENSOR_ROOT to point to your cuTENSOR installation
  5. [optional] Make sure cuQuantum and cuTENSOR are visible in your LD_LIBRARY_PATH
  6. Switch to the directory containing the Python implementation: cd cuQuantum/python
  7. Build and install:
    • Run pip install . if you skip Step 3-5 above
    • Run pip install -v --no-deps --no-build-isolation . otherwise (advanced)

Notes:

  • For Step 7, if you are building from source for testing/developing purposes you'd likely want to insert a -e flag before the last period (so pip ... . becomes pip ... -e .):
    • -e: use the "editable" (in-place) mode
    • -v: enable more verbose output
    • --no-deps: avoid installing the run-time dependencies
    • --no-build-isolation: reuse the current Python environment instead of creating a new one for building the package (this avoids installing any build-time dependencies)
  • As an alternative to setting CUQUANTUM_ROOT, CUSTATEVEC_ROOT, CUTENSORNET_ROOT and CUDENSITYMAT_ROOT can be set to point to the cuStateVec, cuTensorNet and cuDensityMat libraries, respectively. The latter three environment variables take precedence if defined.
  • Please ensure that you use consistent binaries and packages for either CUDA 11 or 12. Mixing-and-matching will result in undefined behavior.

Running

Requirements

Runtime dependencies of the cuQuantum Python package include:

  • An NVIDIA GPU with compute capability 7.0+
  • Driver: Linux (450.80.02+ for CUDA 11, 525.60.13+ for CUDA 12)
  • CUDA Toolkit 11.x or 12.x
  • cuStateVec 1.8.0+
  • cuTensorNet 2.6.0+
  • cuDensityMat >=0.0.5, <0.1.0
  • Python 3.10+
  • NumPy v1.21+
  • CuPy v13.0.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)
  • mpi4py v3.1.0+ (optional, see installation guide)

If you install everything from conda-forge, all the required dependencies are taken care for you (except for the driver).

If you install the pip wheels, CuPy, cuTENSOR and cuQuantum (but not CUDA Toolkit or the driver, please make sure the CUDA libraries are visible through your LD_LIBRARY_PATH) are installed for you.

If you build cuQuantum Python from source, please make sure that the paths to the CUDA, cuQuantum, and cuTENSOR libraries are added to your LD_LIBRARY_PATH environment variable, and that a compatible CuPy is installed.

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 import torch before importing cuquantum.
  • Please ensure that you use consistent binaries and packages for either CUDA 11 or 12. Mixing-and-matching will result in undefined behavior.

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 and cuDensityMat 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

H. Bayraktar et al., "cuQuantum SDK: A High-Performance Library for Accelerating Quantum Science", 2023 IEEE International Conference on Quantum Computing and Engineering (QCE), Bellevue, WA, USA, 2023, pp. 1050-1061, doi: 10.1109/QCE57702.2023.00119

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

File details

Details for the file cuquantum_python_cu11-25.3.0-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-25.3.0-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b61047b563f1e9cac975e8356bca53b51c735c9e8c5401ac4049a68dbfaf22ad
MD5 58a133c03ba22c66171eb9d4c27160dc
BLAKE2b-256 796c010a0cf60ee28a82c65013a695625e2f4238a9b35017a7d5ff694777185d

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu11-25.3.0-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-25.3.0-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b103d19394ae43ec28657c126449f35baf0c721047e63565a79b73a2625e6e98
MD5 1085b4067152714d0db7435e12e44a90
BLAKE2b-256 51e76baec565e332c8f957baa1b3d9f8b2e2e9bc8f2f3a881b67170e7db7b8e8

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu11-25.3.0-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-25.3.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 70a577423cf83f0e6ee45c433bf3eaad242278ea2131ee2dd1364b710f24a641
MD5 7a376e7f2d3d7c88f68852a7d7b57ac5
BLAKE2b-256 fc471549014a83848d2958d3bbb3c2c1df0dd4bfa21330e0a150868bbb000860

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu11-25.3.0-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-25.3.0-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 067e3999e3823fb6cf38af3d407a09024f07d8aecd48f2ab2830debf752de52a
MD5 e3d36c307d459581f50fabf3db5f63aa
BLAKE2b-256 bd4ccb0b726e064776af2fc5b9c6ee0450cfb6b039fe0875753cf81d26f03cd1

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu11-25.3.0-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-25.3.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4adee1ddac2a2ef98defb8ede11520b83941e637b410dc28d762e01594bee82b
MD5 5f0954c570b8e17d48ab677b897f19f3
BLAKE2b-256 50c886102e9789dbb5dd8c459b9055125a26b60c201c60bb04a00c0697650688

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu11-25.3.0-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-25.3.0-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1c5a4be3966f3e4565d642091a303841a0bcab1b4c4be94208702c2de5ca0363
MD5 6dd9ee7da8c730e00053ab9132090221
BLAKE2b-256 5f365aa2edd7532cb2985109cd657769b9e78c4e1417f05b6cd983205e53331d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page