Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule with backend v2 #10564

Closed
wants to merge 75 commits into from

Conversation

to24toro
Copy link
Contributor

@to24toro to24toro commented Aug 4, 2023

Summary

Closed #10285 and reopened at this PR.
This PR fixes the bug of scheduling with backendV2.
We aim to replace ScheduleConfig with Target when backendV1 will be deprecated in the future.

Details and comments

When making a schedule, Target and ScheduleConfig are prepared by dispatching the type of backend. Now I consider ScheduleConfig class will be deprecated at the same time the backendV1 is dropped.
When deprecating ScheduleConfig, Target will become required and ScheduleConfig will be dropped.

Added the new test for schedule with backendV2 in test/python/pulse/test_builder_v2.py.

API change

  • Added target to schedule in schedule.py.
  • Added target to sequence in sequence.py.
  • Added target to lower_gates in qiskit/scheduler/lowering.py.
  • Added target to las_soon_as_possible in qiskit/scheduler/methods/basic.py.
  • Added target to as_late_as_possible in qiskit/scheduler/methods/basic.py.
  • Added target to schedule_circuit in qiskit/scheduler/schedule_circuit.py.

@@ -31,5 +30,5 @@ def __init__(self, inst_map: InstructionScheduleMap, meas_map: List[List[int]],
dt: Sample duration.
"""
self.inst_map = inst_map
self.meas_map = format_meas_map(meas_map)
self.meas_map = meas_map
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed format_meas_map .
When I make target class like this

Target(meas_map=schedule_config.meas_map)

the type of meas_map is restricted to list (#10258 (comment)).

Comment on lines 41 to 62
def convert_to_target(func):
"""
A wrapper function that prepares target instead of scheduleConfig
when the ScheduleConfing is specified.

If the ScheduleConfig is deprecated, this fucntion will be removed.
"""

@deprecate_arg(
"schedule_config",
deprecation_description="Using target instead of schedule_config.",
since="0.25.0",
pending=True,
predicate=lambda schedule_config: schedule_config is not None,
)
def _wrapped(circuit: QuantumCircuit, schedule_config: ScheduleConfig, target: Target):
if schedule_config is not None:
target = Target(schedule_config.meas_map)
target.update_from_instruction_schedule_map(schedule_config.inst_map)
return func(circuit, target=target)

return _wrapped
Copy link
Contributor Author

@to24toro to24toro Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a wrapper function for ScheduleConfig deprecation.(ref: #10285 (comment))

@to24toro to24toro marked this pull request as ready for review August 4, 2023 04:33
@to24toro to24toro requested review from eggerdj, wshanks, a team and jyu00 as code owners August 4, 2023 04:33
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core
  • @nkanazawa1989

@sungwooahn
Copy link

Hi @to24toro, I'm also studying in area that needs schedule function and reached to this end of your work. You seem to have changed a lot in qiskit/pulse.
I tried the last branch of yours(feature/schedule_with_backendV2) and still came up with some issues of NoneType in meas_map.

I assume that I connected wrongly with my current qiskit well. It would be great if you leave the comment of whether current branch is working well or not. Also, if you are okay, I'd like to hear and participate in your progress. Thanks for the work.

@to24toro
Copy link
Contributor Author

@sungwooahn
Thank you for your contribution. Could you please share your code with gist or anything else? I would like to check it.

@to24toro to24toro force-pushed the feature/schedule_with_backendV2 branch from 715e090 to c63073f Compare August 17, 2023 02:04
@to24toro to24toro force-pushed the feature/schedule_with_backendV2 branch from c63073f to 609e238 Compare August 17, 2023 02:19
@to24toro to24toro force-pushed the feature/schedule_with_backendV2 branch from 7c276e4 to 983d3e4 Compare October 7, 2023 04:17
@to24toro
Copy link
Contributor Author

#10988 solve the bug of scheduling with backendV2.
This PR includes an additional improvement but it is the minor change for the edge case of U gates.
So I close it once.

@to24toro to24toro closed this Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: pulse Related to the Pulse module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants