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

Multithreaded mode #128

Open
asomers opened this issue Aug 21, 2021 · 7 comments
Open

Multithreaded mode #128

asomers opened this issue Aug 21, 2021 · 7 comments
Labels
C-enhancement Category: A new feature or an improvement for an existing one help wanted Call for participation: Help is requested to fix this issue

Comments

@asomers
Copy link

asomers commented Aug 21, 2021

--each-feature and --feature-powerset are great! My only complaint is that they are slow. bpytop shows that I'm never using more than one core when running cargo-hack. It would be awesome if cargo hack could run multiple cargo processes in parallel, one for each feature combination. Normally Cargo doesn't allow two processes to share the same build directory at the same time, so you could set CARGO_TARGET_DIR to a separate value for each.

There is a little contention for the crate cache, but my crude benchmark shows that I can build targets in parallel in about a quarter of the time it takes to build them sequentially.

@taiki-e taiki-e added the C-enhancement Category: A new feature or an improvement for an existing one label Aug 22, 2021
@taiki-e
Copy link
Owner

taiki-e commented Aug 22, 2021

I think this is a great idea. I would accept a PR to implement this.

@asomers
Copy link
Author

asomers commented Sep 4, 2021

I thought about it, but decided that I don't have the time to do it myself.

@taiki-e taiki-e added the help wanted Call for participation: Help is requested to fix this issue label Nov 4, 2021
@NishantJoshi00
Copy link

Hey, I was looking around and it seems that this issue hasn't been addressed in quite a long time. Wanting to know, if you are still accepting PR, for this issue.

@leighmcculloch
Copy link

@NishantJoshi00 you might want to try #175 that adds a way to get a list of commands out, and then you can run those commands separately for different processes. I'm using that command to run the processes on different machines even.

@NishantJoshi00
Copy link

Interesting! I was able to come up with a similar solution for improving performance. I achieved parallelization with rayon and have a CARGO_TARGET_DIR pool to also leverage caching.
I was planning to raise a PR for this issue too.

@asomers
Copy link
Author

asomers commented Jan 16, 2023

This feature request is no longer as important as it was when I filed it, because rust 1.64.0 supports multitarget builds. So you can now do something like cargo hack check --target i686-linux-android --target x86_64-apple-darwin --target x86_64-apple-ios .... And cargo-hack happily passes all of those targets through to the cargo check command. That provides plenty of parallelism if you have multiple targets to care about. But it still doesn't address the case where the only parallelism comes from different feature sets.

@taiki-e
Copy link
Owner

taiki-e commented Jan 17, 2023

Yeah, this is still useful and PR is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: A new feature or an improvement for an existing one help wanted Call for participation: Help is requested to fix this issue
Projects
None yet
Development

No branches or pull requests

4 participants