Skip to content

Commit

Permalink
Remove pulse module files, pulse visualization and final cleanup (#13872
Browse files Browse the repository at this point in the history
)

* Handle ScheduleBlock and pulse gates loading

* Add documentation and remove redundant code

* Limit QPY version when generating circuits for compatibility test

Fix some doc issues

* Remove FakeBackend, FakeQasmBackend, FakePulseBackend, subclasses, any tests that checked V1 functionality, mitigators (independent removal). Update rest of unit tests to use GenericBackendV2

* Remove FakeBackend references from docs (these classes will be removed in 2.0 so no alternative is provided)

* Generate visuals for test (DUMMY COMMIT)

* Another attempt after fixing lint

* Desperate measures until better measures are found

* Handle QPY compatibility testing. Misc other fixes

* Update qiskit/qpy/binary_io/circuits.py

Co-authored-by: Raynel Sanchez <87539502+raynelfss@users.noreply.github.com>

* Remove pulse from GenericBackendV2

This commit removes pulse-related functionality from GenericBackendV2, as
part of Pulse removal in Qiskit 2.0. This includes the ability to initialize
the backend with custom calibrations and query it for channel information.
Also, various clean ups where made to accommodate for the updated API of
GenericBackendV2.

* First pass

* Avoid generating pulse circuits in load_qpy & version >= 2.0

* Remove more stuff

* Add renos

* Fix scheduling tests

* Add reno and some misc fixes

* Remove BackendV1, converters, models, qobj and update tests.

* Fix lint

* Add recent changes from remove-pulse-qpy branch

* Remove pulse module files, visualization & testing

* Add reno

* Raise QpyError when loading ScheduleBlock payloads

* Clean up TODOs

* Remove NormalizeRXAngle and rzx_templates

And misc minor fixes

* Unify transpiler renos w.r.t pulse removal

* Update reno and minor cosmetic changes

* Delete a test file that unintentionally got in

* Update releasenotes/notes/remove-pulse-eb43f66499092489.yaml

---------

Co-authored-by: Elena Peña Tapia <epenatap@gmail.com>
Co-authored-by: Raynel Sanchez <87539502+raynelfss@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
  • Loading branch information
4 people authored Mar 6, 2025
1 parent 1b43c89 commit fdd5e96
Show file tree
Hide file tree
Showing 102 changed files with 69 additions and 25,990 deletions.
2 changes: 0 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

# Qiskit folders (also their corresponding tests)
providers/ @Qiskit/terra-core @jyu00
pulse/ @Qiskit/terra-core @eggerdj @wshanks @nkanazawa1989
scheduler/ @Qiskit/terra-core @eggerdj @wshanks @nkanazawa1989
visualization/ @Qiskit/terra-core @nonhermitian
primitives/ @Qiskit/terra-core @Qiskit/qiskit-primitives
# Override the release notes directories to have _no_ code owners, so any review
Expand Down
1 change: 1 addition & 0 deletions crates/accelerate/src/basis/basis_translator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ fn extract_basis_target(
/// This needs to use a Python instance of `QuantumCircuit` due to it needing
/// to access `has_calibration_for()` which is unavailable through rust. However,
/// this API will be removed with the deprecation of `Pulse`.
/// TODO: pulse is removed, we can use op.blocks
fn extract_basis_target_circ(
circuit: &Bound<PyAny>,
source_basis: &mut IndexSet<GateIdentifier, ahash::RandomState>,
Expand Down
7 changes: 0 additions & 7 deletions docs/apidoc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ Serialization:
qasm3
qpy

Pulse-level programming:

.. toctree::
:maxdepth: 1

pulse

Other:

.. toctree::
Expand Down
6 changes: 0 additions & 6 deletions docs/apidoc/pulse.rst

This file was deleted.

10 changes: 0 additions & 10 deletions qiskit/compiler/transpiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from qiskit.circuit.quantumcircuit import QuantumCircuit
from qiskit.dagcircuit import DAGCircuit
from qiskit.providers.backend import Backend
from qiskit.pulse import Schedule
from qiskit.transpiler import Layout, CouplingMap, PropertySet
from qiskit.transpiler.basepasses import BasePass
from qiskit.transpiler.exceptions import TranspilerError, CircuitTooWideForTarget
Expand Down Expand Up @@ -302,16 +301,7 @@ def callback_func(**kwargs):
if not circuits:
return []

# transpiling schedules is not supported yet.
start_time = time()
if all(isinstance(c, Schedule) for c in circuits):
warnings.warn("Transpiling schedules is not supported yet.", UserWarning)
end_time = time()
_log_transpile_time(start_time, end_time)
if arg_circuits_list:
return circuits
else:
return circuits[0]

if optimization_level is None:
# Take optimization level from the configuration or 1 as default.
Expand Down
3 changes: 1 addition & 2 deletions qiskit/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@
a backend and its operation for the :mod:`~qiskit.transpiler` so that circuits
can be compiled to something that is optimized and can execute on the
backend. It also provides the :meth:`~qiskit.providers.BackendV2.run` method which can
run the :class:`~qiskit.circuit.QuantumCircuit` objects and/or
:class:`~qiskit.pulse.Schedule` objects. This enables users and other Qiskit
run the :class:`~qiskit.circuit.QuantumCircuit` objects. This enables users and other Qiskit
APIs to get results from
executing circuits on devices in a standard
fashion regardless of how the backend is implemented. At a high level the basic
Expand Down
93 changes: 4 additions & 89 deletions qiskit/providers/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
from abc import ABC
from abc import abstractmethod
import datetime
from typing import List, Union, Iterable, Tuple
from typing import List, Union, Tuple

from qiskit.circuit.gate import Instruction
from qiskit.utils.deprecate_pulse import deprecate_pulse_dependency


class Backend:
Expand Down Expand Up @@ -202,7 +201,7 @@ def instruction_durations(self):
@property
@abstractmethod
def max_circuits(self):
"""The maximum number of circuits (or Pulse schedules) that can be
"""The maximum number of circuits that can be
run in a single job.
If there is no limit this will return None
Expand Down Expand Up @@ -267,18 +266,6 @@ def meas_map(self) -> List[List[int]]:
"""
raise NotImplementedError

@property
@deprecate_pulse_dependency(is_property=True)
def instruction_schedule_map(self):
"""Return the :class:`~qiskit.pulse.InstructionScheduleMap` for the
instructions defined in this backend's target."""
return self._instruction_schedule_map

@property
def _instruction_schedule_map(self):
"""An alternative private path to be used internally to avoid pulse deprecation warnings."""
return self.target._get_instruction_schedule_map()

def qubit_properties(
self, qubit: Union[int, List[int]]
) -> Union[QubitProperties, List[QubitProperties]]:
Expand Down Expand Up @@ -313,77 +300,6 @@ def qubit_properties(
return self.target.qubit_properties[qubit]
return [self.target.qubit_properties[q] for q in qubit]

@deprecate_pulse_dependency
def drive_channel(self, qubit: int):
"""Return the drive channel for the given qubit.
This is required to be implemented if the backend supports Pulse
scheduling.
Returns:
DriveChannel: The Qubit drive channel
Raises:
NotImplementedError: if the backend doesn't support querying the
measurement mapping
"""
raise NotImplementedError

@deprecate_pulse_dependency
def measure_channel(self, qubit: int):
"""Return the measure stimulus channel for the given qubit.
This is required to be implemented if the backend supports Pulse
scheduling.
Returns:
MeasureChannel: The Qubit measurement stimulus line
Raises:
NotImplementedError: if the backend doesn't support querying the
measurement mapping
"""
raise NotImplementedError

@deprecate_pulse_dependency
def acquire_channel(self, qubit: int):
"""Return the acquisition channel for the given qubit.
This is required to be implemented if the backend supports Pulse
scheduling.
Returns:
AcquireChannel: The Qubit measurement acquisition line.
Raises:
NotImplementedError: if the backend doesn't support querying the
measurement mapping
"""
raise NotImplementedError

@deprecate_pulse_dependency
def control_channel(self, qubits: Iterable[int]):
"""Return the secondary drive channel for the given qubit
This is typically utilized for controlling multiqubit interactions.
This channel is derived from other channels.
This is required to be implemented if the backend supports Pulse
scheduling.
Args:
qubits: Tuple or list of qubits of the form
``(control_qubit, target_qubit)``.
Returns:
List[ControlChannel]: The multi qubit control line.
Raises:
NotImplementedError: if the backend doesn't support querying the
measurement mapping
"""
raise NotImplementedError

def set_options(self, **fields):
"""Set the options fields for the backend
Expand Down Expand Up @@ -433,9 +349,8 @@ def run(self, run_input, **options):
class can handle either situation.
Args:
run_input (QuantumCircuit or Schedule or ScheduleBlock or list): An
individual or a list of :class:`.QuantumCircuit`,
:class:`~qiskit.pulse.ScheduleBlock`, or :class:`~qiskit.pulse.Schedule` objects to
run_input (QuantumCircuit or list): An
individual or a list of :class:`.QuantumCircuit` objects to
run on the backend.
options: Any kwarg options to pass to the backend for running the
config. If a key is also present in the options
Expand Down
8 changes: 3 additions & 5 deletions qiskit/providers/fake_provider/generic_backend_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,13 @@ def run(self, run_input, **options):
"""Run on the backend using a simulator.
This method runs circuit jobs (an individual or a list of :class:`~.QuantumCircuit`
) and pulse jobs (an individual or a list of :class:`~.Schedule` or
:class:`~.ScheduleBlock`) using :class:`~.BasicSimulator` or Aer simulator and returns a
) using :class:`~.BasicSimulator` or Aer simulator and returns a
:class:`~qiskit.providers.Job` object.
If qiskit-aer is installed, jobs will be run using the ``AerSimulator`` with
noise model of the backend. Otherwise, jobs will be run using the
``BasicSimulator`` simulator without noise.
Noisy simulations of pulse jobs are not yet supported in :class:`~.GenericBackendV2`.
Args:
run_input (QuantumCircuit or list): An
individual or a list of :class:`~qiskit.circuit.QuantumCircuit`
Expand All @@ -332,7 +329,8 @@ def run(self, run_input, **options):
Job: The job object for the run
Raises:
QiskitError: If a pulse job is supplied and qiskit_aer is not installed.
QiskitError: If input is not :class:`~qiskit.circuit.QuantumCircuit` or a list of
:class:`~qiskit.circuit.QuantumCircuit` objects.
"""
circuits = run_input
if not isinstance(circuits, QuantumCircuit) and (
Expand Down
158 changes: 0 additions & 158 deletions qiskit/pulse/__init__.py

This file was deleted.

Loading

0 comments on commit fdd5e96

Please sign in to comment.