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 --parallel-threads="auto" or similar #23

Open
ngoldbaum opened this issue Jan 14, 2025 · 5 comments · May be fixed by #25
Open

Add --parallel-threads="auto" or similar #23

ngoldbaum opened this issue Jan 14, 2025 · 5 comments · May be fixed by #25

Comments

@ngoldbaum
Copy link
Contributor

This would choose a number of CPUs equal to the number of logical cores. It's surprisingly tricky and platform-dependent to get the correct answer so it would be best for pytest-run-parallel to depend on e.g. os.process_cpu_count on 3.13 and newer and use platform-specific fallbacks on older Python versions.

@ngoldbaum
Copy link
Contributor Author

This might require a dependency on psutil to get this information in a cross-platform way on Python < 3.12.

@rgommers
Copy link
Member

Seems like a good idea to me.

This might require a dependency on psutil to get this information in a cross-platform way on Python < 3.12.

I think so too. I don't remember all of the details, but I needed this for SciPy's dev.py before and ended up extracting this from threadpool_ctl:

https://github.com/scipy/scipy/blob/564da7926ac0900259bf62898f847b27252b6a49/dev.py#L1526-L1736

@lysnikolaou
Copy link
Member

Sounds like a good idea to me too. FWIW here's what pytest-xdist does.

@ngoldbaum
Copy link
Contributor Author

This ended up not being needed by bcrypt so I probably won't implement it quickly. If someone else gets a chance or has a need, please feel free.

@lysnikolaou
Copy link
Member

This ended up not being needed by bcrypt so I probably won't implement it quickly. If someone else gets a chance or has a need, please feel free.

Will work on this tomorrow.

@lysnikolaou lysnikolaou linked a pull request Jan 21, 2025 that will close this issue
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 a pull request may close this issue.

3 participants