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

Fix unnecessary serialisation of PassManager in serial contexts #12410

Merged
merged 2 commits into from
May 15, 2024

Conversation

jakelishman
Copy link
Member

Summary

This exposes the interal decision in parallel_map of whether to actually run in serial or not. If not, there's no need for PassManager to side-car its dill serialisation onto the side of the IPC (we use dill because we need to pickle lambdas), which can be an unfortunately huge cost for certain IBM pulse-enabled backends.

Details and comments

@sbrandhsn: as the release manager for 1.1.0, it's up to you whether you want to accept this PR in this form for 1.1.0, or defer to 1.1.1 (you can tag the milestone appropriately). I could also suppress exporting should_run_in_parallel into the public namespace if you're not on board with a new public feature this late into the release cycle.

This exposes the interal decision in `parallel_map` of whether to
actually run in serial or not.  If not, there's no need for
`PassManager` to side-car its `dill` serialisation onto the side of the
IPC (we use `dill` because we need to pickle lambdas), which can be an
unfortunately huge cost for certain IBM pulse-enabled backends.
@jakelishman jakelishman added Changelog: New Feature Include in the "Added" section of the changelog Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels May 15, 2024
@jakelishman jakelishman requested a review from a team as a code owner May 15, 2024 14:32
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

To make this eligible for backport I was thinking that we leave should_run_in_parallel as an internal function for now. I agree having it in the public api makes sense longer term, but if we wanted to include this fix in 1.1.x we don't need to expose it in this PR.

qiskit/utils/__init__.py Show resolved Hide resolved
@coveralls
Copy link

coveralls commented May 15, 2024

Pull Request Test Coverage Report for Build 9098821180

Details

  • 12 of 12 (100.0%) changed or added relevant lines in 3 files are covered.
  • 26 unchanged lines in 6 files lost coverage.
  • Overall coverage decreased (-0.03%) to 89.612%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 94.02%
qiskit/passmanager/passmanager.py 1 92.63%
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 2 88.2%
crates/accelerate/src/euler_one_qubit_decomposer.rs 4 89.68%
crates/qasm2/src/lex.rs 5 91.6%
crates/accelerate/src/sabre/neighbor_table.rs 13 73.13%
Totals Coverage Status
Change from base Build 9097424317: -0.03%
Covered Lines: 62298
Relevant Lines: 69520

💛 - Coveralls

@sbrandhsn sbrandhsn added this to the 1.1.0 milestone May 15, 2024
This makes the patch series safe for backport to 1.1.
@jakelishman jakelishman added stable backport potential The bug might be minimal and/or import enough to be port to stable and removed Changelog: New Feature Include in the "Added" section of the changelog labels May 15, 2024
@mtreinish mtreinish enabled auto-merge May 15, 2024 16:03
@mtreinish mtreinish added this pull request to the merge queue May 15, 2024
Merged via the queue into Qiskit:main with commit b12e9ec May 15, 2024
15 checks passed
mergify bot pushed a commit that referenced this pull request May 15, 2024
…2410)

* Fix unnecessary serialisation of `PassManager` in serial contexts

This exposes the interal decision in `parallel_map` of whether to
actually run in serial or not.  If not, there's no need for
`PassManager` to side-car its `dill` serialisation onto the side of the
IPC (we use `dill` because we need to pickle lambdas), which can be an
unfortunately huge cost for certain IBM pulse-enabled backends.

* Remove new function from public API

This makes the patch series safe for backport to 1.1.

(cherry picked from commit b12e9ec)
@jakelishman jakelishman deleted the parallel-check branch May 15, 2024 17:40
github-merge-queue bot pushed a commit that referenced this pull request May 15, 2024
…2410) (#12413)

* Fix unnecessary serialisation of `PassManager` in serial contexts

This exposes the interal decision in `parallel_map` of whether to
actually run in serial or not.  If not, there's no need for
`PassManager` to side-car its `dill` serialisation onto the side of the
IPC (we use `dill` because we need to pickle lambdas), which can be an
unfortunately huge cost for certain IBM pulse-enabled backends.

* Remove new function from public API

This makes the patch series safe for backport to 1.1.

(cherry picked from commit b12e9ec)

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
@1ucian0 1ucian0 added the affects extended support This issue (also) affects extended support label May 30, 2024
@1ucian0
Copy link
Member

1ucian0 commented May 30, 2024

Do you think it makes sense to backport this to stable/0.46?

ElePT pushed a commit to ElePT/qiskit that referenced this pull request May 31, 2024
…skit#12410)

* Fix unnecessary serialisation of `PassManager` in serial contexts

This exposes the interal decision in `parallel_map` of whether to
actually run in serial or not.  If not, there's no need for
`PassManager` to side-car its `dill` serialisation onto the side of the
IPC (we use `dill` because we need to pickle lambdas), which can be an
unfortunately huge cost for certain IBM pulse-enabled backends.

* Remove new function from public API

This makes the patch series safe for backport to 1.1.
@1ucian0
Copy link
Member

1ucian0 commented Jun 4, 2024

@Mergifyio backport stable/0.46

Copy link
Contributor

mergify bot commented Jun 4, 2024

backport stable/0.46

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jun 4, 2024
…2410)

* Fix unnecessary serialisation of `PassManager` in serial contexts

This exposes the interal decision in `parallel_map` of whether to
actually run in serial or not.  If not, there's no need for
`PassManager` to side-car its `dill` serialisation onto the side of the
IPC (we use `dill` because we need to pickle lambdas), which can be an
unfortunately huge cost for certain IBM pulse-enabled backends.

* Remove new function from public API

This makes the patch series safe for backport to 1.1.

(cherry picked from commit b12e9ec)

# Conflicts:
#	qiskit/utils/__init__.py
#	qiskit/utils/parallel.py
github-merge-queue bot pushed a commit that referenced this pull request Jun 8, 2024
…ckport #12410) (#12500)

* Fix unnecessary serialisation of `PassManager` in serial contexts (#12410)

* Fix unnecessary serialisation of `PassManager` in serial contexts

This exposes the interal decision in `parallel_map` of whether to
actually run in serial or not.  If not, there's no need for
`PassManager` to side-car its `dill` serialisation onto the side of the
IPC (we use `dill` because we need to pickle lambdas), which can be an
unfortunately huge cost for certain IBM pulse-enabled backends.

* Remove new function from public API

This makes the patch series safe for backport to 1.1.

(cherry picked from commit b12e9ec)

# Conflicts:
#	qiskit/utils/__init__.py
#	qiskit/utils/parallel.py

* solve conflicts

* passmanager does not know the cpu_count

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects extended support This issue (also) affects extended support Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants