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 a kwarg for num_processes in the transpiler #11554

Merged
merged 14 commits into from
Jan 29, 2024

Conversation

Ca1eb3
Copy link
Contributor

@Ca1eb3 Ca1eb3 commented Jan 12, 2024

Summary

fixes #9365
Add a kwarg to the transpiler which allows for overriding the user configs number of processes. As per this comment #9365 (comment) the order in which number of processes should be determined is the following:

  1. Keyword arguments given explicitly
  2. An argument set by environment variable (i.e. QISKIT_NUM_PROCS in this case)
  3. An argument read from a user's configuration file
  4. The system default

Details and comments

This required modifications to the transpiler to serialize all of the instruction durations before running any of the circuits. I am unsure if this is the best way to go about serialization of the instruction durations and would welcome suggestions of a more straight forward way to achieve this. This also requires modifications to the parallel_map function to allow for None to be passed in as the number of processes and to take on the default specified by the user config or the environment variable.

…uits. Create new function to run circuits and pass it to parallel map.
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Jan 12, 2024
@coveralls
Copy link

coveralls commented Jan 12, 2024

Pull Request Test Coverage Report for Build 7658424322

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.009%) to 89.525%

Totals Coverage Status
Change from base Build 7632033511: -0.009%
Covered Lines: 59568
Relevant Lines: 66538

💛 - Coveralls

@Ca1eb3 Ca1eb3 marked this pull request as ready for review January 13, 2024 05:27
@Ca1eb3 Ca1eb3 requested a review from a team as a code owner January 13, 2024 05:27
@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:

  • @Qiskit/terra-core

@mtreinish mtreinish self-assigned this Jan 23, 2024
@mtreinish mtreinish added this to the 1.0.0 milestone Jan 23, 2024
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.

Thanks for opening this PR, I'm definitely in favor of adding this argument and this is a good start. I have some small concerns about the current implementation that I left an inline comment on. I think that we should be adding an equivalent num_processes kwarg to the PassManager.run method (which internally can call parallel_map) definition and leverage that from inside transpile.

qiskit/compiler/transpiler.py Outdated Show resolved Hide resolved
qiskit/compiler/transpiler.py Outdated Show resolved Hide resolved
qiskit/compiler/transpiler.py Outdated Show resolved Hide resolved
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.

This LGTM now, thanks for the quick update

@mtreinish mtreinish added this pull request to the merge queue Jan 29, 2024
Merged via the queue into Qiskit:main with commit 5ebf7f1 Jan 29, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Expose process-count limits on a per-transpile basis
4 participants