This repository was archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Migrate fake backends to provider #740
Closed
Closed
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
f46081a
Add tests executing a circuit on each fake backend (Qiskit/qiskit#4018)
mtreinish 9093fe4
Remove marshmallow from providers/ (Qiskit/qiskit#4016)
mtreinish 71db0a0
New fake backends: Cambridge, Paris, London, Valencia, Essex, Armonk …
ajavadia cc8d8a1
Add missing dict conversion in backconfiguration class (Qiskit/qiskit…
mtreinish 6555b46
Update configurations to perform serialization/deserialization scalin…
taalexander f3849a9
Remove coding: utf-8 per PEP 3120 (Qiskit/qiskit#4914)
levbishop bef1bce
Add a lazy loading wrapper class for __qiskit_version__ (Qiskit/qiski…
mtreinish d84a620
Update fake backend and fake provider to use versioned interface (Qis…
mtreinish 5cd5d4c
Switch to using black for code formatting (Qiskit/qiskit#6361)
mtreinish 08c9ea0
Deprecate legacy provider interface (Qiskit/qiskit#6337)
mtreinish aef12f6
Optimise `import qiskit` with lazy imports (Qiskit/qiskit#7525)
jakelishman e0bde61
Add fake backends for new IBM Quantum systems (Qiskit/qiskit#7392)
mtreinish bb299c6
Relocate mock backends from qiskit.test.mock to qiskit.mock (Qiskit/q…
iuliazidaru 88c32a2
Rename old FakeMumbaiV2 to avoid name conflict with new FakeMumbaiV2 …
HuangJunye dc286d2
Add BackendV2 mocked backend (Qiskit/qiskit#7643)
HuangJunye b5b5a78
Add BackendV2 mocked backend (Qiskit/qiskit#7643)
HuangJunye d1fe840
Remove legacy providers interface (Qiskit/qiskit#7886)
mtreinish ec63dc2
Remove legacy providers interface (Qiskit/qiskit#7886)
mtreinish defb04e
Fix `dt` units in test util function `convert_to_target` (Qiskit/qisk…
kevinhartman 6ce9e50
Add missing delay instruction to fake backends (Qiskit/qiskit#8003)
mtreinish 2e459c8
Fix fake backend v2 dtm unit (Qiskit/qiskit#8019)
HuangJunye 597922f
Move `qiskit.test.mock` to `qiskit.providers.fake_provider` and depre…
HuangJunye b1294e3
Move `qiskit.test.mock` to `qiskit.providers.fake_provider` and depre…
HuangJunye 6bdebc7
Add logic to return channels to FakeBackendV2 (Qiskit/qiskit#8444)
nkanazawa1989 7856fc1
adding FakePerth (Qiskit/qiskit#8344)
1ucian0 c0b3c33
Add FakeOslo backend to fake provider (Qiskit/qiskit#8358)
1ucian0 cd34093
Add FakeAuckland backend to fake provider (Qiskit/qiskit#8467)
1ucian0 ca5bb94
adding FakeGeneva (Qiskit/qiskit#8322)
1ucian0 1a54e67
Add BackendV2Converter class for treating BackendV1 as BackendV2 (Qis…
mtreinish e39265d
Remove pulse defaults for old fake 20q backends (Qiskit/qiskit#8665)
mtreinish a2465c8
Ensure target is generated during run() with FakeBackendV2 (Qiskit/qi…
mtreinish 4443700
Disable pylint's import-error (Qiskit/qiskit#8973)
jakelishman ee8b0ec
Stop using jupyter-sphinx extension in docs builds (Qiskit/qiskit#9346)
mtreinish 0e499b3
Fix typo in fake_provider.py (Qiskit/qiskit#9290)
eltociear e3d1a69
Add FakePrague Egret R1 to fake backends (Qiskit/qiskit#9369)
nonhermitian eeafb35
Lazy pulse qobj loading for large backend (Qiskit/qiskit#8885)
nkanazawa1989 b440d99
Add FakeSherbrooke backend (Qiskit/qiskit#9339)
mtreinish 78f5a2d
Add deprecation warning on use of qiskit.IBMQ (Qiskit/qiskit#8080)
mtreinish 5576f83
Fix typo in Target (Qiskit/qiskit#9473)
nkanazawa1989 c1c1a17
Remove deprecated arguments (Qiskit/qiskit#9542)
itoko c785fcb
Fix handling of simulator backends in BackendV2Converter (Qiskit/qisk…
mtreinish aaf8999
Add loop ops to Aer BackendV2 test (Qiskit/qiskit#9636)
jakelishman 2d690bd
Remove useless pylint suppressions (Qiskit/qiskit#9697)
levbishop d94d3d8
Add flag to filter faulty qubits and gates to BackendV2Converter (Qis…
mtreinish 864caa3
fixed issue 9453 by removing "_v2" from name in BackendV2 class (Qisk…
shivalee12 281a5e9
Add support to `switch` in `transpile` (Qiskit/qiskit#9928)
jakelishman 2572dac
Use backend_compat module's convert to target (Qiskit/qiskit#10016)
mtreinish 42d6600
Use backend_compat module's convert to target (Qiskit/qiskit#10016)
mtreinish 4a34de4
Fix qubit filtering in BackendV2Converter with add_delay (Qiskit/qisk…
mtreinish 4dd6d7b
Remove list argument broadcasting and simplify transpile() (Qiskit/qi…
mtreinish 2e16165
Add a new argument concurrent_measurements to target class (Qiskit/qi…
to24toro cffeaeb
Fix broken documentation references in `qiskit.providers` (Qiskit/qis…
jakelishman 67d89bd
Deprecate ``qiskit.extensions`` (Qiskit/qiskit#10725)
Cryoris e2bd0ee
Many mentions to QASM should be changed to OpenQASM 2 (Qiskit/qiskit#…
1ucian0 36086d6
Merge branch 'main' of ../qiskit-terra into migrate-fake-backends
ElePT 0af343f
Update fake backends
ElePT 851e653
Fix style
ElePT a828c4c
Fix mypy
ElePT 4421f7d
Integration test proposal
ElePT ae61eac
Fix lint
ElePT a9bc06e
Fix black
ElePT 1b9bbcb
Add different integration test
ElePT e882e83
Fix lint, mypy
ElePT d80b46c
Fix lint
ElePT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,253 @@ | ||
| # This code is part of Qiskit. | ||
| # | ||
| # (C) Copyright IBM 2022, 2023. | ||
| # | ||
| # This code is licensed under the Apache License, Version 2.0. You may | ||
| # obtain a copy of this license in the LICENSE.txt file in the root directory | ||
| # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
| # | ||
| # Any modifications or derivative works of this code must retain this | ||
| # copyright notice, and modified files need to carry a notice indicating | ||
| # that they have been altered from the originals. | ||
|
|
||
| """ | ||
| ====================================================== | ||
| Fake Provider (:mod:`qiskit_ibm_provider.fake_provider`) | ||
| ====================================================== | ||
|
|
||
| .. currentmodule:: qiskit_ibm_provider.fake_provider | ||
|
|
||
| Overview | ||
| ======== | ||
|
|
||
| The fake provider module contains fake providers and fake backends classes. The fake backends are | ||
| built to mimic the behaviors of IBM Quantum systems using system snapshots. The system snapshots | ||
| contain important information about the quantum system such as coupling map, basis gates, qubit | ||
| properties (T1, T2, error rate, etc.) which are useful for testing the transpiler and performing | ||
| noisy simulation of the system. | ||
|
|
||
| Example Usage | ||
| ============= | ||
|
|
||
| Here is an example of using a fake backend for transpilation and simulation. | ||
|
|
||
| .. plot:: | ||
| :include-source: | ||
|
|
||
| from qiskit import QuantumCircuit | ||
| from qiskit_ibm_provider.fake_provider import FakeManilaV2 | ||
| from qiskit import transpile | ||
| from qiskit.tools.visualization import plot_histogram | ||
|
|
||
|
|
||
| # Get a fake backend from the fake provider | ||
| backend = FakeManilaV2() | ||
|
|
||
| # Create a simple circuit | ||
| circuit = QuantumCircuit(3) | ||
| circuit.h(0) | ||
| circuit.cx(0,1) | ||
| circuit.cx(0,2) | ||
| circuit.measure_all() | ||
| circuit.draw('mpl') | ||
|
|
||
| # Transpile the ideal circuit to a circuit that can be directly executed by the backend | ||
| transpiled_circuit = transpile(circuit, backend) | ||
| transpiled_circuit.draw('mpl') | ||
|
|
||
| # Run the transpiled circuit using the simulated fake backend | ||
| job = backend.run(transpiled_circuit) | ||
| counts = job.result().get_counts() | ||
| plot_histogram(counts) | ||
|
|
||
| .. important:: | ||
|
|
||
| Please note that the simulation is done using a noise model generated from system snapshots | ||
| obtained in the past (sometimes a few years ago) and the results are not representative of the | ||
| latest behaviours of the real quantum system which the fake backend is mimicking. If you want to | ||
| run noisy simulations to compare with the real quantum system, you should use the ``qiskit_aer`` | ||
| library. After installation, you can follow the steps below to generate a simulator that | ||
| mimics a real quantum system with the latest calibration results. | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from qiskit_ibm_provider import IBMProvider | ||
| from qiskit.providers.aer import AerSimulator | ||
|
|
||
| # get a real backend from a real provider | ||
| provider = IBMProvider() | ||
| backend = provider.get_backend('ibmq_manila') | ||
|
|
||
| # generate a simulator that mimics the real quantum system with the latest calibration results | ||
| backend_sim = AerSimulator.from_backend(backend) | ||
|
|
||
|
|
||
| Fake Providers | ||
| ============== | ||
|
|
||
| Fake providers provide access to a list of fake backends. | ||
|
|
||
| .. autosummary:: | ||
| :toctree: ../stubs/ | ||
|
|
||
| FakeProviderForBackendV2 | ||
| FakeProvider | ||
|
|
||
| Fake Backends | ||
| ============= | ||
|
|
||
| Fake V2 Backends | ||
| ---------------- | ||
|
|
||
| Fake V2 backends are fake backends with IBM Quantum systems snapshots implemented with | ||
| :mod:`~qiskit.providers.backend.BackendV2` interface. They are all subclasses of | ||
| :class:`FakeBackendV2`. | ||
|
|
||
| .. autosummary:: | ||
| :toctree: ../stubs/ | ||
|
|
||
| FakeAlmadenV2 | ||
| FakeArmonkV2 | ||
| FakeAthensV2 | ||
| FakeAuckland | ||
| FakeBelemV2 | ||
| FakeBoeblingenV2 | ||
| FakeBogotaV2 | ||
| FakeBrooklynV2 | ||
| FakeBurlingtonV2 | ||
| FakeCairoV2 | ||
| FakeCambridgeV2 | ||
| FakeCasablancaV2 | ||
| FakeEssexV2 | ||
| FakeGeneva | ||
| FakeGuadalupeV2 | ||
| FakeHanoiV2 | ||
| FakeJakartaV2 | ||
| FakeJohannesburgV2 | ||
| FakeKolkataV2 | ||
| FakeLagosV2 | ||
| FakeLimaV2 | ||
| FakeLondonV2 | ||
| FakeManhattanV2 | ||
| FakeManilaV2 | ||
| FakeMelbourneV2 | ||
| FakeMontrealV2 | ||
| FakeMumbaiV2 | ||
| FakeNairobiV2 | ||
| FakeOslo | ||
| FakeOurenseV2 | ||
| FakeParisV2 | ||
| FakePerth | ||
| FakePrague | ||
| FakePoughkeepsieV2 | ||
| FakeQuitoV2 | ||
| FakeRochesterV2 | ||
| FakeRomeV2 | ||
| .. FakeRueschlikonV2 # no v2 version | ||
| FakeSantiagoV2 | ||
| FakeSherbrooke | ||
| FakeSingaporeV2 | ||
| FakeSydneyV2 | ||
| .. FakeTenerifeV2 # no v2 version | ||
| .. FakeTokyoV2 # no v2 version | ||
| FakeTorontoV2 | ||
| FakeValenciaV2 | ||
| FakeVigoV2 | ||
| FakeWashingtonV2 | ||
| FakeYorktownV2 | ||
|
|
||
| Fake V1 Backends | ||
| ---------------- | ||
|
|
||
| Fake V1 backends are fake backends with IBM Quantum systems snapshots implemented with | ||
| :mod:`~qiskit.providers.backend.BackendV1` interface. | ||
|
|
||
| .. autosummary:: | ||
| :toctree: ../stubs/ | ||
|
|
||
| FakeAlmaden | ||
| FakeArmonk | ||
| FakeAthens | ||
| FakeBelem | ||
| FakeBoeblingen | ||
| FakeBogota | ||
| FakeBrooklyn | ||
| FakeBurlington | ||
| FakeCairo | ||
| FakeCambridge | ||
| FakeCasablanca | ||
| FakeEssex | ||
| FakeGuadalupe | ||
| FakeHanoi | ||
| FakeJakarta | ||
| FakeJohannesburg | ||
| FakeKolkata | ||
| FakeLagos | ||
| FakeLima | ||
| FakeLondon | ||
| FakeManhattan | ||
| FakeManila | ||
| FakeMelbourne | ||
| FakeMontreal | ||
| FakeMumbai | ||
| FakeNairobi | ||
| FakeOurense | ||
| FakeParis | ||
| FakePoughkeepsie | ||
| FakeQuito | ||
| FakeRochester | ||
| FakeRome | ||
| FakeRueschlikon | ||
| FakeSantiago | ||
| FakeSingapore | ||
| FakeSydney | ||
| FakeTenerife | ||
| FakeTokyo | ||
| FakeToronto | ||
| FakeValencia | ||
| FakeVigo | ||
| FakeWashington | ||
| FakeYorktown | ||
|
|
||
| Special Fake Backends | ||
| ===================== | ||
|
|
||
| Special fake backends are fake backends that were created for special testing purposes. | ||
|
|
||
| .. autosummary:: | ||
| :toctree: ../stubs/ | ||
|
|
||
| FakeQasmSimulator | ||
|
|
||
| Fake Backend Base Classes | ||
| ========================= | ||
|
|
||
| The fake backends based on IBM hardware are based on a set of base classes: | ||
|
|
||
| .. currentmodule:: qiskit_ibm_provider.fake_provider.fake_backend | ||
| .. autoclass:: qiskit_ibm_provider.fake_provider.fake_backend.FakeBackendV2 | ||
|
|
||
| .. currentmodule:: qiskit_ibm_provider.fake_provider | ||
| .. autoclass:: FakeBackend | ||
| .. autoclass:: FakeQasmBackend | ||
| .. autoclass:: FakePulseBackend | ||
| """ | ||
|
|
||
| # Fake job and qobj classes | ||
| from .fake_job import FakeJob | ||
| from .fake_qobj import FakeQobj | ||
|
|
||
| # Base classes for fake backends | ||
| from . import fake_backend | ||
| from .fake_backend import FakeBackend | ||
| from .fake_qasm_backend import FakeQasmBackend | ||
| from .fake_pulse_backend import FakePulseBackend | ||
|
|
||
| # Fake providers | ||
| from .fake_provider import FakeProviderFactory, FakeProviderForBackendV2, FakeProvider | ||
|
|
||
| # Standard fake backends with IBM Quantum systems snapshots | ||
| from .backends import * | ||
|
|
||
| # Special fake backends for special testing purposes | ||
| from .fake_qasm_simulator import FakeQasmSimulator | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| # This code is part of Qiskit. | ||
| # | ||
| # (C) Copyright IBM 2019, 2023. | ||
| # | ||
| # This code is licensed under the Apache License, Version 2.0. You may | ||
| # obtain a copy of this license in the LICENSE.txt file in the root directory | ||
| # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
| # | ||
| # Any modifications or derivative works of this code must retain this | ||
| # copyright notice, and modified files need to carry a notice indicating | ||
| # that they have been altered from the originals. | ||
|
|
||
|
|
||
| """ | ||
| Mocked versions of real quantum backends. | ||
| """ | ||
|
|
||
| # BackendV2 Backends | ||
| from .almaden import FakeAlmadenV2 | ||
| from .armonk import FakeArmonkV2 | ||
| from .athens import FakeAthensV2 | ||
| from .auckland import FakeAuckland | ||
| from .belem import FakeBelemV2 | ||
| from .boeblingen import FakeBoeblingenV2 | ||
| from .bogota import FakeBogotaV2 | ||
| from .brooklyn import FakeBrooklynV2 | ||
| from .burlington import FakeBurlingtonV2 | ||
| from .cairo import FakeCairoV2 | ||
| from .cambridge import FakeCambridgeV2 | ||
| from .casablanca import FakeCasablancaV2 | ||
| from .essex import FakeEssexV2 | ||
| from .geneva import FakeGeneva | ||
| from .guadalupe import FakeGuadalupeV2 | ||
| from .hanoi import FakeHanoiV2 | ||
| from .jakarta import FakeJakartaV2 | ||
| from .johannesburg import FakeJohannesburgV2 | ||
| from .kolkata import FakeKolkataV2 | ||
| from .lagos import FakeLagosV2 | ||
| from .lima import FakeLimaV2 | ||
| from .london import FakeLondonV2 | ||
| from .manhattan import FakeManhattanV2 | ||
| from .manila import FakeManilaV2 | ||
| from .melbourne import FakeMelbourneV2 | ||
| from .montreal import FakeMontrealV2 | ||
| from .mumbai import FakeMumbaiV2 | ||
| from .nairobi import FakeNairobiV2 | ||
| from .oslo import FakeOslo | ||
| from .ourense import FakeOurenseV2 | ||
| from .paris import FakeParisV2 | ||
| from .perth import FakePerth | ||
| from .prague import FakePrague | ||
| from .poughkeepsie import FakePoughkeepsieV2 | ||
| from .quito import FakeQuitoV2 | ||
| from .rochester import FakeRochesterV2 | ||
| from .rome import FakeRomeV2 | ||
| from .santiago import FakeSantiagoV2 | ||
| from .sherbrooke import FakeSherbrooke | ||
| from .singapore import FakeSingaporeV2 | ||
| from .sydney import FakeSydneyV2 | ||
| from .toronto import FakeTorontoV2 | ||
| from .valencia import FakeValenciaV2 | ||
| from .vigo import FakeVigoV2 | ||
| from .washington import FakeWashingtonV2 | ||
| from .yorktown import FakeYorktownV2 | ||
|
|
||
| # BackendV1 Backends | ||
| from .almaden import FakeAlmaden | ||
| from .armonk import FakeArmonk | ||
| from .athens import FakeAthens | ||
| from .belem import FakeBelem | ||
| from .boeblingen import FakeBoeblingen | ||
| from .bogota import FakeBogota | ||
| from .brooklyn import FakeBrooklyn | ||
| from .burlington import FakeBurlington | ||
| from .cairo import FakeCairo | ||
| from .cambridge import FakeCambridge | ||
| from .cambridge import FakeCambridgeAlternativeBasis | ||
| from .casablanca import FakeCasablanca | ||
| from .essex import FakeEssex | ||
| from .guadalupe import FakeGuadalupe | ||
| from .hanoi import FakeHanoi | ||
| from .jakarta import FakeJakarta | ||
| from .johannesburg import FakeJohannesburg | ||
| from .kolkata import FakeKolkata | ||
| from .lagos import FakeLagos | ||
| from .lima import FakeLima | ||
| from .london import FakeLondon | ||
| from .manhattan import FakeManhattan | ||
| from .manila import FakeManila | ||
| from .melbourne import FakeMelbourne | ||
| from .montreal import FakeMontreal | ||
| from .mumbai import FakeMumbai | ||
| from .nairobi import FakeNairobi | ||
| from .ourense import FakeOurense | ||
| from .paris import FakeParis | ||
| from .poughkeepsie import FakePoughkeepsie | ||
| from .quito import FakeQuito | ||
| from .rochester import FakeRochester | ||
| from .rome import FakeRome | ||
| from .rueschlikon import FakeRueschlikon | ||
| from .santiago import FakeSantiago | ||
| from .singapore import FakeSingapore | ||
| from .sydney import FakeSydney | ||
| from .tenerife import FakeTenerife | ||
| from .tokyo import FakeTokyo | ||
| from .toronto import FakeToronto | ||
| from .valencia import FakeValencia | ||
| from .vigo import FakeVigo | ||
| from .washington import FakeWashington | ||
| from .yorktown import FakeYorktown |
16 changes: 16 additions & 0 deletions
16
qiskit_ibm_provider/fake_provider/backends/almaden/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # This code is part of Qiskit. | ||
| # | ||
| # (C) Copyright IBM 2019, 2023. | ||
| # | ||
| # This code is licensed under the Apache License, Version 2.0. You may | ||
| # obtain a copy of this license in the LICENSE.txt file in the root directory | ||
| # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
| # | ||
| # Any modifications or derivative works of this code must retain this | ||
| # copyright notice, and modified files need to carry a notice indicating | ||
| # that they have been altered from the originals. | ||
|
|
||
| """Mock almaden backend""" | ||
|
|
||
| from .fake_almaden import FakeAlmadenV2 | ||
| from .fake_almaden import FakeAlmaden |
1 change: 1 addition & 0 deletions
1
qiskit_ibm_provider/fake_provider/backends/almaden/conf_almaden.json
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.