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.7.0+
  • cuTensorNet 2.6.0+
  • cuDensityMat >=0.0.5, <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.7.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

Please click this Zenodo badge to see the citation format: DOI

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-24.11.0-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.11.0-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 998e17056b6956309ce6f4ce77bb7141c70f71ecd3fa988999d90d5c7642d786
MD5 63b50d0b8e51fcf4302153755eb19bf5
BLAKE2b-256 b1c808bd5b2b2ca103bbb836a96b56f32721afc82febd17eca2d533b4567a53b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.11.0-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 62115550f70c31f23b75485929713b6f1c33f9a2915c91be4fb69aab6b6878cd
MD5 c1df5f98efc3eac83be5c58e5bbb073a
BLAKE2b-256 97e8068df2caab740f97562ae77d83dadde2c0f3db0961ac6bd8a7d7c823644f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.11.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a6796d79beda01d4a1f89b8dbea3c288522d49f963685fe592c8324fab13bb5c
MD5 0298870e64c97eb6e508154f97e392a1
BLAKE2b-256 90f744b1feff0f018122a41e229c1a2ab3403caeac5edf35b6cd8e69f846281b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.11.0-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7f98480369229641ef4d29ae10ac1102501143c195ababa2bf364af54b3eb92a
MD5 8efef3318ef1c5910b320719c5a57663
BLAKE2b-256 d78529909fa4a242c4b18bb21867e89f648592b1d5ba507f911ea19a93e8007e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.11.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1d49cc700e18e3a456cfd1c49a43adce5935b97dfc23b330be46e5e1a294363f
MD5 323745a568d8ddaa6554c4d06b8352f8
BLAKE2b-256 fa6fb1286012a1c4e4bd45b67a960265d1cba89caf0aa9526ce5e39c22135b85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.11.0-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0c0af65796f3d897cd52188309517407b1f1b57863435caaf2e999b1661c86a6
MD5 0807b47a0e955f8f7fb360bf47297f19
BLAKE2b-256 1a081e16115d0dbd2111751844c17d4299507a1a8a8ed46269c01689c6f26002

See more details on using hashes here.

Supported by

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