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

Split out NLayout rust class into standalone Python module #9064

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

mtreinish
Copy link
Member

Summary

This commit moves the NLayout rust class out of the stochastic swap python module into a new standalone nlayout module in qiskit._accelerate. The NLayout class was originally added with the stochastic swap rust code, but since then it's started being used by other rust code including SabreSwap (and soon to be VF2Layout and VF2PostLayout scoring in #9026).

Details and comments

This commit moves the NLayout rust class out of the stochastic swap
python module into a new standalone nlayout module in
qiskit._accelerate. The NLayout class was originally added with the
stochastic swap rust code, but since then it's started being used by
other rust code including SabreSwap (and soon to be VF2Layout and
VF2PostLayout scoring in Qiskit#9026).
@mtreinish mtreinish added Changelog: None Do not include in changelog Rust This PR or issue is related to Rust code in the repository labels Nov 2, 2022
@mtreinish mtreinish requested a review from a team as a code owner November 2, 2022 22:22
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

Copy link
Contributor

@kevinhartman kevinhartman left a comment

Choose a reason for hiding this comment

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

LGTM

@coveralls
Copy link

Pull Request Test Coverage Report for Build 3381554318

  • 8 of 9 (88.89%) changed or added relevant lines in 5 files are covered.
  • 19 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.03%) to 84.488%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/nlayout.rs 3 4 75.0%
Files with Coverage Reduction New Missed Lines %
src/optimize_1q_gates.rs 1 95.16%
src/sabre_swap/mod.rs 1 95.3%
qiskit/extensions/quantum_initializer/squ.py 2 79.78%
src/results/marginalization.rs 15 79.89%
Totals Coverage Status
Change from base Build 3381173493: -0.03%
Covered Lines: 62348
Relevant Lines: 73795

💛 - Coveralls

@mergify mergify bot merged commit 3095955 into Qiskit:main Nov 2, 2022
@mtreinish mtreinish deleted the nlayout-module branch November 3, 2022 12:45
jakelishman added a commit to jakelishman/qiskit-terra that referenced this pull request Apr 25, 2024
Previously the module of this was set incorrectly (stemming from its
move in Qiskitgh-9064), at which point the `__getstate__`/`__setstate__`
pickling wouldn't work correctly any more.  Also, however, there was no
`__getnewargs__` and `new` didn't have a zero-argument form, so this
wouldn't have worked either.
github-merge-queue bot pushed a commit that referenced this pull request Apr 25, 2024
Previously the module of this was set incorrectly (stemming from its
move in gh-9064), at which point the `__getstate__`/`__setstate__`
pickling wouldn't work correctly any more.  Also, however, there was no
`__getnewargs__` and `new` didn't have a zero-argument form, so this
wouldn't have worked either.
mergify bot pushed a commit that referenced this pull request Apr 25, 2024
Previously the module of this was set incorrectly (stemming from its
move in gh-9064), at which point the `__getstate__`/`__setstate__`
pickling wouldn't work correctly any more.  Also, however, there was no
`__getnewargs__` and `new` didn't have a zero-argument form, so this
wouldn't have worked either.

(cherry picked from commit 136548c)

# Conflicts:
#	test/python/transpiler/test_layout.py
mergify bot pushed a commit that referenced this pull request Apr 25, 2024
Previously the module of this was set incorrectly (stemming from its
move in gh-9064), at which point the `__getstate__`/`__setstate__`
pickling wouldn't work correctly any more.  Also, however, there was no
`__getnewargs__` and `new` didn't have a zero-argument form, so this
wouldn't have worked either.

(cherry picked from commit 136548c)
jakelishman added a commit that referenced this pull request Apr 25, 2024
Previously the module of this was set incorrectly (stemming from its
move in gh-9064), at which point the `__getstate__`/`__setstate__`
pickling wouldn't work correctly any more.  Also, however, there was no
`__getnewargs__` and `new` didn't have a zero-argument form, so this
wouldn't have worked either.
jakelishman added a commit that referenced this pull request Apr 25, 2024
Previously the module of this was set incorrectly (stemming from its
move in gh-9064), at which point the `__getstate__`/`__setstate__`
pickling wouldn't work correctly any more.  Also, however, there was no
`__getnewargs__` and `new` didn't have a zero-argument form, so this
wouldn't have worked either.
github-merge-queue bot pushed a commit that referenced this pull request Apr 26, 2024
* Fix pickling of `NLayout` (#12298)

Previously the module of this was set incorrectly (stemming from its
move in gh-9064), at which point the `__getstate__`/`__setstate__`
pickling wouldn't work correctly any more.  Also, however, there was no
`__getnewargs__` and `new` didn't have a zero-argument form, so this
wouldn't have worked either.

(cherry picked from commit 136548c)

* Switch back to PyO3 0.20

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
github-merge-queue bot pushed a commit that referenced this pull request Apr 26, 2024
* Fix pickling of `NLayout` (#12298)

Previously the module of this was set incorrectly (stemming from its
move in gh-9064), at which point the `__getstate__`/`__setstate__`
pickling wouldn't work correctly any more.  Also, however, there was no
`__getnewargs__` and `new` didn't have a zero-argument form, so this
wouldn't have worked either.

* Switch back to PyO3 0.20

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog Rust This PR or issue is related to Rust code in the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants