Fake Provider
qiskit.providers.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.
from qiskit import QuantumCircuit
from qiskit.providers.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)
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, please follow steps below to generate a simulator mimics a real quantum system with the latest calibration results.
from qiskit.providers.ibmq import IBMQ
from qiskit.providers.aer import AerSimulator
# get a real backend from a real provider
provider = IBMQ.load_account()
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.
FakeProviderForBackendV2 () | Fake provider containing fake V2 backends. |
FakeProvider () | Fake provider containing fake V1 backends. |
Fake Backends
Fake V2 Backends
Fake V2 backends are fake backends with IBM Quantum systems snapshots implemented with BackendV2
interface. They are all subclasses of FakeBackendV2
.
FakeAlmadenV2 () | A fake Almaden V2 backend. |
FakeArmonkV2 () | A fake 1 qubit backend. |
FakeAthensV2 () | A fake 5 qubit backend. |
FakeAuckland () | A fake 27 qubit backend. |
FakeBelemV2 () | A fake 5 qubit backend. |
FakeBoeblingenV2 () | A fake Boeblingen V2 backend. |
FakeBogotaV2 () | A fake 5 qubit backend. |
FakeBrooklynV2 () | A fake Brooklyn V2 backend. |
FakeBurlingtonV2 () | A fake 5 qubit backend. |
FakeCairoV2 () | A fake 27 qubit backend. |
FakeCambridgeV2 () | A fake Cambridge backend. |
FakeCasablancaV2 () | A fake 7 qubit backend. |
FakeEssexV2 () | A fake 5 qubit backend. |
FakeGeneva () | A fake 27 qubit backend. |
FakeGuadalupeV2 () | A fake 16 qubit backend. |
FakeHanoiV2 () | A fake 27 qubit backend. |
FakeJakartaV2 () | A fake 7 qubit V2 backend. |
FakeJohannesburgV2 () | A fake Johannesburg V2 backend. |
FakeKolkataV2 () | A fake 27 qubit backend. |
FakeLagosV2 () | A fake 7 qubit backend. |
FakeLimaV2 () | A fake 5 qubit backend. |
FakeLondonV2 () | A fake 5 qubit backend. |
FakeManhattanV2 () | A fake Manhattan backend. |
FakeManilaV2 () | A fake 5 qubit backend. |
FakeMelbourneV2 () | A fake 14 qubit backend. |
FakeMontrealV2 () | A fake 27 qubit backend. |
FakeMumbaiV2 () | A fake 27 qubit backend. |
FakeNairobiV2 () | A fake 7 qubit backend. |
FakeOslo () | A fake 7 qubit backend. |
FakeOurenseV2 () | A fake 5 qubit backend. |
FakeParisV2 () | A fake Paris backend. |
FakePerth () | A fake 7 qubit backend. |
FakePrague () | A fake 33 qubit backend. |
FakePoughkeepsieV2 () | A fake Poughkeepsie backend. |
FakeQuitoV2 () | A fake 5 qubit backend. |
FakeRochesterV2 () | A fake Rochester backend. |
FakeRomeV2 () | A fake 5 qubit backend. |
FakeSantiagoV2 () | A fake Santiago backend. |
FakeSherbrooke () | A fake 127 qubit backend. |
FakeSingaporeV2 () | A fake Singapore backend. |
FakeSydneyV2 () | A fake 27 qubit backend. |
FakeTorontoV2 () | A fake 27 qubit backend. |
FakeValenciaV2 () | A fake 5 qubit backend. |
FakeVigoV2 () | A fake 5 qubit backend. |
FakeWashingtonV2 () | A fake 127 qubit backend. |
FakeYorktownV2 () | A fake 5 qubit backend. |
Fake V1 Backends
Fake V1 backends are fake backends with IBM Quantum systems snapshots implemented with BackendV1
interface.
FakeAlmaden () | A fake Almaden backend. |
FakeArmonk () | A fake 1 qubit backend. |
FakeAthens () | A fake 5 qubit backend. |
FakeBelem () | A fake 5 qubit backend. |
FakeBoeblingen () | A fake Boeblingen backend. |
FakeBogota () | A fake 5 qubit backend. |
FakeBrooklyn () | A fake Brooklyn backend. |
FakeBurlington () | A fake 5 qubit backend. |
FakeCairo () | A fake 27 qubit backend. |
FakeCambridge () | A fake Cambridge backend. |
FakeCasablanca () | A fake 7 qubit backend. |
FakeEssex () | A fake 5 qubit backend. |
FakeGuadalupe () | A fake 16 qubit backend. |
FakeHanoi () | A fake 27 qubit backend. |
FakeJakarta () | A fake 7 qubit backend. |
FakeJohannesburg () | A fake Johannesburg backend. |
FakeKolkata () | A fake 27 qubit backend. |
FakeLagos () | A fake 7 qubit backend. |
FakeLima () | A fake 5 qubit backend. |
FakeLondon () | A fake 5 qubit backend. |
FakeManhattan () | A fake Manhattan backend. |
FakeManila () | A fake 5 qubit backend. |
FakeMelbourne () | A fake 14 qubit backend. |
FakeMontreal () | A fake 27 qubit backend. |
FakeMumbai () | A fake 27 qubit backend. |
FakeNairobi () | A fake 7 qubit backend. |
FakeOurense () | A fake 5 qubit backend. |
FakeParis () | A fake Paris backend. |
FakePoughkeepsie () | A fake Poughkeepsie backend. |
FakeQuito () | A fake 5 qubit backend. |
FakeRochester () | A fake Rochester backend. |
FakeRome () | A fake 5 qubit backend. |
FakeRueschlikon () | A fake 16 qubit backend. |
FakeSantiago () | A fake Santiago backend. |
FakeSingapore () | A fake Singapore backend. |
FakeSydney () | A fake 27 qubit backend. |
FakeTenerife () | A fake 5 qubit backend. |
FakeTokyo () | A fake 20 qubit backend. |
FakeToronto () | A fake 27 qubit backend. |
FakeValencia () | A fake 5 qubit backend. |
FakeVigo () | A fake 5 qubit backend. |
FakeWashington () | A fake 127 qubit backend. |
FakeYorktown () | A fake 5 qubit backend. |
Special Fake Backends
Special fake backends are fake backends that were created for special testing purposes.
FakeQasmSimulator () | A fake simulator backend. |
FakeOpenPulse2Q () | A fake 2 qubit backend for pulse test. |
FakeOpenPulse3Q () | Trivial extension of the FakeOpenPulse2Q. |
Fake1Q () | A fake 1Q backend. |
FakeBackendV2 () | A mock backend that doesn't implement run() to test compatibility with Terra internals. |
FakeBackend5QV2 ([bidirectional]) | A mock backend that doesn't implement run() to test compatibility with Terra internals. |
FakeMumbaiFractionalCX () | A fake mumbai backend. |
ConfigurableFakeBackend (name, n_qubits[, ...]) | Configurable backend. |
Fake Backend Base Classes
The fake backends based on IBM hardware are based on a set of base classes:
FakeBackendV2
class qiskit.providers.fake_provider.fake_backend.FakeBackendV2
A fake backend class for testing and noisy simulation using real backend snapshots.
The class inherits BackendV2
class. This version differs from earlier FakeBackend
(V1) class in a few aspects. Firstly, configuration attribute no longer exsists. Instead, attributes exposing equivalent required immutable properties of the backend device are added. For example fake_backend.configuration().n_qubits
is accessible from fake_backend.num_qubits
now. Secondly, this version removes extra abstractions FakeQasmBackend
and FakePulseBackend
that were present in V1.
FakeBackendV2 initializer.
FakeBackend
class qiskit.providers.fake_provider.FakeBackend(configuration, time_alive=10)
This is a dummy backend just for testing purposes.
FakeBackend initializer.
Parameters
- configuration (BackendConfiguration) – backend configuration
- time_alive (int) – time to wait before returning result
FakeQasmBackend
class qiskit.providers.fake_provider.FakeQasmBackend
A fake OpenQASM backend.
FakeBackend initializer.
Parameters
- configuration (BackendConfiguration) – backend configuration
- time_alive (int) – time to wait before returning result
FakePulseBackend
class qiskit.providers.fake_provider.FakePulseBackend
A fake pulse backend.
FakeBackend initializer.
Parameters
- configuration (BackendConfiguration) – backend configuration
- time_alive (int) – time to wait before returning result