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

Release/v0.6.0 #95

Merged
merged 23 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4a7b3a0
Merge pull request #76 from CQCL/main
cqc-melf Jan 23, 2024
dc1523b
Bump the python-packages group with 1 update
dependabot[bot] Jan 29, 2024
a7b10bd
Merge pull request #77 from CQCL/dependabot/pip/python-packages-35d4e…
PabloAndresCQ Jan 29, 2024
4317b14
Basic TTN simulation (#41)
PabloAndresCQ Feb 2, 2024
5079ed6
Bump actions/deploy-pages from 4.0.3 to 4.0.4
dependabot[bot] Feb 6, 2024
f8d516a
Merge pull request #79 from CQCL/dependabot/github_actions/actions/de…
PabloAndresCQ Feb 9, 2024
7f3c33c
Bump the python-packages group with 2 updates
dependabot[bot] Feb 26, 2024
2066437
Merge pull request #81 from CQCL/dependabot/pip/python-packages-b41a4…
PabloAndresCQ Feb 29, 2024
e1225b4
update dependabot to weekly (#85)
cqc-melf Mar 12, 2024
3d0ca98
Bump the python-packages group with 1 update
dependabot[bot] Mar 18, 2024
3c9c234
Bump actions/deploy-pages from 4.0.4 to 4.0.5
dependabot[bot] Mar 25, 2024
d563176
Merge pull request #86 from CQCL/dependabot/pip/python-packages-81350…
PabloAndresCQ Mar 27, 2024
399dc78
Merge pull request #89 from CQCL/dependabot/github_actions/actions/de…
PabloAndresCQ Mar 27, 2024
25e591d
Bugfix/support create (#90)
PabloAndresCQ Mar 29, 2024
1ad0eb3
[bugfix] Default value of chi causes an error when state is copied (#93)
PabloAndresCQ Apr 3, 2024
aafd61d
Always canonicalise MPS before 2q gate (#82)
PabloAndresCQ Apr 3, 2024
0b71367
Changing the order of commands so that GPU device is assigned before …
PabloAndresCQ Apr 4, 2024
057adf1
Both MPS and TTN now apply SVD on a two-qubit gate tensor before cont…
PabloAndresCQ Apr 4, 2024
3c8a492
Updated version
PabloAndresCQ Apr 11, 2024
477efd8
Updated changelog
PabloAndresCQ Apr 11, 2024
e0e4b5b
[docs] API example for structured_state for upcoming release v0.6.0 (…
PabloAndresCQ Apr 11, 2024
a7281a6
update pytket version
cqc-melf Mar 19, 2024
535ca98
Update docs/changelog.rst
PabloAndresCQ Apr 12, 2024
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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
- package-ecosystem: pip
directory: "/"
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected].3
uses: actions/[email protected].5
52 changes: 52 additions & 0 deletions .github/workflows/check-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: check examples

on:
pull_request:
branches:
- develop
- main
schedule:
# 04:00 every Saturday morning
- cron: '0 4 * * 6'

jobs:

changes:
runs-on: ubuntu-22.04
outputs:
examples: ${{ steps.filter.outputs.examples }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.ref }}
filters: |
examples:
- 'examples/**'
- '.github/**'

check:
name: check examples
needs: changes
if: github.event_name == 'schedule' || needs.changes.outputs.examples == 'true'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: install python requirements for notebooks
run: |
python -m pip install --upgrade pip
python -m pip install .
cd examples
python -m pip install p2j
- name: test example notebooks
run: |
cd examples
./check-examples
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Update pip
run: pip install --upgrade pip
- name: Install black and pylint
run: pip install black~=22.3 pylint~=2.13,!=2.13.6
run: pip install black~=22.3 pylint~=3.0
- name: Check files are formatted with black
run: |
black --check .
- name: Run pylint
run: |
pylint --recursive=y */
pylint --recursive=y --ignore=ttn_tutorial.py,mps_tutorial.py */
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.5.4"
__extension_version__ = "0.6.0"
__extension_name__ = "pytket-cutensornet"
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ API documentation

.. toctree::
modules/fullTN.rst
modules/mps.rst
modules/structured_state.rst
13 changes: 13 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Changelog
~~~~~~~~~

0.6.0 (April 2024)
-------------------
PabloAndresCQ marked this conversation as resolved.
Show resolved Hide resolved

* **New feature**: Tree Tensor Network (TTN) simulator, supporting both fixed ``chi`` and ``truncation_fidelity``. Calculation of single amplitudes is supported by ``get_amplitude`` and inner products by ``vdot``. Measurement and postselection are not yet supported.
* **New API**: both ``MPS`` and ``TTN`` share a common interface: ``StructuredState``. Import paths have changed, multiple classes have been renamed: ``ConfigMPS`` is now ``Config``, ``ContractionAlg`` is now ``SimulationAlgorithm``. Documentation has been updated accordingly.

* Canonicalisation of MPS is now always applied before a two-qubit gate. We found that this tends to reduce runtime due to canonicalisation decreasing virtual bond dimension.
* Two-qubit gates are now decomposed (SVD) before applying them to remove null singular values (e.g. in ``XXPhase`` gates).
* Fixed a bug on copying an ``MPS`` if ``truncation_fidelity`` was set.
* Fixed a bug on ``CuTensorNetHandle`` that would prevent it from working when the device set was different from the default one (``dev=0``) and when using ``cuTensorNet>=2.3.0``.
* Fixed a bug on ``TensorNetwork`` due to unsupported ``Create`` operation.
* Updated pytket version requirement to 1.26.

0.5.4 (January 2024)
--------------------

Expand Down
63 changes: 0 additions & 63 deletions docs/modules/mps.rst

This file was deleted.

61 changes: 61 additions & 0 deletions docs/modules/structured_state.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Structured state evolution
==========================

.. automodule:: pytket.extensions.cutensornet.structured_state


Simulation
~~~~~~~~~~

.. autofunction:: pytket.extensions.cutensornet.structured_state.simulate

.. autoenum:: pytket.extensions.cutensornet.structured_state.SimulationAlgorithm()
:members:

.. autoclass:: pytket.extensions.cutensornet.structured_state.Config()

.. automethod:: __init__

.. autoclass:: pytket.extensions.cutensornet.structured_state.CuTensorNetHandle


Classes
~~~~~~~

.. autoclass:: pytket.extensions.cutensornet.structured_state.StructuredState()

.. automethod:: __init__
.. automethod:: is_valid
.. automethod:: apply_gate
.. automethod:: apply_scalar
.. automethod:: vdot
.. automethod:: sample
.. automethod:: measure
.. automethod:: postselect
.. automethod:: expectation_value
.. automethod:: get_fidelity
.. automethod:: get_statevector
.. automethod:: get_amplitude
.. automethod:: get_qubits
.. automethod:: get_byte_size
.. automethod:: get_device_id
.. automethod:: update_libhandle
.. automethod:: copy

.. autoclass:: pytket.extensions.cutensornet.structured_state.TTNxGate()

.. automethod:: __init__

.. autoclass:: pytket.extensions.cutensornet.structured_state.MPSxGate()

.. automethod:: __init__

.. autoclass:: pytket.extensions.cutensornet.structured_state.MPSxMPO()

.. automethod:: __init__


Miscellaneous
~~~~~~~~~~~~~

.. autofunction:: pytket.extensions.cutensornet.structured_state.prepare_circuit_mps
10 changes: 10 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contents

Available tutorials for users:
* `mps_tutorial.ipynb`: Use of MPS simulation and features.
* `ttn_tutorial.ipynb`: Use of TTN simulation and features.
* `mpi/`: Example on how to use MPS for embarrasingly parallel tasks with `mpi4py` see the `mpi` folder.

Developers:
* `check-examples`: The script to check that the Jupyter notebooks are generated correctly from the files in `python/`. To generate the `.ipynb` from these run the `p2j` command in this script.
* `python/`: The `.py` files that generate the `.ipynb` files. As a developer, you are expected to update these files instead of the `.ipynb` files. Remember to generate the latter using the `p2j` command before opening a pull request that changes these examples.
15 changes: 15 additions & 0 deletions examples/check-examples
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

for name in `cat ci-tested-notebooks.txt`
do
echo "Checking: ${name} ..."
# Check that notebook is generated from script:
p2j -o -t ${name}-gen.ipynb python/${name}.py
cmp ${name}.ipynb ${name}-gen.ipynb
rm ${name}-gen.ipynb
# TODO, add this when GPU is added to CI
# Run script:
# python python/${name}.py
done
2 changes: 2 additions & 0 deletions examples/ci-tested-notebooks.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mps_tutorial
ttn_tutorial
Binary file added examples/images/mps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions examples/mpi/mpi_overlap_bcast_mps.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@

from pytket.circuit import Circuit, fresh_symbol

from pytket.extensions.cutensornet.mps import (
from pytket.extensions.cutensornet.structured_state import (
simulate,
ConfigMPS,
ContractionAlg,
Config,
SimulationAlgorithm,
CuTensorNetHandle,
)

Expand Down Expand Up @@ -109,7 +109,7 @@
this_proc_mps = []
with CuTensorNetHandle(device_id) as libhandle: # Different handle for each process
for circ in this_proc_circs:
mps = simulate(libhandle, circ, ContractionAlg.MPSxGate, ConfigMPS())
mps = simulate(libhandle, circ, SimulationAlgorithm.MPSxGate, Config())
this_proc_mps.append(mps)

if rank == root:
Expand Down
Loading
Loading