Skip to main content

NVIDIA cuQuantum Python

Project description

cuQuantum Python

Documentation

Please visit the NVIDIA cuQuantum Python documentation.

Installation

Install cuQuantum Python from conda-forge

If you already have a Conda environment set up, it is the easiest to install cuQuantum Python from the conda-forge channel:

conda install -c conda-forge cuquantum-python

The Conda solver will install all required dependencies for you.

Install cuQuantum Python from PyPI

Alternatively, assuming you already have a Python environment set up (it doesn't matter if it's a Conda env or not), you can also install cuQuantum Python this way:

pip install cuquantum-python-cu11

The pip solver will also install all dependencies for you (including both cuTENSOR and cuQuantum wheels).

Notes:

  • User can still install cuQuantum Python using pip install cuquantum-python, which currently points to the cuquantum-python-cu11 wheel that is subject to change in the future. Installing wheels with the -cuXX suffix is encouraged.
  • To manually manage all Python dependencies, append --no-deps to pip install to bypass the pip solver, see below.

Building and installing cuQuantum Python from source

Requirements

The build-time dependencies of the cuQuantum Python package include:

  • CUDA Toolkit 11.x
  • cuStateVec 1.1.0+
  • cuTensorNet 2.0.0+
  • cuTENSOR 1.5.0+
  • Python 3.8+
  • 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.

Running

Requirements

Runtime dependencies of the cuQuantum Python package include:

If you install everything from conda-forge, the dependencies are taken care for you (except for the driver).

If you install the pip wheels, cuTENSOR and cuQuantum (but not CUDA Toolkit or the driver, please make sure the CUDA libraries are discoverable through your LD_LIBRARY_PATH) are installed for you.

If you build cuQuantum Python from source, please make sure the paths to the cuQuantum and cuTENSOR libraries are added to your LD_LIBRARY_PATH environment variable.

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.

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

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

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

If you're not sure about the file name format, learn more about wheel file names.

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-22.11.0.1-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e40b42ee5e9a963e1bbdbb4df78f725994f39a4a8ac382642c9ea0f77b27cbb8
MD5 0f25450223dad4a5a38f9b7c2d36513e
BLAKE2b-256 6daee44faa13a341e856b84311df133287e5570407dce8f7c024c835f9387542

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cuquantum_python_cu11-22.11.0.1-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 32281ca730fb5814c04b68abf7e16b8c61cac667f1624017638f686ae515f97f
MD5 47e72ed99185fbdc6b67ef9d3f46a569
BLAKE2b-256 928b0ab5ca1f93478c44a24ccd4f5c54da56babbda1bf3fc20090dc1e0f84b2e

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu11-22.11.0.1-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-22.11.0.1-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7072931b2061a594738d09109eecaef048c2cd55a939f65177af702ed2f543d
MD5 ec8940093d79fcc35108aabaa6cbbd98
BLAKE2b-256 18a36829e4b1f407a95f3a673bc371cfef0eb3ad588d40023869207c364f30f4

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu11-22.11.0.1-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-22.11.0.1-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f5712e6804af92d3cbebea61454a6538ba85ea01d58bdc9890b6f433048e6eae
MD5 31242cd692c29fcd0d6bae778964f08a
BLAKE2b-256 e5c28e38a386bedfdec9af453a4f1d03a5dcdb2b568ed02c5392e97dd306a830

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu11-22.11.0.1-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-22.11.0.1-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d297c1ae5230495c7a71ccdb299f3a7cd99c3f136d9f90316b5f1b7273c2fd2e
MD5 26b9f6a65ce38edb94fa2d66fd2ba978
BLAKE2b-256 437276eb87fec37f04a02658b847b2f7e1123f1153c4d1978adde0fc52231e98

See more details on using hashes here.

File details

Details for the file cuquantum_python_cu11-22.11.0.1-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cuquantum_python_cu11-22.11.0.1-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b8e7242c5554c01e14ba626f31dbc0ddd2f5d9df732fc40b25f359e2e85dd933
MD5 b2f203638366c5b846484fa93e6ed966
BLAKE2b-256 48930ba9120571cc145889a739216d04f356e2c010f16e36438335ea5f1e805f

See more details on using hashes here.

Supported by

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