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

Remove psutil as a dependency #11336

Merged
merged 16 commits into from
Jan 23, 2024
Merged

Remove psutil as a dependency #11336

merged 16 commits into from
Jan 23, 2024

Conversation

FabianBrings
Copy link
Contributor

@FabianBrings FabianBrings commented Nov 28, 2023

Summary

Removes any uses of psutil and the corresponding dependency

Details and comments

As described in issue #11254, psutil is used to detect the number of cores and memory to optimize resource allocation. The actual usefulness of those information is however questionable, while adding additional bloat. Therefore any references to the module were modified, the unit tests fixed and the dependency removed.

Fixes #11254

@FabianBrings FabianBrings requested review from jyu00, a team and woodsp-ibm as code owners November 28, 2023 22:00
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Nov 28, 2023
@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

@coveralls
Copy link

coveralls commented Nov 28, 2023

Pull Request Test Coverage Report for Build 7626767360

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.03%) to 89.482%

Totals Coverage Status
Change from base Build 7614776689: -0.03%
Covered Lines: 59473
Relevant Lines: 66464

💛 - Coveralls

@FabianBrings
Copy link
Contributor Author

The test that fails is "test_handle_measurement" while performing SabreSwaps. I can reproduce the error, by setting QISKIT_NUM_PROCS=1. SabreSwap uses CPU_COUNT to determine the number of runs while evaluating the heuristic to optimize the circuit. The new method of finding the cpu count probably yields a different, platform-dependent result and therefore the heuristic returns another result. This raises the question, how this test case should be handled. If the reference circuit is not reached depending on system parameters, it is not a sensible test case, but hard overwriting the cpu count with two, just to make this case work seems equally nonsensical. How would you like to proceed?

@mtreinish
Copy link
Member

It's a bug in the test, we should be setting a fixed number of trials to ensure the test is deterministic. So I'd suggest ust hardcoding the trial count in the test.

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.

Overall this LGTM, thanks for tackling this. I just had a few inline comments.

qiskit/utils/multiprocessing.py Show resolved Hide resolved
test/python/test_util.py Outdated Show resolved Hide resolved
@mtreinish mtreinish added this to the 1.0.0 milestone Dec 7, 2023
@mtreinish mtreinish added the Changelog: Removal Include in the Removed section of the changelog label Dec 7, 2023
mtreinish
mtreinish previously approved these changes Jan 22, 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 the PR. I just pushed up some small commits to update the tests and apply my inline suggestions to get this unblocked

@mtreinish mtreinish enabled auto-merge January 22, 2024 21:45
mtreinish
mtreinish previously approved these changes Jan 23, 2024
@mtreinish mtreinish added this pull request to the merge queue Jan 23, 2024
@FabianBrings
Copy link
Contributor Author

Thanks a lot for approving my PR and for helping out with the small fixes!

Merged via the queue into Qiskit:main with commit b5aaffb Jan 23, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Removal Include in the Removed section of the changelog 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.

Remove psutil as a dependency
4 participants