-
Notifications
You must be signed in to change notification settings - Fork 127
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
Add scheduling to ParallelExperiment #1100
base: main
Are you sure you want to change the base?
Add scheduling to ParallelExperiment #1100
Conversation
Adds handling for asap and alap scheduling to ParallelExperiment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do careful review shortly.
# Max duration for all components that will be combined into a single circuit | ||
max_durations = {} | ||
duration_unit = None | ||
scheduling_method = getattr(self.transpile_options, "scheduling_method", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be transpile option? I think we should keep current behavior of delegating this scheduling to sub experiments, and turn this into experiment option of parallel experiment. We should give it another name because the logic you implemented is too much simplified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set it as a transpile option it will also be set as transpile option for component experiments. In the case where its individual set for component experiments, but not the main parallel one, they could be different values (eg some asap some alap) so there is no way to know how to align the parallel blocks unless there is a method in the main experiment (or you check they are all the same or some other heuristic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can still schedule individual experiment with different policy. Parallel one can prepend or append delay without modulating the individual schedule (the parallel scheduler considers the individual circuit as a block). I think this is another layer of scheduling, and thus we should avoid having the same option. Otherwise user may easily misunderstand the behavior of parallel block scheduling.
@@ -158,6 +197,18 @@ def _combined_circuits(self, device_layout: bool) -> List[QuantumCircuit]: | |||
) from ex | |||
circuit._append(inst, mapped_qargs, mapped_cargs) | |||
|
|||
# If scheduling method is alap append shorter sub-circuits with delays | |||
if scheduling_method == "asap" and pad_time: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this because adding delay after measurement, or adding any instruction to qubit without measurement doesn't make any sense. Then name could be something like delay_sub_circuit_execution: bool
, which can avoid confusion with built-in scheduling logic in preset transpiler.
(Edit) We can add some noisy experiment to investigate spectator interaction, but I don't think adding delay impacts the result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was exactly @ajavadia issue though, since backends defaults to alap scheduling if you want to do asap scheduling you need to do this padding or it will change the alignment when it reschedulings things to alap during execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC this is not the case. Backend has meas_map constraints and they align measurements according to the map. I'm not sure if they can trigger measurement at different time.
Summary
Adds handling for asap and alap scheduling to ParallelExperiment.
Details and comments
Fixes
ParallelExperiment
handling ofscheduling_method transpile option for
"asap"and
"alap"` scheduling to correctly pad the component experiment subcircuits so that the combined circuit has a fixed duration on the experiments physical qubits.