Skip to content

Commit

Permalink
Remove provider-specific fake backends,FakeProvider class and relat…
Browse files Browse the repository at this point in the history
…ed tools in 1.0 (#11376)

* Remove provider-specific fake backends, fake provider and related tools

* Add release note

* Remove sneaky fake generic

* Fix lint

* Fix typo, manifest and attempt to fix visual tests

* Fix seed in visual tests, change imports

* Remove deleted files and remove FakeBackend mentions from examples in API docs

* I'm sorry I'm at the point where I confuse 1s and 5s.

* Fix skip message when aer isn't installed

* Skip fake backend test with aer on windows

* Revert windows skip and limit v2 backend size

The underlying cause of the windows failures were actually much larger
performance issues in aer's `NoiseModel.from_backend()` constructor
method when run with a BackendV2 instance. This is causing the
`NoiseModel` construction for `GenericBackendV2` to take a great deal of
time and use up all the memory we have available in the windows VMs in
CI. To avoid this issue in the short term until a fix can be added to
aer this commit just limits the size of the backend v2 examples we run
to prevent resources problems in CI.

* Avoid all to all connectivity in fake backend tests

The aer noise model construction was an artifact of using all to all
connectivity in the test. Using a more sparse connectivity alleviates
the performance issues. This commit switches to use a ring graph and
restores the larger qubit count backends.

---------

Co-authored-by: Matthew Treinish <[email protected]>
  • Loading branch information
ElePT and mtreinish authored Feb 2, 2024
1 parent 225106d commit 84f0d9b
Show file tree
Hide file tree
Showing 269 changed files with 267 additions and 4,404 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include requirements.txt
recursive-include qiskit/qasm/libs *.inc
include qiskit/VERSION.txt
include qiskit/visualization/circuit/styles/*.json
recursive-include qiskit/providers/fake_provider/backends *.json
recursive-include qiskit/providers/fake_provider/backends_v1 *.json

# Include the tests files.
Expand Down
191 changes: 20 additions & 171 deletions qiskit/providers/fake_provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,23 @@
Overview
========
The fake provider module contains fake providers, fake backends and other simulated backend
implementations. 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.
The fake provider module in Qiskit contains fake (simulated) backend classes
useful for testing the transpiler and other backend-facing functionality.
Example Usage
=============
Here is an example of using a fake backend for transpilation and simulation.
Here is an example of using a simulated backend for transpilation and running.
.. plot::
:include-source:
from qiskit import QuantumCircuit
from qiskit.providers.fake_provider import FakeManilaV2
from qiskit import transpile
from qiskit import QuantumCircuit, transpile
from qiskit.providers.fake_provider import GenericBackendV2
from qiskit.visualization import plot_histogram
# Get a fake backend from the fake provider
backend = FakeManilaV2()
# Generate a 5-qubit simulated backend
backend = GenericBackendV2(num_qubits=5)
# Create a simple circuit
circuit = QuantumCircuit(3)
Expand All @@ -56,201 +50,56 @@
transpiled_circuit = transpile(circuit, backend)
transpiled_circuit.draw('mpl')
# Run the transpiled circuit using the simulated fake backend
# Run the transpiled circuit using the simulated 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 will need to create a noise
model from the current properties of the backend manually.
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.
V2 Simulated Backends
=====================
.. 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
=====================
GenericBackendV2
Special fake backends are fake backends that were created for special testing purposes.
V1 Fake Backends (Legacy interface)
===================================
.. autosummary::
:toctree: ../stubs/
FakeQasmSimulator
FakeOpenPulse2Q
FakeOpenPulse3Q
Fake1Q
FakeBackendV2
FakeBackend5QV2
FakeMumbaiFractionalCX
GenericBackendV2
Fake5QV1
Fake20QV1
Fake7QPulseV1
Fake27QPulseV1
Fake127QPulseV1
Fake Backend Base Classes
=========================
The fake backends based on IBM hardware are based on a set of base classes:
.. currentmodule:: qiskit.providers.fake_provider.fake_backend
.. autoclass:: qiskit.providers.fake_provider.fake_backend.FakeBackendV2
The V1 fake backends are based on a set of base classes:
.. currentmodule:: qiskit.providers.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
from .fake_openpulse_2q import FakeOpenPulse2Q
from .fake_openpulse_3q import FakeOpenPulse3Q
from .fake_1q import Fake1Q
from .fake_backend_v2 import FakeBackendV2, FakeBackend5QV2
from .fake_mumbai_v2 import FakeMumbaiFractionalCX

# Generic fake backends
from .backends_v1 import *
from .backends_v1 import Fake5QV1, Fake20QV1, Fake7QPulseV1, Fake27QPulseV1, Fake127QPulseV1
from .generic_backend_v2 import GenericBackendV2
110 changes: 0 additions & 110 deletions qiskit/providers/fake_provider/backends/__init__.py

This file was deleted.

16 changes: 0 additions & 16 deletions qiskit/providers/fake_provider/backends/almaden/__init__.py

This file was deleted.

This file was deleted.

Loading

0 comments on commit 84f0d9b

Please sign in to comment.