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.4.0+
  • Python 3.9+
  • 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.

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.3.0.post0-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c7fa5b2a333121d8c4944b42567ef3b193a3ae94a46aa72b40de3ba90ee70ed2
MD5 4b3de80325684e13ec0bd3fdb3879b20
BLAKE2b-256 0a9e2452965ce4cb58f4cd1344c3d0466fa7982805b8a55e9d53534a412efd31

See more details on using hashes here.

Provenance

File details

Details for the file cuquantum_python_cu11-24.3.0.post0-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.3.0.post0-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 65b5ef44a4ce10ed11040b044bd690b43c70f10c598d7efbab21396293306e5a
MD5 5e602b52de27433df1f32b09e0b90d8c
BLAKE2b-256 9cce9eaea59d0948f4ef0ffc01b208db3ac327cfe2e25a975be8f867d552560c

See more details on using hashes here.

Provenance

File details

Details for the file cuquantum_python_cu11-24.3.0.post0-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.3.0.post0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f26739b3e2dd2cf414fa1520b0fe0108477168987f82654f773355aadf67d96c
MD5 a2c15fb6b8f66ec005d549784a0ebc4b
BLAKE2b-256 561c64a5a6e0be09c16074c3f3f7a025cb5dcc5177282209147e9a767929db08

See more details on using hashes here.

Provenance

File details

Details for the file cuquantum_python_cu11-24.3.0.post0-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.3.0.post0-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6306de6ca97a1811e2a2e4d0bf362cbaa29e43b408ee8675b2452ff97c386995
MD5 67e910c9e1bb59226229ad1abcf77752
BLAKE2b-256 0213f035dd776221a51dfc9f645bd19fd322decdcc50689da6ab55291993b793

See more details on using hashes here.

Provenance

File details

Details for the file cuquantum_python_cu11-24.3.0.post0-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.3.0.post0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4341fbe46d4e48d118c2329a66db5aee26135bb838ff90cfecd9fbc56f1f1081
MD5 61faffc8be788ce8f01b0f652b174a95
BLAKE2b-256 651b57828e728cd15325231bda35f8b54224104c3b4c0217d5221708da98aa98

See more details on using hashes here.

Provenance

File details

Details for the file cuquantum_python_cu11-24.3.0.post0-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.3.0.post0-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dbee7e64c1f7c314f6dbd7683adbaa54cef1efdc5dbecd9c86823d672c7d4938
MD5 325ed0dd318ab47aa1caf235333c3975
BLAKE2b-256 ac3f1685fe1a45063f820e41be4086d4af4d2b3704db4a373940bd32e8efeaed

See more details on using hashes here.

Provenance

File details

Details for the file cuquantum_python_cu11-24.3.0.post0-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.3.0.post0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f4f7a1abe93266de64f21a877bb5e42d4fa1b5d88e542248c8b8c5250217b200
MD5 b9d0ef0fef2ceae9f23b3834b0f7bb77
BLAKE2b-256 a4361a1013e8ab578eb1695c9ab78552e6703c620f804e27e76749f560ee1b7a

See more details on using hashes here.

Provenance

File details

Details for the file cuquantum_python_cu11-24.3.0.post0-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-24.3.0.post0-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2aff5829291943a1060359fbc7286c47427c0b10bd5d849defe93baac7838b78
MD5 9c85d2c17da929834977754a9c51f181
BLAKE2b-256 9bd8179f2e45286226d652eae5d5486d43c6626a8175a2cf152347add5cb7248

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