Skip to content

Deprecate qpy loading of old library pulses with complex amp#11256

Closed
TsafrirA wants to merge 71 commits into
Qiskit:stable/0.46from
TsafrirA:ComplexAmp
Closed

Deprecate qpy loading of old library pulses with complex amp#11256
TsafrirA wants to merge 71 commits into
Qiskit:stable/0.46from
TsafrirA:ComplexAmp

Conversation

@TsafrirA
Copy link
Copy Markdown
Contributor

Summary

This PR completes #10357 and adds a deprecation warning when loading an old QPY file containing library symbolic pulses with complex amp.

Details and comments

The deprecation process began in #9002, but #10357 neglected to promote this specific warning to a deprecation warning. The PR is meant for 0.46, while 1.0.0 will have the support removed.

mtreinish and others added 30 commits October 19, 2023 23:54
* Bump main branch version post 0.45.0rc1 tag

Now that the first release candidate for the 0.45.0 release has been
tagged, the stable branch for the 0.45 series has been created and we
can start developing the 1.0.0 release on main. This commit bumps all
the version strings from 0.45.0 to 1.0.0 (and the backport branch for
mergify to 0.45) accordingly to differentiate the main branch from
0.45.*.

* Handle 1.0 in docs build
In the lead up to the 0.45.0rc1 release we used the merge queue to
pipeline the last 2 PRs that merged for the tag. However, this resulted
in a single release note file merging before we could move it into the
0.45/ subdirectory. This commit fixes this so that the final PR for
0.45.0rc1 is correctly grouped in the 0.45 release notes subdirectory.
* Bump indexmap from 2.0.1 to 2.0.2

Bumps [indexmap](https://github.com/bluss/indexmap) from 2.0.1 to 2.0.2.
- [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.md)
- [Commits](indexmap-rs/indexmap@2.0.1...2.0.2)

---
updated-dependencies:
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix indexmap update

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Pull request #11059 bumped the version on `main` to `1.0.0`, but
it missed the version in the toplevel `setup.py`.  This PR
fixes that oversight.

In the current state, the `qiskit` and `qiskit-terra` python packages
cannot be simultaneously installed from `main`.  This led to a CI
failure for us in the circuit knitting toolbox, which can be seen here:
https://github.com/Qiskit-Extensions/circuit-knitting-toolbox/actions/runs/6582190865/job/17883338486
The failure rate for the parametric identity tests was about 0.2%, which
at our CI scale corresponds to approximately one spurious failure every
two days.  The alternative to this is to fix the random seed of the
test, but similar to other `quantum_info` tests, we would like some
degree of extended coverage.  Lifting the tolerance by three orders of
magnitude at this circuit size should ensure a zero false-positive rate.

This also changes the test to actually display the failure tolerance, so
it's easier to tell from a CI run if a failure was real.
* List support for coupling map in pass manager

* remove redundant checks for coupling list in preset pass manager

* remove duplicate release note

* add seed to the coupling list test case

* Fix up release note

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
* Fix typos

* Update qiskit/transpiler/__init__.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update qiskit/transpiler/__init__.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update qiskit/transpiler/__init__.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update qiskit/transpiler/__init__.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update qiskit/transpiler/__init__.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update qiskit/transpiler/__init__.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* add check for backend version to get backend name

* move backend_interface_version

* check backend is None before get version

* Update qiskit/utils/backend_utils.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update releasenotes/notes/fix_backend_name-e84661707058b529.yaml

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* Add disable_check option

* Remove per instance option, add release notes

* Release notes correction
* Fix deprecated Numpy logic in `NormalizeRXAngles`

This new pass added in gh-10634 uses some deprecated Numpy properties
and has some slightly fragile exception-based logic when the required
properties can be directly tested.  This code issues warnings with Numpy
1.25+, which is currently not used by CI due to gh-10305.

* Fix return value
* Introduce logical elements and frames.

* test fix

* Update qiskit/pulse/logical_elements_frames.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/logical_elements_frames.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/logical_elements_frames.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/logical_elements_frames.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Split files

* Remove name from MixedFrame

* fixes

* Update qiskit/pulse/model/__init__.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/frames.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/logical_elements.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/logical_elements.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/logical_elements.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/mixed_frames.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/mixed_frames.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/mixed_frames.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/frames.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/frames.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/logical_elements.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/logical_elements.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/logical_elements.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/logical_elements.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/__init__.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit/pulse/model/__init__.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* fixes

* doc mod name

* doc fix

* doc fix

* doc fix

* Qubit ref fix

* Qubit ref fix

* Qubit ref fix

* Qubit ref fix legacy release notes

* Update qiskit/circuit/quantumcircuit.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/__init__.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/__init__.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/mixed_frames.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/mixed_frames.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Update qiskit/pulse/model/mixed_frames.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* minor fixes

* Qubit ref

* last doc fixes

* last doc fixes

* lynt

---------

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Will Shanks <wshaos@posteo.net>
Bumps [ahash](https://github.com/tkaitchuck/ahash) from 0.8.3 to 0.8.5.
- [Release notes](https://github.com/tkaitchuck/ahash/releases)
- [Commits](tkaitchuck/aHash@v0.8.3...v0.8.5)

---
updated-dependencies:
- dependency-name: ahash
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [ahash](https://github.com/tkaitchuck/ahash) from 0.8.5 to 0.8.6.
- [Release notes](https://github.com/tkaitchuck/ahash/releases)
- [Commits](https://github.com/tkaitchuck/ahash/commits)

---
updated-dependencies:
- dependency-name: ahash
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit fixes an issue with the Barrier class's
broadcast_arguments() method. Previously the Barrier class was
overriding broadcast_arguments(), however this custom implementation
resulted in an identical output to the Instruction's implementation
(its parent class) but stripped out all the error checking to determine
if the arguments aligned with the size of the instruction. This could
result in creating a corrupt circuit that had a mismatch between the
barrier width and the number of qargs. For example:

```
circuit = QuantumCircuit(1)
circuit.append(Barrier(42), [0])
```

would not error despite trying to add a 42 qubit barrier on qubit 0.
This would result in weird errors such as invalid qpy generation that
are confusing to debug. This commit fixes this by deleting the
broadcast_arguments() implementation for Barrier so it will just
depend on the inherited implementation from Instruction which will
return an identical result but check the instruction is valid.
* fix zordering and labels outside of plot

* lint and reno

* Changed reference image for state city

* correct visual of negative real value bars

* added release notes for negative real bars fix

* remove debug print statement in plot_state_city

* fix with tox eblack

* append rho to title

Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

---------

Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
The 0.13.0 release of qiskit-aer causes several test failures, some of
which look like changes in the randomisation, and some of which look
like true failures.  These need a proper resolution, but it's more work
than can be easily attached to a PR that's just meant to get CI rolling
again.
In #10820 a test qpy file from the development of the PR accidentally got
merged as part of the PR. This shouldn't have been committed and was a
mistake. This commit just removes the stray file so we're not continuing
to carry it around (although it will remain in the git history forever).
This sets all file access in the translatable strings bash script to be
via absolute paths, rather than relative paths that have proven
error-prone to update as the repository structure changes, especially as
multiple base directories and git repositories are used.
* Always run vf2 scoring serially

The VF2Layout and VF2PostLayout passes' Rust scoring function has the
option to use a parallel iterator for computing the score of a layout
given a sufficiently large circuit (both in number of 2q interactions or
qubits). Previously the scoring would be multithreaded if there were >
50 qubits or > 50 2q interactions in the circuit. However, as recent
testing has shown in most cases the performance of doing this operation
in parallel is much worse than serial execution. To address this issue,
this commit just always uses the serial version. The parallel option is
left in place for now just in case someone was manually calling the
scoring function with the parallel option set to ``True``.

* Add release note
This commit updates the qpy load() function to ensure we are raising a
descriptive error message when a user attempts to load a qpy version
that's not supported by this version of qiskit. Previously it would
fail but with a hard to understand internal error message which was just
confusing and not helpful. For example, when trying to load a QPY
version 10 payload with qiskit 0.25.2 (which only supported up to
version 9) it would raise an error message like:

```
Invalid payload format data kind 'b'p''."
```

which doesn't tell you anything meaningful unless you are intimately
familiar with the QPY file format and how the load() function works.
With this commit it now checks if the version number is supported
immediately and if it's too new it will raise an error message that says
exactly that. So in the above scenario instead of that error message it
will say:

```
The QPY format version being read, 10, isn't supported by this Qiskit
version. Please upgrade your version of Qiskit to load this QPY payload.
```
* Reuse VF2 scoring views for all scoring

As part of the VF2Layout and VF2PostLayout passes when there are a large
number of matches found we're spending an inordinate amount of time in
scoring rebuilding the same views over and over again of the interaction
graph for each scoring call. For example, in one test cProfile showed
that with #11112 when running transpile() on a 65 Bernstein Vazirani
circuit with a secret of all 1s for FakeSherbrooke with
optimization_level=3 we were calling vf2_utils.score_layout() 161,761
times which took a culmulative time of 14.33 secs. Of that time though
we spent 5.865 secs building the edge list view.

These views are fixed for a given interaction graph which doesn't change
during the duration of the run() method on these passes. To remove this
inefficiency this commit moves the construction of the views to the
beginning of the passes and just reuses them by reference for each
scoring call, avoiding the reconstruction overhead.

* Add EdgeList Rust pyclass to avoid repeated conversion

This commit adds a new pyclass written in rust that wraps a rust
Vec. Previously the scoring function also used an dict->IndexMap
conversion, but the mapping structure wasn't necessary and added
additional overhead, so it was converted to a list/Vec to speed up the
execution even further. By using this new pyclass as the input to the
rust scoring function we avoid converting the edge list from a list to
an Vec on each call which will reduce the overhead even further.
* only publish images if image tests run

* fix indent in bash command

* fix condition syntax

* set value in the image test

* test runner stopping correctly on fail

* revert purposeful failure

* tidy up trailing whitespace
* Add alternative and deprecation warning

* Add deprecation test

* Apply Julien's suggestion

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Apply suggestions from Julien's code review

* Move optimizer setting to init

* Fix ddt import

* Fix lint

* Add reno

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
* Don't test forward compatibility in qpy compat tests

The qpy compatibility tests are designed to test backwards
compatibility. They generate QPY files using all historical releases
of Qiskit with QPY support and test that all proposed changes are
able to load the qpy files. There was an underlying assumption to how
the tests were written that the version under test is always newer
than all the historical releases. This has been true in the past because
the release model for qiskit mean that we were maintaining at most one
stable release at a time, and when we released a new minor version of
qiskit we retired the previous minor version release series's branch.
However, moving forward this assumption will no longer be true as we're
moving to a model where we support > 1 branch at a time. When we start
supporting > 1 release series at a time, PRs proposed to the older
stable branches will no longer be able to test all releases because QPY
only support backwards compatibility and will not be able to load QPY
files generated from newer releases. The example of this was in the
0.25.x series, there is overlap in the support of the stable/0.25 branch
and the stable/0.45 branch, and after the release of 0.45.0rc1 the tests
started to fail because you can't load QPY files generated with
0.45.0rc1 with 0.25.x.

This commit address this by adding a condition to the QPY compat scripts
to ensure that the version under test is >= the QPY file source version.
If we encounter that scenario we just skip the tests. This should
prevent this situation from occurring for future releases as we expand
our support windows.

* Fix syntax errors

* Use a Python script to compare versions

This commit adds a small python script to compare two version strings
and determine whether the version under test is newer (or the same) as
the source version. The logic for making this determination was a bit
more involved in bash, so using a python script lets us reuse the regex
built into qpy's interface to support this comparison already.

* Fix lint

* Fix return code with invalid version

This commit fixes the return code generation if an invalid comparison is
requested. We want to handle this with a 0 return code to treat it as a
skip, but the previous logic would error before we evaluated the if
statement.

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
jakelishman and others added 29 commits November 2, 2023 19:29
`QuantumCircuit._append` is the actual append primitive and is allowed
in inner-loop appends (and for `QuantumCircuit` to assume that it's
callable from other methods), so it's important that the "ensure built"
check happens there, not in `append`.
* General PM bugfix and add test module

* release note

* Revert "release note"

This reverts commit 908e03d.

* Allow only list type as a collection of input data

* Replace assert log method with context manager

* Giveup fullmatch
In #10754 3 legacy scheduling passes were accidently deleted. These
passes were incorrectly identified as deprecated, however they were
never marked as deprecating just pending future deprecation. They were
intended to be be promoted from a pending deprecation to a full
deprecation in #8023 but we never took that step because there were
objections at the time as they still served a purpose. #10754 likely
missed this as the only indication in the deprecation decorator was a
kwarg that said `pending=True`, and this was the only indication that
these passes weren't actually deprecated yet. This commit restores these
passes on the 0.45.0 branch in the interest of unblocking the 0.45.0
release ASAP. We can handle forward porting this PR to main as needed
after the 0.45.0 release is tagged.

(cherry picked from commit aa272e9)

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* Improves Returned Information of VF2PostLayout

* small change to class doc

* Set 'no better solution' as default

* added release note

* update reno
* fixed the broken formatting

* Remove extra space

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
* formatting and typo issues in qiskit.transpiler.Target

* #11164 (comment)

* #11164 (comment)
* added registers to layout in sabre_layout pass

* Add reno and test

* Fix layout method in test

* Set transpiler seed

* modified reference circuit for test

---------

Co-authored-by: Elena Peña Tapia <epenatap@gmail.com>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
This removes the warnings converting explicit `None`s into empty tuples,
following its deprecation in 0.45.
* removed _mod_2pi

* added release note

* Improved linting ,formatting & the fix.

* Partially fixed pylint errors

* removed redundant _mod_2pi from dynamical_decoupling

* Update releasenotes

Added PadDynamicalDecoupling class & kept higher level.

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Added a test.

* Replaced `try` block with `assertEqual()` statement.

* Fixup release note

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
…ners_guide.rst (#11196) (#11197)

* Substituted mentions of the master branch with mentions to main in the
  file docs/maintainers_guide.rst
* Allow barriers in overlap circuit inputs

* Minor fixes plus test with barriers

* Check parameter number on barrier test, similar to other non-failing tests.

* test order

* Add release note
)

* Use InverseCancellation in opt level 1 instead of CXCancellation

This commit updates the default optimization stage plugin to use the
InverseCancellation pass instead of CXCancellation for optimization
level 1. The CXCancellation pass was hard coded to only cancel runs of
CX gates on the same qubits. This was fine when CX is the target, but
for other targets which aren't using CX the pass had no value. An
alternative, more general, inverse cancellation pass was added in #6855
that enables defining arbitrary inverse cancellation rules and
simplifying a dag based on it. This commit updates the default
optimization plugin at optimization level 1 to use this with some common
inverse rules for 2q gates from the standard gate library.

Closes: #6576
Closes: #7016
Related-to: #7112

* Add sx sx dagger inverse pair to pass
This commit removes the pkgutil namespace hooks that are used for
extending the `qiskit.*` and `qiskit.providers.*` namespaces from
external packages. These were previously used to enable the elements
packaging model where different parts of qiskit lived in separate python
packages under a shared namespace. This is no longer being used and
leaving the namespace extendable by external packages carries a risk of
issues or other accidental cross-interactions when an external package
gets loaded as part of Qiskit.
Previously, the `uninstall` component of the asv configuration was
attempting to uninstall the package `qiskit`.  This _is_ the name of the
project, but it's not the name of the relevant Python package, and so
was not being uninstalled correctly.  This meant that asv's managed
environments would retain the previous build, unless the updating the
commit changed the version number of the package.

This behaviour caused our tracking bot to be benchmarking the state of
the package only at the commit points that bump version numbers on
`main`.  Typically, this means it was only ever benchmarking the
release-candidate versions of the package since we migrated from the
metapackage.
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.11.1 to 1.11.2.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](servo/rust-smallvec@v1.11.1...v1.11.2)

---
updated-dependencies:
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The major problem in NumPy 1.25 transpired to be that particular
versions of Apple clang (including the one used in Numpy's wheel-build
CD pipelines) produced non-deterministic code from new SIMD routines for
complex multiplication.  This in turn destabilised our `Isometry`
decompositions, which caused major correctness problems.  As of Numpy
1.26.1 (released 2023-10-14), that SIMD code now decays to the scalar
form if the compiler was known to be buggy, which restores the previous
behaviour.
Removing the restriction on the numpy version has introduced some
non-determinism to some of the unitary synthesis tests that is causing a
flaky failure in CI. This commit reverts the version cap removal to
unblock CI. In parallel we should debug the source of the instability
causing the test to fail so we can run CI using the latest version of
numpy.

This reverts commit fb8a69d.
* Delete qiskit.algorithms and tests

* Remove algorithms from tests

* Remove references from docs

* Remove references from renos

* Remove optimizer references from AQC

* Remove algorithms API doc

* Add release note

* Revert "Remove references from renos"

This reverts commit 6b291ab.

* Update releasenotes/notes/remove-qiskit-algorithms-a43541fe24b72208.yaml
* Add PulseTarget, Port

* Update qiskit/pulse/model/__init__.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Corrections

---------

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
* Singletonized 'Measure' and 'Reset' instructions and drafted a release note

* Added singleton key functionality and test cases for Measure() and Reset() singleton instructions

* Implemented corrections from review on test_singleton module
* Add new transpiler exception class for too many qubits

This commit adds a new exception class for when the transpiler is
given a circuit too many qubits for a given backend. Previously the
generic TranspilerError was raised for this, but it made it difficult
for downstream users to catch as it wasn't easy to differentiate this
error condition from other TranspilerError exceptions. There isn't any
backwards compatibility issues with this because the new
CircuitToWideForTarget class is a subclass of TranspilerError so any of
the previous catches for TranspilerError will still catch this.

* Fix typo in class name

* Make test check more specific exception type

* Replace :class: with :exc: in release note
* Speed up InverseCancellation when there's nothing to cancel

In the cases when there is nothing to cancel in the DAGCircuit the
InverseCancellation pass would iterate over the entire circuit twice,
once to search for self inverse gates and then a second time to search
for other inverse pairs. This is typically fairly fast because the
actual search is done in rust, but there is a python callback function
that is called for each node. Depending on the size of the circuit this
could add up to a significant amount of time. This commit updates the
logic in the pass to first check if there are any operations being asked
to cancel for either stage, and if there are then only do the iteration
if there are any gates in the circuit in the set of intructions that
will be cancelled, which means we'll need to do an iteration. These
checks are all O(1) for any sized dag, so they're much lower overhead
and will mean the pass executes much faster in the case when there isn't
anything to cancel.

* Speed-up when there is a partial match

Building off of the previous commit this speeds up the inverse
cancellation pass when only some of the inverse pairs are not present in
the DAG, but others are present. In this case the previous commit would
still iterate over the full dag multiple times even when we know some of
the inverse pairs are not present in the DAG. This commit updates the
logic to not call collect_runs() if we know it's going to be empty or
there is no cancellation opportunity.

* Expand test coverage

* Add more tests

* Fix handling of parameterized gates

This commit adds a fix for an issue that was caught while tuning the
performance of the pass. If a parameterized self inverse was passed in
the pass would incorrectly treat all instances of that parameterized'
gate as being a self inverse without checking the parameter values.
This commit corrects this oversight to handle this case to only cancel
gates when the optimization is correct.
* Ensure metapackage is installed during CI and tox

This ensures that the local version of the metapackage is also built and
installed on all CI runs (and in `tox`, where it's overridden) so that
dependencies on the metapackage in our optionals (e.g. Aer) will not
cause the older released version of Terra to be installed.

`tox` does not like having two local packages under test simultaneously
through its default configuration, so this fakes things out by putting
the two packages in the run dependencies and setting `skip_install`.

* Fix sdist build

* Use regular installs for metapackage

* Simplify build requirements install
This removes some debugging `print` statements from the test suite, to
avoid noise in the test-runner output.  In some cases, the `print` was
only part of an assertion that the conversion to string fails, and these
were converted to explicit calls to `str`.  This isn't strictly
necessary, it's just trying to get the test suite out of the habit of
using `print`.
@TsafrirA TsafrirA closed this Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.