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.4.0+
  • cuTensorNet 2.5.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 and CUTENSORNET_ROOT can be set to point to the cuStateVec and the cuTensorNet libraries, respectively. The latter two 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:

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.8.0-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7217ce3af9797a12f31b568d50d8c09558e0b55a09d1c09f38dbf42479a31534
MD5 508caf935e9fd93807b7935f0926bbf9
BLAKE2b-256 b3276d1defe5a195c784d4a565a5d7e839fb4095e3b9fc86605bfd14987756bc

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.8.0-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e708e696edda31d6f532c6fee441ccf7204da2c70c163304d3c3e73d25cd4eb5
MD5 6fbf2bf9a7733e47f9f3baf4dc802188
BLAKE2b-256 3a67fc02093438c9c0b7a831520182ef736c693b67110f9e28f7564953f076f8

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.8.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 53c2865280fde2e23d973746b3f39c71149c5084881256cdd40bd199bd19dc02
MD5 bc7a4fff9b903a92e0a5ccadc2968d29
BLAKE2b-256 cae490e2d7d21bf31e2283f24a55fc45fdec7edc72c6734eb695094c0dfb1de2

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.8.0-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3168aa3c677cb1b8b9cc2b0a348f00fa5c0cbf6b423c6970ea86a2e73f2b8d6c
MD5 61daceaace0fb1fd1f82c25e23e3875a
BLAKE2b-256 b068ab31acf6ab0befe3872e9447a128f0be51e28e7382a03503c5f2f7df27c4

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.8.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b90fd06418879788f25c00b51a4ea003ab87a018e2f601e2ad453da132bec1d
MD5 d9da7e7258945be847baf9b23839f754
BLAKE2b-256 135e1584190b5be258e573b953743b340316c320e9583e18d8b0ec918fdd4d43

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.8.0-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9176c2e3f845f38cd85a45941a0e648c3212d613f907022bb6acfff3dc09b3b6
MD5 0a8dde2d2fbab38786dc4920f269a09b
BLAKE2b-256 d9510f9499b33707b8299c6c0d873a11aab5fb76ca0b86d8f0331f340874659e

See more details on using hashes here.

Provenance

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