Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions qiskit/compiler/assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,15 @@ def _parse_circuit_args(
parameter_binds = parameter_binds or []
# create run configuration and populate
run_config_dict = dict(parameter_binds=parameter_binds, **run_config)
if backend:
run_config_dict["parametric_pulses"] = getattr(
backend.configuration(), "parametric_pulses", []
)
if parametric_pulses:
if parametric_pulses is None:
if backend:
run_config_dict["parametric_pulses"] = getattr(
backend.configuration(), "parametric_pulses", []
)
else:
run_config_dict["parametric_pulses"] = []
else:
run_config_dict["parametric_pulses"] = parametric_pulses

if meas_level:
run_config_dict["meas_level"] = meas_level
# only enable `meas_return` if `meas_level` isn't classified
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit.providers.fake_provider import fake_qasm_backend, fake_backend


class FakeAlmadenV2(fake_backend.FakeBackendV2):
Expand All @@ -35,11 +35,10 @@ class FakeAlmadenV2(fake_backend.FakeBackendV2):
dirname = os.path.dirname(__file__)
conf_filename = "conf_almaden.json"
props_filename = "props_almaden.json"
defs_filename = "defs_almaden.json"
backend_name = "fake_almaden_v2"


class FakeAlmaden(fake_pulse_backend.FakePulseBackend):
class FakeAlmaden(fake_qasm_backend.FakeQasmBackend):
"""A fake Almaden backend.

.. code-block:: text
Expand All @@ -56,5 +55,4 @@ class FakeAlmaden(fake_pulse_backend.FakePulseBackend):
dirname = os.path.dirname(__file__)
conf_filename = "conf_almaden.json"
props_filename = "props_almaden.json"
defs_filename = "defs_almaden.json"
backend_name = "fake_almaden"

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit.providers.fake_provider import fake_qasm_backend, fake_backend


class FakeJohannesburgV2(fake_backend.FakeBackendV2):
Expand All @@ -35,11 +35,10 @@ class FakeJohannesburgV2(fake_backend.FakeBackendV2):
dirname = os.path.dirname(__file__)
conf_filename = "conf_johannesburg.json"
props_filename = "props_johannesburg.json"
defs_filename = "defs_johannesburg.json"
backend_name = "fake_johannesburg_v2"


class FakeJohannesburg(fake_pulse_backend.FakePulseBackend):
class FakeJohannesburg(fake_qasm_backend.FakeQasmBackend):
"""A fake Johannesburg backend.

.. code-block:: text
Expand All @@ -56,5 +55,4 @@ class FakeJohannesburg(fake_pulse_backend.FakePulseBackend):
dirname = os.path.dirname(__file__)
conf_filename = "conf_johannesburg.json"
props_filename = "props_johannesburg.json"
defs_filename = "defs_johannesburg.json"
backend_name = "fake_johannesburg"

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import os
from qiskit.providers.fake_provider import fake_pulse_backend, fake_backend
from qiskit.providers.fake_provider import fake_qasm_backend, fake_backend


class FakeSingaporeV2(fake_backend.FakeBackendV2):
Expand All @@ -35,11 +35,10 @@ class FakeSingaporeV2(fake_backend.FakeBackendV2):
dirname = os.path.dirname(__file__)
conf_filename = "conf_singapore.json"
props_filename = "props_singapore.json"
defs_filename = "defs_singapore.json"
backend_name = "fake_singapore_v2"


class FakeSingapore(fake_pulse_backend.FakePulseBackend):
class FakeSingapore(fake_qasm_backend.FakeQasmBackend):
"""A fake Singapore backend.

.. code-block:: text
Expand All @@ -56,5 +55,4 @@ class FakeSingapore(fake_pulse_backend.FakePulseBackend):
dirname = os.path.dirname(__file__)
conf_filename = "conf_singapore.json"
props_filename = "props_singapore.json"
defs_filename = "defs_singapore.json"
backend_name = "fake_singapore"
26 changes: 13 additions & 13 deletions qiskit/visualization/pulse_v2/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,50 +312,50 @@ def draw(

from qiskit import QuantumCircuit, transpile, schedule
from qiskit.visualization.pulse_v2 import draw
from qiskit.providers.fake_provider import FakeAlmaden
from qiskit.providers.fake_provider import FakeBoeblingen

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
qc = transpile(qc, FakeAlmaden(), layout_method='trivial')
sched = schedule(qc, FakeAlmaden())
qc = transpile(qc, FakeBoeblingen(), layout_method='trivial')
sched = schedule(qc, FakeBoeblingen())

draw(sched, backend=FakeAlmaden())
draw(sched, backend=FakeBoeblingen())

Drawing with the stylesheet suited for publication.

.. jupyter-execute::

from qiskit import QuantumCircuit, transpile, schedule
from qiskit.visualization.pulse_v2 import draw, IQXSimple
from qiskit.providers.fake_provider import FakeAlmaden
from qiskit.providers.fake_provider import FakeBoeblingen

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
qc = transpile(qc, FakeAlmaden(), layout_method='trivial')
sched = schedule(qc, FakeAlmaden())
qc = transpile(qc, FakeBoeblingen(), layout_method='trivial')
sched = schedule(qc, FakeBoeblingen())

draw(sched, style=IQXSimple(), backend=FakeAlmaden())
draw(sched, style=IQXSimple(), backend=FakeBoeblingen())

Drawing with the stylesheet suited for program debugging.

.. jupyter-execute::

from qiskit import QuantumCircuit, transpile, schedule
from qiskit.visualization.pulse_v2 import draw, IQXDebugging
from qiskit.providers.fake_provider import FakeAlmaden
from qiskit.providers.fake_provider import FakeBoeblingen

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
qc = transpile(qc, FakeAlmaden(), layout_method='trivial')
sched = schedule(qc, FakeAlmaden())
qc = transpile(qc, FakeBoeblingen(), layout_method='trivial')
sched = schedule(qc, FakeBoeblingen())

draw(sched, style=IQXDebugging(), backend=FakeAlmaden())
draw(sched, style=IQXDebugging(), backend=FakeBoeblingen())

You can partially customize a preset stylesheet when initializing it.

Expand All @@ -368,7 +368,7 @@ def draw(
}
style = IQXStandard(**my_style)
# draw
draw(sched, style=style, backend=FakeAlmaden())
draw(sched, style=style, backend=FakeBoeblingen())

In the same way as above, you can create custom generator or layout functions
and update the existing stylesheet with custom functions.
Expand Down
12 changes: 6 additions & 6 deletions qiskit/visualization/timeline/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,13 @@ def draw(

from qiskit import QuantumCircuit, transpile, schedule
from qiskit.visualization.timeline import draw
from qiskit.providers.fake_provider import FakeAlmaden
from qiskit.providers.fake_provider import FakeBoeblingen

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0,1)

qc = transpile(qc, FakeAlmaden(), scheduling_method='alap', layout_method='trivial')
qc = transpile(qc, FakeBoeblingen(), scheduling_method='alap', layout_method='trivial')
draw(qc)

Drawing with the simple stylesheet.
Expand All @@ -306,13 +306,13 @@ def draw(

from qiskit import QuantumCircuit, transpile, schedule
from qiskit.visualization.timeline import draw, IQXSimple
from qiskit.providers.fake_provider import FakeAlmaden
from qiskit.providers.fake_provider import FakeBoeblingen

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0,1)

qc = transpile(qc, FakeAlmaden(), scheduling_method='alap', layout_method='trivial')
qc = transpile(qc, FakeBoeblingen(), scheduling_method='alap', layout_method='trivial')
draw(qc, style=IQXSimple())

Drawing with the stylesheet suited for program debugging.
Expand All @@ -321,13 +321,13 @@ def draw(

from qiskit import QuantumCircuit, transpile, schedule
from qiskit.visualization.timeline import draw, IQXDebugging
from qiskit.providers.fake_provider import FakeAlmaden
from qiskit.providers.fake_provider import FakeBoeblingen

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0,1)

qc = transpile(qc, FakeAlmaden(), scheduling_method='alap', layout_method='trivial')
qc = transpile(qc, FakeBoeblingen(), scheduling_method='alap', layout_method='trivial')
draw(qc, style=IQXDebugging())

You can partially customize a preset stylesheet when call it::
Expand Down
21 changes: 21 additions & 0 deletions releasenotes/notes/remove-pulse-defs-old-20q-4ed46085b4a15678.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
upgrade:
- |
The fake backend objects :class:`~.FakeJohannesburg`,
:class:`~.FakeJohannesburgV2`, :class:`~.FakeAlmaden`,
:class:`~.FakeAlmadenV2`, :class:`~.FakeSingapore`, and
:class:`~.FakeSingaporeV2` no longer contain the pulse defaults payloads.
This means for the :class:`~.BackendV1` based classes the
:meth:`.BackendV1.defaults` method and pulse simulation via
:meth:`.BackendV1.run` is no longer available. For :class:`~.BackendV2`
based classes the :attr:`~InstructionProperties.calibration` property for
instructions in the :class:`~.Target` is no longer populated. This
change was done because these systems had exceedingly large pulse defaults
payloads (in total ~50MB) due to using sampled waveforms instead of
parameteric pulse definitions. These three payload files took > 50% of the
disk space required to install qiskit-terra. When weighed against the
potential value of being able to compile with pulse awareness or pulse
simulate these retired devices the file size is not worth the cost. If
you require to leverage these properties you can leverage an older version
of Qiskit and leverage :mod:`~qiskit.qpy` to transfer circuits from
older versions of qiskit into the current release.
13 changes: 8 additions & 5 deletions test/python/compiler/test_assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
FakeOpenPulse2Q,
FakeOpenPulse3Q,
FakeYorktown,
FakeAlmaden,
FakeHanoi,
)


Expand Down Expand Up @@ -1194,7 +1194,8 @@ def test_pulse_name_conflicts(self):

def test_pulse_name_conflicts_in_other_schedule(self):
"""Test two pulses with the same name in different schedule can be resolved."""
backend = FakeAlmaden()
backend = FakeHanoi()
defaults = backend.defaults()

schedules = []
ch_d0 = pulse.DriveChannel(0)
Expand All @@ -1204,7 +1205,9 @@ def test_pulse_name_conflicts_in_other_schedule(self):
sched += measure(qubits=[0], backend=backend) << 100
schedules.append(sched)

qobj = assemble(schedules, backend)
qobj = assemble(
schedules, qubit_lo_freq=defaults.qubit_freq_est, meas_lo_freq=defaults.meas_freq_est
)

# two user pulses and one measurement pulse should be contained
self.assertEqual(len(qobj.config.pulse_library), 3)
Expand Down Expand Up @@ -1330,7 +1333,7 @@ def test_assemble_parametric_unsupported(self):

def test_assemble_parametric_pulse_kwarg_with_backend_setting(self):
"""Test that parametric pulses respect the kwarg over backend"""
backend = FakeAlmaden()
backend = FakeHanoi()

qc = QuantumCircuit(1, 1)
qc.x(0)
Expand All @@ -1345,7 +1348,7 @@ def test_assemble_parametric_pulse_kwarg_with_backend_setting(self):

def test_assemble_parametric_pulse_kwarg_empty_list_with_backend_setting(self):
"""Test that parametric pulses respect the kwarg as empty list over backend"""
backend = FakeAlmaden()
backend = FakeHanoi()

qc = QuantumCircuit(1, 1)
qc.x(0)
Expand Down
27 changes: 16 additions & 11 deletions test/python/compiler/test_transpiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
from qiskit.circuit.library import CXGate, U3Gate, U2Gate, U1Gate, RXGate, RYGate, RZGate, UGate
from qiskit.circuit.measure import Measure
from qiskit.test import QiskitTestCase
from qiskit.providers.fake_provider import FakeMelbourne, FakeRueschlikon, FakeAlmaden, FakeMumbaiV2
from qiskit.providers.fake_provider import (
FakeMelbourne,
FakeRueschlikon,
FakeBoeblingen,
FakeMumbaiV2,
)
from qiskit.transpiler import Layout, CouplingMap
from qiskit.transpiler import PassManager
from qiskit.transpiler.target import Target
Expand Down Expand Up @@ -1047,7 +1052,7 @@ def test_transpiled_custom_gates_calibration(self):
circ.add_calibration(custom_180, [0], q0_x180)
circ.add_calibration(custom_90, [1], q1_y90)

backend = FakeAlmaden()
backend = FakeBoeblingen()
transpiled_circuit = transpile(
circ,
backend=backend,
Expand All @@ -1068,7 +1073,7 @@ def test_transpiled_basis_gates_calibrations(self):
# Add calibration
circ.add_calibration("h", [0], q0_x180)

backend = FakeAlmaden()
backend = FakeBoeblingen()
transpiled_circuit = transpile(
circ,
backend=backend,
Expand All @@ -1088,7 +1093,7 @@ def test_transpile_calibrated_custom_gate_on_diff_qubit(self):
# Add calibration
circ.add_calibration(custom_180, [1], q0_x180)

backend = FakeAlmaden()
backend = FakeBoeblingen()
with self.assertRaises(QiskitError):
transpile(circ, backend=backend, layout_method="trivial")

Expand All @@ -1105,7 +1110,7 @@ def test_transpile_calibrated_nonbasis_gate_on_diff_qubit(self):
# Add calibration
circ.add_calibration("h", [1], q0_x180)

backend = FakeAlmaden()
backend = FakeBoeblingen()
transpiled_circuit = transpile(
circ,
backend=backend,
Expand All @@ -1129,7 +1134,7 @@ def test_transpile_subset_of_calibrated_gates(self):
circ.add_calibration(x_180, [0], q0_x180)
circ.add_calibration("h", [1], q0_x180) # 'h' is calibrated on qubit 1

transpiled_circ = transpile(circ, FakeAlmaden(), layout_method="trivial")
transpiled_circ = transpile(circ, FakeBoeblingen(), layout_method="trivial")
self.assertEqual(set(transpiled_circ.count_ops().keys()), {"u2", "mycustom", "h"})

def test_parameterized_calibrations_transpile(self):
Expand All @@ -1146,10 +1151,10 @@ def q0_rxt(tau):

circ.add_calibration("rxt", [0], q0_rxt(tau), [2 * 3.14 * tau])

transpiled_circ = transpile(circ, FakeAlmaden(), layout_method="trivial")
transpiled_circ = transpile(circ, FakeBoeblingen(), layout_method="trivial")
self.assertEqual(set(transpiled_circ.count_ops().keys()), {"rxt"})
circ = circ.assign_parameters({tau: 1})
transpiled_circ = transpile(circ, FakeAlmaden(), layout_method="trivial")
transpiled_circ = transpile(circ, FakeBoeblingen(), layout_method="trivial")
self.assertEqual(set(transpiled_circ.count_ops().keys()), {"rxt"})

def test_inst_durations_from_calibrations(self):
Expand All @@ -1176,7 +1181,7 @@ def test_multiqubit_gates_calibrations(self, opt_level):
custom_gate = Gate("my_custom_gate", 5, [])
circ.append(custom_gate, [0, 1, 2, 3, 4])
circ.measure_all()
backend = FakeAlmaden()
backend = FakeBoeblingen()
with pulse.build(backend, name="custom") as my_schedule:
pulse.play(
pulse.library.Gaussian(duration=128, amp=0.1, sigma=16), pulse.drive_channel(0)
Expand Down Expand Up @@ -1331,9 +1336,9 @@ def test_transpile_optional_registers(self, optimization_level):

qc.measure(qubits, clbits)

out = transpile(qc, FakeAlmaden(), optimization_level=optimization_level)
out = transpile(qc, FakeBoeblingen(), optimization_level=optimization_level)

self.assertEqual(len(out.qubits), FakeAlmaden().configuration().num_qubits)
self.assertEqual(len(out.qubits), FakeBoeblingen().configuration().num_qubits)
self.assertEqual(out.clbits, clbits)

@data(0, 1, 2, 3)
Expand Down
Loading