Skip to content

Commit 739f782

Browse files
saich08Takishima
andauthored
Azure Quantum backend (#439)
* Add Azure Quantum backend template files * Add implementation of Azure Quantum * Add support for Honeywell and improve exception handling * Fixes and reformatting * Fixes and Improvements * Fixes and Improvements * Fixes and Improvements * Fixes and Improvements * Fix QASM transulation * Fixes and Improvements * Documentation related changes * Fix typos * Add docstrings to util methods * Fix typos * Add Unittests * Add Unittests * Add Unittests & rename honeywell to quantinuum * Fixes for QSAM convector * Add Unittests * Add Unittests * Add Unittests * Add Unittests * Fix Quantinuum Backend for Azure Quantum * Add Unittests * Add Unittests * Add Unittests * Add Unittests * Fix Vdag gate for IonQ backend * Minor updates * Update Docs * Add Azure Quantum example * Update README.rst * Update Docs * Update Docs * Update Unittests * Azure Quantum: CI Fixes (#4) * Azure Quantum: CI Fixes * Fix optional dependency problem * Update pre-commit reformatting * Fix pylint issues * Fix pylint issues * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Resolve comments (#5) * Resolve comments * Remove rearrange_result method from _utils.py * Update with pytest.approx for assert floating numbers * Pytest skipif testcases for Azure Quantum (#6) * Pytest skipif testcases for Azure Quantum * Fix projectq.backends._azure._exceptions import * Add common utils module (#7) * Create common utils module * Optimize _rearrange_result method * Make sure pip, setuptools and wheel packages are up to date on CI * Fix formatting issues from latest changes in develop branch * Improve coveralls (#8) * Improve coveralls * Improve coveralls * Rename util.py to utils.py * Minor fixes * Update testcases * Update testcases * Improve coveralls (#9) * Improve coveralls * Improve coveralls * Precommit reformatting * Improve coveralls (#10) * Improve coveralls * Precommit formatting * Fix CI failures * Avoid a few more #pragma: no cover * Fix flake8 warning * Remove one more # pragma: no cover * Reformat file Co-authored-by: Nguyen Damien <ngn.damien@gmail.com>
1 parent 7444213 commit 739f782

20 files changed

+3148
-31
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ jobs:
5454
- name: Generate requirement file (Unix)
5555
if: runner.os != 'Windows'
5656
run: |
57-
python setup.py gen_reqfile --include-extras=test,braket,revkit
57+
python setup.py gen_reqfile --include-extras=test,azure-quantum,braket,revkit
5858
5959
- name: Generate requirement file (Windows)
6060
if: runner.os == 'Windows'
6161
run: |
62-
python setup.py gen_reqfile --include-extras=test,braket
62+
python setup.py gen_reqfile --include-extras=test,azure-quantum,braket
6363
6464
- name: Prepare env
6565
run: |
@@ -74,11 +74,11 @@ jobs:
7474

7575
- name: Build and install package (Unix)
7676
if: runner.os != 'Windows'
77-
run: python -m pip install -ve .[braket,revkit,test]
77+
run: python -m pip install -ve .[azure-quantum,braket,revkit,test]
7878

7979
- name: Build and install package (Windows)
8080
if: runner.os == 'Windows'
81-
run: python -m pip install -ve .[braket,test]
81+
run: python -m pip install -ve .[azure-quantum,braket,test]
8282

8383
- name: Pytest
8484
run: |
@@ -143,16 +143,16 @@ jobs:
143143
144144
- name: Prepare Python env
145145
run: |
146-
python3 setup.py gen_reqfile --include-extras=test,braket
147146
python3 -m pip install -U pip setuptools wheel
147+
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
148148
cat requirements.txt
149149
python3 -m pip install -r requirements.txt --prefer-binary
150150
151151
- name: Upgrade pybind11 and flaky
152152
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary
153153

154154
- name: Build and install package
155-
run: python3 -m pip install -ve .[braket,test]
155+
run: python3 -m pip install -ve .[azure-quantum,braket,test]
156156

157157
- name: Pytest
158158
run: |
@@ -190,16 +190,16 @@ jobs:
190190
191191
- name: Prepare Python env
192192
run: |
193-
python3 setup.py gen_reqfile --include-extras=test,braket
194193
python3 -m pip install -U pip setuptools wheel
194+
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
195195
cat requirements.txt
196196
python3 -m pip install -r requirements.txt --prefer-binary
197197
198198
- name: Upgrade pybind11 and flaky
199199
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary
200200

201201
- name: Build and install package
202-
run: python3 -m pip install -ve .[braket,test]
202+
run: python3 -m pip install -ve .[azure-quantum,braket,test]
203203

204204
- name: Pytest
205205
run: |
@@ -274,13 +274,13 @@ jobs:
274274

275275
- name: Install dependencies
276276
run: |
277-
python3 setup.py gen_reqfile --include-extras=test,braket
278277
python3 -m pip install -U pip setuptools wheel
278+
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
279279
cat requirements.txt
280280
python3 -m pip install -r requirements.txt --prefer-binary
281281
282282
- name: Build and install package
283-
run: python3 -m pip install -ve .[braket,test]
283+
run: python3 -m pip install -ve .[azure-quantum,braket,test]
284284

285285
- name: Pytest
286286
run: |

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ install:
6060
- env
6161
- python3 -m pip install -U pip setuptools wheel
6262
- python3 -m pip install -U pybind11 dormouse revkit flaky pytest-cov coveralls boto3
63+
- python3 -m pip install -U azure-quantum
6364
- python3 -m pip install -r requirements.txt
6465
- python3 -m pip install -ve .
6566

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- New backend for the Azure Quantum platform
13+
1014
### Changed
1115

1216
- Support for Python 3.6 and earlier is now deprecated

README.rst

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ targeting various types of hardware, a high-performance quantum computer
2727
simulator with emulation capabilities, and various compiler plug-ins.
2828
This allows users to
2929

30-
- run quantum programs on the IBM Quantum Experience chip, AQT devices, AWS Braket, or IonQ service provided devices
30+
- run quantum programs on the IBM Quantum Experience chip, AQT devices, AWS Braket, Azure Quantum, or IonQ service provided devices
3131
- simulate quantum programs on classical computers
3232
- emulate quantum programs at a higher level of abstraction (e.g.,
3333
mimicking the action of large oracles instead of compiling them to
@@ -186,6 +186,35 @@ IonQ from IonQ and the state vector simulator SV1:
186186
python3 -m pip install -ve .[braket]
187187
188188
189+
**Running a quantum program on a Azure Quantum provided device**
190+
191+
To run a program on devices provided by the `Azure Quantum <https://azure.microsoft.com/en-us/services/quantum/>`_.
192+
193+
Use `AzureQuantumBackend` to run ProjectQ circuits on hardware devices and simulator devices from providers `IonQ` and `Quantinuum`.
194+
195+
.. code-block:: python
196+
197+
from projectq.backends import AzureQuantumBackend
198+
199+
azure_quantum_backend = AzureQuantumBackend(
200+
use_hardware=False, target_name='ionq.simulator', resource_id='<resource-id>', location='<location>', verbose=True
201+
)
202+
203+
.. note::
204+
205+
In order to use the AzureQuantumBackend, you need to install ProjectQ with the 'azure-quantum' extra requirement:
206+
207+
.. code-block:: bash
208+
209+
python3 -m pip install projectq[azure-quantum]
210+
211+
or
212+
213+
.. code-block:: bash
214+
215+
cd /path/to/projectq/source/code
216+
python3 -m pip install -ve .[azure-quantum]
217+
189218
**Running a quantum program on IonQ devices**
190219

191220
To run a program on the IonQ trapped ion hardware, use the `IonQBackend` and its corresponding setup.

docs/tutorials.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ AWS Braket Backend requires the use of the official AWS SDK for Python, Boto3. T
5454
5555
python -m pip install --user projectq[braket]
5656
57+
**Install Azure Quantum Backend requirement**
58+
59+
Azure Quantum Backend requires the use of the official `Azure Quantum SDK <https://github.com/microsoft/qdk-python>`_ for Python. This is an extra requirement only needed if you plan to use the Azure Quantum Backend. To install ProjectQ inluding this requirement you can include it in the installation instruction as
60+
61+
.. code-block:: bash
62+
63+
python -m pip install --user projectq[azure-quantum]
64+
5765
5866
Detailed instructions and OS-specific hints
5967
-------------------------------------------

0 commit comments

Comments
 (0)