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

Add scheduling to ParallelExperiment #1100

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chriseclectic
Copy link
Collaborator

Summary

Adds handling for asap and alap scheduling to ParallelExperiment.

Details and comments

Fixes ParallelExperiment handling of scheduling_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.

Adds handling for asap and alap scheduling to ParallelExperiment.
@chriseclectic chriseclectic added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Mar 23, 2023
Copy link
Collaborator

@nkanazawa1989 nkanazawa1989 left a 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)
Copy link
Collaborator

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.

Copy link
Collaborator Author

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)

Copy link
Collaborator

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:
Copy link
Collaborator

@nkanazawa1989 nkanazawa1989 Mar 23, 2023

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

@nkanazawa1989 nkanazawa1989 Mar 24, 2023

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.

@coruscating coruscating added this to the Release 0.6 milestone Mar 28, 2023
@coruscating coruscating added the backport stable potential The issue or PR might be minimal and/or import enough to backport to stable label Mar 29, 2023
@coruscating coruscating removed this from the Release 0.6 milestone Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable potential The issue or PR might be minimal and/or import enough to backport to stable Changelog: Bugfix Include in the "Fixed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants