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

File metadata

File hashes

Hashes for cuquantum_python_cu12-24.8.0-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 86808e21d6308b052bbace36e2b4e3d2dde9a924db974feac47bfcb994ed0a71
MD5 ec9904964a0e75e522757625243d8512
BLAKE2b-256 8907ef105a161870c8a2f23a8257d59829695aac3bb1f8d55166cb6955c14bc3

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu12-24.8.0-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 88487731702617bd666a8ad6d771b6d1f5016eed4b6702a194db11f0b658c91d
MD5 5c59dbea672f682e7a265a0b415f30a3
BLAKE2b-256 344c4240fab2975cd9a903a3a960a1bc4abf13ada7f7b2618ef7164673ab007f

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu12-24.8.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 22733bc2e540dc6ffa795284726c10225d25ed03d03dd4f7df8f326c6954e5ba
MD5 7265a8a73cfa3e5493f23fcddc448aa5
BLAKE2b-256 1008fcd16162c0e4be52f65a7614e9b4a2829232d6b073709ec0193f2c3664cb

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu12-24.8.0-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f5a93fb1931ced02aca169cfbc70785d217a21e2749105e97e75bb02c16f760e
MD5 958b11f4432dc6299250978c68de6803
BLAKE2b-256 1078f771c57a9782eefe0c61cea3915a7ca178b765d9a7386453749f87d09106

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu12-24.8.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5b93cf59dcf6a5baabee28e1b1a854a0b6ef6d9707523b16f451a4108c32517
MD5 e57da5b824b4ec2de16a634bcbd1468d
BLAKE2b-256 650f7f1e6b8a21bed8d6f5cfabad7f9e4d32b15929c5681f70563111de030d85

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu12-24.8.0-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7152b003fea0481f64a2637f72711072675852ed945dbcdd12a442c18c9a81af
MD5 4d0f0199053580bc9160d0754a96be56
BLAKE2b-256 e01d69ea2ba75f6a2b65319cfa582007d4440742a46e6b417ccdd2d3dd6aa7bc

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