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
  • Python >=3.11, <3.14
  • Cython >=0.29.22
  • pip 21.3.1+
  • packaging
  • setuptools 61.0.0+
  • wheel 0.34.0+

Note: Starting with cuQuantum Python v25.06, cuQuantum C libraries including cuDensityMat, cuStateVec and cuTensorNet are no longer build-time dependencies. However, they are still required at runtime.

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.9.0+
  • cuTensorNet 2.8.0+
  • cuDensityMat >=0.2.0, <0.3.0
  • Python >=3.11, <3.14
  • NumPy v1.21+
  • CuPy v13.0.0+ (see installation guide)
  • PyTorch v1.10+ (optional, see installation guide)
  • Qiskit v1.4.2+ (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!
  • 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_cu12-25.6.0-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu12-25.6.0-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5947b58a6a998ff98e810b688653a0326e6e569de67c9d83669dabe20632a33c
MD5 337989e96834acb08c951123d06c61f8
BLAKE2b-256 8cbfa1da24554956c86409c0ea86acf3ad917bd2e94e81da00e0d72888f31534

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu12-25.6.0-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu12-25.6.0-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6747b389218953189cb57df6787fcd30d249e001be9848b0e54c56a2820e9e21
MD5 fe5828dfaf5973c03ae19fe062428229
BLAKE2b-256 128ec77bbdac04f3b1e3c267b44e4f4efd4e1d96ffd9fb9215e12de849ead389

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu12-25.6.0-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu12-25.6.0-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1d30b23af06e5adafc89b71d2857a945b14244dd102e0d15173406fcd95d2d6
MD5 4290c8effeacc7128687e1b3df7f5eec
BLAKE2b-256 4540574cc9392ffb6c49049d3842ec758fd6a4872e3c5abf90768de99cad6971

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu12-25.6.0-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu12-25.6.0-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4c8cbfdea0f537a911778aa2cf640f967df2af9a7ae5a36beb55536325a61164
MD5 e8906ad2703ce5a4895353001ad8199a
BLAKE2b-256 442c6fbae50358b3d0cae60ca9914f63a4dc6d7ff357ab4a1c192d9bb2624070

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu12-25.6.0-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu12-25.6.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 506aeeba5f9a4959558bd2b220d7af00da2775ddddc86d943a5dc862ee55a62e
MD5 2a2b958004f9d07c10b784ecac5504c0
BLAKE2b-256 244f60a55efef5c874717f3bd50d13df08ff80b0ee6bddbb97559cb446129824

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu12-25.6.0-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu12-25.6.0-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 88db8cddee05fbe7911b2b028acd3ce7697ddb0781c5501313321a5964401552
MD5 106879a67a516b4270702901a355d3c6
BLAKE2b-256 096e2b69770e4c695b16427cc94611245524a534c1f000240cdc668801c2ef3c

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