forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable multiple parallel seed trials for SabreSwap
The SabreSwap algorithm's output is quite linked to the random seed used to run the algorithm. Typically to get the best result a user will run the pass (or the full transpilation) multiple times with different seeds and pick the best output to get a better result. Since Qiskit#8388 the SabreSwap pass has moved mostly the domain of Rust. This enables us to leverage multithreading easily to run parallel sabre over multiple seeds and pick the best result. This commit adds a new argument trials to the SabreSwap pass which is used to specify the number of random seed trials to run sabre with. Each trial will perform a complete run of the sabre algorithm and compute the swaps necessary for the algorithm. Then the result with the least number of swaps will be selected and used as the swap mapping for the pass.
- Loading branch information
Showing
6 changed files
with
105 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
releasenotes/notes/multiple-parallel-rusty-sabres-32bc93f79ae48a1f.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
features: | ||
- | | ||
The :class:`~.SabreSwap` transpiler pass has a new keyword argument on its | ||
constructor, ``trials``. The ``trials`` argument is used to specify the | ||
number of random seed trials to attempt. The output from the | ||
`SABRE algorithm <https://arxiv.org/abs/1809.02573>`__ can differ greatly | ||
based on the seed used for the random number. :class:`~.SabreSwap` will | ||
now run the algorithm with ``trials`` number of random seeds and pick the | ||
best (with the fewest swaps inserted). If ``trials`` is not specified the | ||
pass will default to use the number of physical CPUs on the local system. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters