Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installation instructions #179

Merged
merged 14 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,41 @@
[![Slack](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://tketusers.slack.com/join/shared_invite/zt-18qmsamj9-UqQFVdkRzxnXCcKtcarLRA#)
[![Stack Exchange](https://img.shields.io/badge/StackExchange-%23ffffff.svg?style=for-the-badge&logo=StackExchange)](https://quantumcomputing.stackexchange.com/tags/pytket)

[Pytket](https://tket.quantinuum.com/api-docs/index.html) is a python module for interfacing
[Pytket](https://docs.quantinuum.com/tket/api-docs/) is a python module for interfacing
with tket, a quantum computing toolkit and optimising compiler developed by Quantinuum.

[cuTensorNet](https://docs.nvidia.com/cuda/cuquantum/latest/cutensornet/index.html) is a
high-performance library for tensor network computations, developed by NVIDIA.
It is part of the [cuQuantum](https://docs.nvidia.com/cuda/cuquantum/latest/index.html) SDK -
a high-performance library aimed at quantum circuit simulations on the NVIDIA GPU chips,
consisting of two major components:
- `cuStateVec`: a high-performance library for state vector computations.
- `cuTensorNet`: a high-performance library for tensor network computations.

Both components have both C and Python API.
a high-performance library aimed at quantum circuit simulations on the NVIDIA GPUs.

`pytket-cutensornet` is an extension to `pytket` that allows `pytket` circuits and
expectation values to be simulated using `cuTensorNet` via an interface to
[cuQuantum Python](https://docs.nvidia.com/cuda/cuquantum/latest/cutensornet/index.html).

Currently, only single-GPU calculations are supported, but a multi-GPU execution will be
implemented in the due course using `mpi4py` library.

Some useful links:
- [API Documentation](https://tket.quantinuum.com/extensions/pytket-cutensornet/)
- [API Documentation](https://docs.quantinuum.com/tket/extensions/pytket-cutensornet/)

## Getting started

`pytket-cutensornet` is available for Python 3.10, 3.11 and 3.12 on Linux.
In order to use it, you need access to a Linux machine with an NVIDIA GPU of
Compute Capability +7.0 (check it [here](https://developer.nvidia.com/cuda-gpus)) and first
install `cuQuantum Python` following their installation
[instructions](https://docs.nvidia.com/cuda/cuquantum/latest/getting-started/index.html).
This will include the necessary dependencies such as CUDA toolkit. Then, to install
`pytket-cutensornet`, run:
In order to use it, you need access to a Linux machine (or WSL) with an NVIDIA GPU of
Compute Capability +7.0 (check it [here](https://developer.nvidia.com/cuda-gpus)).
You will need to install `cuda-toolkit` and `cuquantum-python` before `pytket-cutensornet`;
for instance, in Ubuntu 24.04:

```shell
sudo apt install cuda-toolkit
pip install cuquantum-python
pip install pytket-cutensornet
```

Alternatively, you may install cuQuantum Python following their
[instructions](https://docs.nvidia.com/cuda/cuquantum/latest/getting-started/index.html) using `conda-forge`.
This will include the necessary dependencies from CUDA toolkit. Then, you may install
`pytket-cutensornet` using `pip`.


## Bugs, support and feature requests

Please file bugs and feature requests on the Github
Expand Down Expand Up @@ -104,10 +102,10 @@ with a set of style requirements (listed in `.pylintrc`). You should run

To run the tests for a module:

1. `cd` into that module's `tests` directory;
2. ensure you have installed `pytest` and any other modules listed in
the `test-requirements.txt` file (all via `pip`);
3. run `pytest`.
```shell
pip install -r tests/test-requirements.txt
pytest tests/
```

When adding a new feature, please add a test for it. When fixing a bug, please
add a test that demonstrates the fix.
2 changes: 1 addition & 1 deletion _metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__extension_version__ = "0.10.0"
__extension_version__ = "0.10.1"
__extension_name__ = "pytket-cutensornet"
8 changes: 4 additions & 4 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
Changelog
~~~~~~~~~

Unreleased
----------
0.10.1 (December 2024)
----------------------

* Updated pytket version requirement to 1.34.
* Now supporting ``ClExpr`` operations (the new version of tket's ``ClassicalExpBox``).
* Updated pytket version requirement to 1.38.0.

0.10.0 (October 2024)
---------------------
Expand Down Expand Up @@ -41,7 +41,7 @@ Unreleased
0.7.1 (July 2024)
-----------------

* New official `documentation site <https://tket.quantinuum.com/extensions/pytket-cutensornet/>`_.
* New official `documentation site <https://docs.quantinuum.com/tket/extensions/pytket-cutensornet/>`_.
* Backend methods can now be given a ``scratch_fraction`` argument to configure the amount of GPU memory allocated to cuTensorNet contraction. Users can also configure the values of the ``StateAttribute`` and ``SamplerAttribute`` from cuTensornet via the backend interface.
* Fixed a bug causing the logger to fail displaying device properties.

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/mps_tutorial.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/examples/python/mps_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)

# ## Introduction
# This notebook provides examples of the usage of the MPS functionalities of `pytket_cutensornet`. For more information, see the docs at https://tket.quantinuum.com/extensions/pytket-cutensornet/api/index.html.
# This notebook provides examples of the usage of the MPS functionalities of `pytket_cutensornet`. For more information, see the docs at https://docs.quantinuum.com/tket/extensions/pytket-cutensornet/.
# A Matrix Product State (MPS) represents a state on `n` qubits as a list of `n` tensors connected in a line as show below:
# ![MPS](images/mps.png)
# Each of these circles corresponds to a tensor. We refer to each leg of a tensor as a *bond* and the number of bonds a tensor has is its *rank*. In code, a tensor is just a multidimensional array:
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/python/ttn_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)

# ## Introduction
# This notebook provides examples of the usage of the TTN functionalities of `pytket_cutensornet`. For more information, see the docs at https://tket.quantinuum.com/extensions/pytket-cutensornet/api/index.html.
# This notebook provides examples of the usage of the TTN functionalities of `pytket_cutensornet`. For more information, see the docs at https://docs.quantinuum.com/tket/extensions/pytket-cutensornet/.
# Some good references to learn about Tree Tensor Network state simulation:
# - For an introduction into TTN based simulation of quantum circuits: https://arxiv.org/abs/2206.01000
# - For an introduction on some of the optimisation concerns that are relevant to TTN: https://arxiv.org/abs/2209.03196
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/ttn_tutorial.ipynb

Large diffs are not rendered by default.

26 changes: 17 additions & 9 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,29 @@ a high-performance library aimed at quantum circuit simulations on the NVIDIA GP

We provide two core functionalities:

* *Full tensor network contraction*: use ``tk_to_tensor_network`` to translate a ``pytket`` circuit to a ``TensorNetwork`` and obtain expectation values and amplitudes via full tensor network contraction using ``cuQuantum``'s optimised contraction path.
* *Exact value calculation*: use ``GeneralState`` and ``GenearlBraOpKet`` to translate a ``pytket`` into a tensor network and obtain amplitudes and expectation values via full tensor network contraction using ``cuQuantum``'s optimised contraction path.

* *Matrix Product State (MPS)*: use ``simulate`` to simulate a ``pytket`` circuit, returning an ``MPS`` representation of the output state, of which you can then ``get_amplitude`` or calculate inner products with other MPS via ``vdot``.
* *Approximate state evolution*: use ``simulate`` to simulate a ``pytket`` circuit, returning a tensor network representation of the approximate output state, from which you can query properties, such as amplitudes and expectation values.

Currently, only single-GPU calculations are supported, but a multi-GPU execution will be
implemented in the due course using ``mpi4py`` library.

``pytket-cutensornet`` is available for Python 3.10, 3.11 and 3.12 on Linux.
In order to use it, you need access to a Linux machine with an NVIDIA GPU of Compute Capability +7.0 (check it `here <https://developer.nvidia.com/cuda-gpus>`_) and first install ``cuQuantum Python`` following their installation
`instructions <https://docs.nvidia.com/cuda/cuquantum/latest/python/README.html#installation>`_.
This will include the necessary dependencies such as CUDA toolkit. Then, to install
``pytket-cutensornet``, run:
In order to use it, you need access to a Linux machine (or WSL) with an NVIDIA GPU of
Compute Capability +7.0 (check it `here <https://developer.nvidia.com/cuda-gpus>`_).
You will need to install ``cuda-toolkit`` and ``cuquantum-python`` before ``pytket-cutensornet``;
for instance, in Ubuntu 24.04:

::

sudo apt install cuda-toolkit
pip install cuquantum-python
pip install pytket-cutensornet

Alternatively, you may install cuQuantum Python following their `instructions <https://docs.nvidia.com/cuda/cuquantum/latest/getting-started/index.html>`_
using ``conda-forge``. This will include the necessary dependencies from CUDA toolkit. Then, you may install
``pytket-cutensornet`` using ``pip``.

.. toctree::
api.rst
changelog.rst

.. toctree::
:caption: Example Notebooks
Expand All @@ -39,6 +42,11 @@ This will include the necessary dependencies such as CUDA toolkit. Then, to inst
examples/mps_tutorial.ipynb
examples/ttn_tutorial.ipynb

.. toctree::
:caption: Changelog

changelog.rst

.. toctree::
:caption: Useful links

Expand Down
3 changes: 2 additions & 1 deletion lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
black~=24.10
pylint~=3.3
pylint~=3.3
mypy
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
author_email="[email protected]",
python_requires=">=3.10",
project_urls={
"Documentation": "https://tket.quantinuum.com/extensions/pytket-cutensornet/index.html",
"Documentation": "https://docs.quantinuum.com/tket/extensions/pytket-cutensornet",
"Source": "https://github.com/CQCL/pytket-cutensornet",
"Tracker": "https://github.com/CQCL/pytket-cutensornet/issues",
},
Expand All @@ -42,7 +42,10 @@
license="Apache 2",
packages=find_namespace_packages(include=["pytket.*"]),
include_package_data=True,
install_requires=["pytket >= 1.34.0", "networkx >= 2.8.8"],
install_requires=[
"pytket >= 1.38.0",
"networkx >= 2.8.8",
],
classifiers=[
"Environment :: Console",
"Programming Language :: Python :: 3.10",
Expand Down
4 changes: 2 additions & 2 deletions tests/test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytest
pytest-lazy-fixture
pytest==7.0
pytest-lazy-fixture
Loading