Skip to content

Commit 1c572c3

Browse files
authored
Merge pull request #16 from CQCL/release/1.8.0
Release/1.8.0
2 parents 5534620 + ae43455 commit 1c572c3

13 files changed

+249
-35
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @cqc-melf

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"

.github/workflows/build_and_test.yml

+19-16
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
types:
1414
- created
1515
- edited
16+
schedule:
17+
# 04:00 every Tuesday morning
18+
- cron: '0 4 * * 2'
1619

1720
env:
1821
PYTKET_REMOTE_QISKIT_TOKEN: ${{ secrets.PYTKET_REMOTE_QISKIT_TOKEN }}
@@ -22,49 +25,49 @@ jobs:
2225
name: Qiskit - Build and test module
2326
strategy:
2427
matrix:
25-
os: ['ubuntu-20.04', 'macos-11', 'windows-2019']
28+
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
2629
runs-on: ${{ matrix.os }}
2730
steps:
2831
- uses: actions/checkout@v3
2932
with:
3033
fetch-depth: '0'
3134
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
3235
- name: Set up Python 3.8
33-
if: github.event_name == 'push'
34-
uses: actions/setup-python@v3
36+
if: github.event_name == 'push' || github.event_name == 'schedule'
37+
uses: actions/setup-python@v4
3538
with:
3639
python-version: '3.8'
3740
- name: Build and test (3.8)
38-
if: github.event_name == 'push'
41+
if: github.event_name == 'push' || github.event_name == 'schedule'
3942
shell: bash
4043
run: |
4144
./.github/workflows/build-test nomypy
4245
- name: Set up Python 3.9
43-
if: github.event_name == 'pull_request' || github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel')
44-
uses: actions/setup-python@v3
46+
if: github.event_name == 'pull_request' || github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel') || github.event_name == 'schedule'
47+
uses: actions/setup-python@v4
4548
with:
4649
python-version: '3.9'
4750
- name: Build and test including remote checks (3.9) mypy
48-
if: (matrix.os == 'macos-11') && ((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel'))
51+
if: (matrix.os == 'macos-12') && ((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel') || github.event_name == 'schedule' )
4952
shell: bash
5053
run: |
5154
./.github/workflows/build-test mypy
5255
env:
5356
PYTKET_RUN_REMOTE_TESTS: 1
5457
- name: Build and test including remote checks (3.9) nomypy
55-
if: (matrix.os != 'macos-11') && ((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel'))
58+
if: (matrix.os != 'macos-12') && ((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel') || github.event_name == 'schedule' )
5659
shell: bash
5760
run: |
5861
./.github/workflows/build-test nomypy
5962
env:
6063
PYTKET_RUN_REMOTE_TESTS: 1
6164
- name: Set up Python 3.10
62-
if: github.event_name == 'push' || github.event_name == 'pull_request'
63-
uses: actions/setup-python@v3
65+
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule'
66+
uses: actions/setup-python@v4
6467
with:
6568
python-version: '3.10'
6669
- name: Build and test (3.10)
67-
if: github.event_name == 'push' || github.event_name == 'pull_request'
70+
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule'
6871
shell: bash
6972
run: |
7073
./.github/workflows/build-test nomypy
@@ -74,11 +77,11 @@ jobs:
7477
name: artefacts
7578
path: wheelhouse/
7679
- name: Install docs dependencies
77-
if: (matrix.os == 'ubuntu-20.04') && (github.event_name == 'pull_request')
80+
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
7881
run: |
7982
pip install -r .github/workflows/docs/requirements.txt
8083
- name: Build docs
81-
if: (matrix.os == 'ubuntu-20.04') && (github.event_name == 'pull_request')
84+
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
8285
timeout-minutes: 20
8386
run: |
8487
./.github/workflows/docs/check-build-docs
@@ -88,7 +91,7 @@ jobs:
8891
name: Publish to pypi
8992
if: github.event_name == 'release'
9093
needs: qiskit-checks
91-
runs-on: ubuntu-20.04
94+
runs-on: ubuntu-22.04
9295
steps:
9396
- name: Download all wheels
9497
uses: actions/download-artifact@v3
@@ -109,13 +112,13 @@ jobs:
109112
name: Build and publish docs
110113
if: github.event_name == 'release'
111114
needs: publish_to_pypi
112-
runs-on: ubuntu-20.04
115+
runs-on: ubuntu-22.04
113116
steps:
114117
- uses: actions/checkout@v3
115118
with:
116119
fetch-depth: '0'
117120
- name: Set up Python 3.9
118-
uses: actions/setup-python@v3
121+
uses: actions/setup-python@v4
119122
with:
120123
python-version: '3.9'
121124
- name: Download all wheels

.github/workflows/docs.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ on:
55
branches:
66
- 'docs/**'
77
schedule:
8-
# 04:00 every weekday morning
9-
- cron: '0 4 * * 1-5'
8+
# 04:00 every Tuesday morning
9+
- cron: '0 4 * * 2'
1010

1111
jobs:
1212
docs:
1313
name: build docs
14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-22.04
1515
steps:
1616
- uses: actions/checkout@v3
1717
- name: Set up Python 3.9
18-
uses: actions/setup-python@v3
18+
uses: actions/setup-python@v4
1919
with:
2020
python-version: 3.9
2121
- name: Upgrade pip and install wheel

.github/workflows/issue.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
jira_task:
99
name: Create Jira issue
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111
steps:
1212
- name: Login
1313
uses: atlassian/gajira-login@v2.0.0
@@ -21,13 +21,13 @@ jobs:
2121
with:
2222
project: TKET
2323
issuetype: Bug
24-
summary: «${{ github.event.issue.title }}»
24+
summary: « [pytket-qiskit] ${{ github.event.issue.title }}»
2525
description: ${{ github.event.issue.html_url }}
2626
- name: Create Task
2727
uses: atlassian/gajira-create@v2.0.1
2828
if: "! contains(github.event.issue.labels.*.name, 'bug')"
2929
with:
3030
project: TKET
3131
issuetype: Task
32-
summary: «${{ github.event.issue.title }}»
32+
summary: « [pytket-qiskit] ${{ github.event.issue.title }}»
3333
description: ${{ github.event.issue.html_url }}

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ on:
99
jobs:
1010
lint:
1111

12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313

1414
steps:
1515
- uses: actions/checkout@v3
1616
- name: Set up Python 3.x
17-
uses: actions/setup-python@v3
17+
uses: actions/setup-python@v4
1818
with:
1919
python-version: '3.x'
2020
- name: Update pip

_metadata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__extension_version__ = "0.29.0"
1+
__extension_version__ = "0.30.0"
22
__extension_name__ = "pytket-qiskit"

docs/changelog.rst

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
~~~~~~~~~
33

4+
0.30.0 (November 2022)
5+
----------------------
6+
7+
* Update qiskit version to 0.39.
8+
* ``tk_to_qiskit`` now performs a rebase pass prior to conversion. Previously an error was returned if a ``Circuit`` contained gates such as ``OpType.ZZMax`` which have no exact replacement in qiskit. Now the unsupported gate will be implemented in terms of gates supported in qiskit rather than returning an error.
9+
* Updated pytket version requirement to 1.8.
10+
411
0.29.0 (October 2022)
512
---------------------
613

docs/intro.txt

+132-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,138 @@ representations.
2626
Windows. To install, run:
2727

2828
::
29-
30-
pip install pytket-qiskit
29+
30+
pip install pytket-qiskit
31+
32+
This will install `pytket` if it isn't already installed, and add new classes
33+
and methods into the `pytket.extensions` namespace.
34+
35+
Access and Credentials
36+
======================
37+
38+
Accessing devices and simulators through the pytket-qiskit extension requires an IBMQ account. An account can be set up here -> https://quantum-computing.ibm.com/login.
39+
40+
Once you have created an account you can obtain an API token which you can use to configure your credentials locally.
41+
42+
::
43+
44+
from pytket.extensions.qiskit import set_ibmq_config
45+
46+
set_ibmq_config(ibmq_api_token=ibm_token)
47+
48+
This will save your IBMQ credentials locally. After saving your credentials you can access pytket-qiskit backend repeatedly without having to re-initialise your credentials.
49+
50+
If you are a member of an IBM hub then you can add this information to ``set_ibmq_config`` as well.
51+
52+
::
53+
54+
from pytket.extensions.qiskit import set_ibmq_config
55+
56+
set_ibmq_config(ibmq_api_token=ibm_token, hub='your hub', group='your group', project='your project')
57+
58+
To see which devices you can access you can use the ``available_devices`` method on the ``IBMQBackend`` or ``IBMQEmulatorBackend``. Note that it is possible to pass ``hub``, ``group`` and ``project`` parameters to this method. This allows you to see which devices are accessible through your IBM hub.
59+
60+
::
61+
62+
from pytket.extensions.qiskit import IBMQBackend
63+
64+
backend = IBMQBackend # Initialise backend for an IBM device
65+
backend.available_devices(hub='your hub', group='your group', project='your project')
66+
67+
68+
Backends Available Through pytket-qiskit
69+
========================================
70+
71+
The ``pytket-qiskit`` extension has several types of available ``Backend``. These are the ``IBMQBackend``
72+
and several types of simulator.
73+
74+
.. list-table::
75+
:widths: 25 25
76+
:header-rows: 1
77+
78+
* - Backend
79+
- Type
80+
* - `IBMQBackend <https://cqcl.github.io/pytket-qiskit/api/api.html#pytket.extensions.qiskit.IBMQBackend>`_
81+
- Interface to an IBM quantum computer.
82+
* - `IBMQEmulatorBackend <https://cqcl.github.io/pytket-qiskit/api/api.html#pytket.extensions.qiskit.IBMQEmulatorBackend>`_
83+
- Emulator for a chosen ``IBMBackend`` (Device specific).
84+
* - `AerBackend <https://cqcl.github.io/pytket-qiskit/api/api.html#pytket.extensions.qiskit.AerBackend>`_
85+
- A noiseless, shots-based simulator for quantum circuits [1]
86+
* - `AerStateBackend <https://cqcl.github.io/pytket-qiskit/api/api.html#pytket.extensions.qiskit.AerStateBackend>`_
87+
- Statevector simulator.
88+
* - `AerUnitaryBackend <https://cqcl.github.io/pytket-qiskit/api/api.html#pytket.extensions.qiskit.AerUnitaryBackend>`_
89+
- Unitary simulator
90+
91+
* [1] ``AerBackend`` is noiseless by default and has no architecture. However it can accept a user defined ``NoiseModel`` and ``Architecture``.
92+
* In addition to the backends above the pytket-qiskit extension also has the ``TketBackend``. This allows a tket ``Backend``s and compilation passes to be used directly through qiskit. see the `Notebook example <https://github.com/CQCL/pytket/blob/main/examples/qiskit_integration.ipynb>`_ on qiskit integration.
93+
94+
Default Compilation
95+
===================
96+
97+
Every ``Backend`` in pytket has its own ``default_compilation_pass`` method. This method applies a sequence of optimisations to a circuit depending on the value of an ``optimisation_level`` parameter. This default compilation will ensure that the circuit meets all the constraints required to run on the Backend. The passes applied by different levels of optimisation are specified in the table below.
98+
99+
.. list-table:: **Default compilation pass for the IBMQBackend and IBMQEmulatorBackend**
100+
:widths: 25 25 25
101+
:header-rows: 1
102+
103+
* - optimisation_level = 0
104+
- optimisation_level = 1 [1]
105+
- optimisation_level = 2
106+
* - `DecomposeBoxes <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.DecomposeBoxes>`_
107+
- `DecomposeBoxes <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.DecomposeBoxes>`_
108+
- `DecomposeBoxes <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.DecomposeBoxes>`_
109+
* - self.rebase_pass [2]
110+
- `SynthesiseTket <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.SynthesiseTket>`_
111+
- `FullPeepholeOptimise <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.FullPeepholeOptimise>`_
112+
* - `CXMappingPass <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.CXMappingPass>`_ [3]
113+
- `CXMappingPass <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.CXMappingPass>`_ [3]
114+
- `CXMappingPass <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.CXMappingPass>`_ [3]
115+
* - `NaivePlacementPass <https://cqcl.github.io/tket/pytket/api/placement.html#pytket.passes.NaivePlacementPass>`_
116+
- `NaivePlacementPass <https://cqcl.github.io/tket/pytket/api/placement.html#pytket.passes.NaivePlacementPass>`_
117+
- `NaivePlacementPass <https://cqcl.github.io/tket/pytket/api/placement.html#pytket.passes.NaivePlacementPass>`_
118+
* - self.rebase_pass [2]
119+
- `SynthesiseTket <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.SynthesiseTket>`_
120+
- `KAKDecomposition(allow_swaps=False) <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.KAKDecomposition>`_
121+
* - `RemoveRedundancies <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.RemoveRedundancies>`_
122+
- `RemoveRedundancies <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.RemoveRedundancies>`_
123+
- `CliffordSimp(allow_swaps=False) <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.CliffordSimp>`_
124+
* -
125+
- self.rebase_pass [2]
126+
- `SynthesiseTket <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.SynthesiseTket>`_
127+
* -
128+
- `SimplifyInitial <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.SimplifyInitial>`_ [4]
129+
- self.rebase_pass [2]
130+
* -
131+
-
132+
- `RemoveRedundancies <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.RemoveRedundancies>`_
133+
* -
134+
-
135+
- `SimplifyInitial <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.SimplifyInitial>`_ [4]
136+
137+
* [1] If no value is specified then ``optimisation_level`` defaults to a value of 1.
138+
* [2] self.rebase_pass is a rebase to the gateset supported by the backend, For IBM quantum devices that is {X, SX, Rz, CX}.
139+
* [3] Here ``CXMappingPass`` maps program qubits to the architecture using a `NoiseAwarePlacement <https://cqcl.github.io/tket/pytket/api/placement.html#pytket.placement.NoiseAwarePlacement>`_
140+
* [4] ``SimplifyInitial`` has arguments ``allow_classical=False`` and ``create_all_qubits=True``.
141+
142+
143+
**Note:** The ``default_compilation_pass`` for ``AerBackend`` is the same as above except it doesn't use ``SimplifyInitial``.
144+
145+
146+
Backend Predicates
147+
==================
148+
149+
Circuits must satisfy certain conditions before they can be processed on a device or simulator. In pytket these conditions are called predicates.
150+
151+
All pytket-qiskit backends have the following two predicates.
152+
153+
* `GateSetPredicate <https://cqcl.github.io/tket/pytket/api/predicates.html#pytket.predicates.GateSetPredicate>`_ - The circuit must contain only operations supported by the ``Backend``. To view supported Ops run ``BACKENDNAME.backend_info.gate_set``.
154+
* `NoSymbolsPredicate <https://cqcl.github.io/tket/pytket/api/predicates.html#pytket.predicates.NoSymbolsPredicate>`_ - Parameterised gates must have numerical values when the circuit is executed.
155+
156+
The ``IBMQBackend`` and ``IBMQEmulatorBackend`` may also have the following predicates depending on the capabilities of the specified device.
157+
158+
* `NoClassicalControlPredicate <https://cqcl.github.io/tket/pytket/api/predicates.html#pytket.predicates.NoClassicalControlPredicate>`_
159+
* `NoMidMeasurePredicate <https://cqcl.github.io/tket/pytket/api/predicates.html#pytket.predicates.NoMidMeasurePredicatePredicate>`_
160+
* `NoFastFeedforwardPredicate <https://cqcl.github.io/tket/pytket/api/predicates.html#pytket.predicates.NoFastFeedforwardPredicate>`_
31161

32162
.. toctree::
33163
api.rst

pytket/extensions/qiskit/backends/ibm.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def _get_backend_info(cls, backend: "_QiskIBMQBackend") -> BackendInfo:
260260
k: v for k, v in characterisation.items() if k in characterisation_keys
261261
}
262262
supports_mid_measure = config.simulator or config.multi_meas_enabled
263-
supports_fast_feedforward = supports_mid_measure
263+
supports_fast_feedforward = False
264264
# simulator i.e. "ibmq_qasm_simulator" does not have `supported_instructions`
265265
# attribute
266266
gate_set = _tk_gate_set(backend)
@@ -322,6 +322,10 @@ def required_predicates(self) -> List[Predicate]:
322322
def default_compilation_pass(self, optimisation_level: int = 1) -> BasePass:
323323
assert optimisation_level in range(3)
324324
passlist = [DecomposeBoxes()]
325+
# If you make changes to the default_compilation_pass,
326+
# then please update this page accordingly
327+
# https://cqcl.github.io/pytket-qiskit/api/index.html#default-compilation
328+
# Edit this docs source file -> pytket-qiskit/docs/intro.txt
325329
if optimisation_level == 0:
326330
if self._standard_gateset:
327331
passlist.append(self.rebase_pass())

0 commit comments

Comments
 (0)